Update .editorconfig and fix conf indents (#8442)

This commit is contained in:
Jukka Kurkela 2021-02-17 15:11:40 +02:00 committed by GitHub
parent a73a8c4a5e
commit c96c167074
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 362 additions and 362 deletions

View File

@ -8,3 +8,7 @@ end_of_line = lf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[*.html]
indent_style = tab
indent_size = 4

View File

@ -1,98 +1,97 @@
/* eslint-disable import/no-commonjs */
// VERSION replaced by deploy script // VERSION replaced by deploy script
module.exports = { module.exports = {
title: 'Chart.js', title: 'Chart.js',
tagline: 'Open source HTML5 Charts for your website', tagline: 'Open source HTML5 Charts for your website',
url: 'https://chartjs.org', url: 'https://chartjs.org',
baseUrl: '/docs/VERSION/', baseUrl: '/docs/VERSION/',
favicon: 'img/favicon.ico', favicon: 'img/favicon.ico',
organizationName: 'chartjs', // Usually your GitHub org/user name. organizationName: 'chartjs', // Usually your GitHub org/user name.
projectName: 'chartjs.github.io', // Usually your repo name. projectName: 'chartjs.github.io', // Usually your repo name.
scripts: ['https://www.chartjs.org/dist/VERSION/chart.min.js'], scripts: ['https://www.chartjs.org/dist/VERSION/chart.min.js'],
themes: ['@docusaurus/theme-live-codeblock'], themes: ['@docusaurus/theme-live-codeblock'],
onBrokenLinks: 'warn', onBrokenLinks: 'warn',
themeConfig: { themeConfig: {
algolia: { algolia: {
apiKey: 'd7ee00a3cbaaf3c33e28ad1c274e7ba6', apiKey: 'd7ee00a3cbaaf3c33e28ad1c274e7ba6',
indexName: 'chartjs', indexName: 'chartjs',
algoliaOptions: { algoliaOptions: {
facetFilters: ['version:VERSION'], facetFilters: ['version:VERSION'],
} }
}, },
googleAnalytics: { googleAnalytics: {
trackingID: 'UA-28909194-3', trackingID: 'UA-28909194-3',
// Optional fields. // Optional fields.
anonymizeIP: true, // Should IPs be anonymized? anonymizeIP: true, // Should IPs be anonymized?
}, },
colorMode: { colorMode: {
disableSwitch: true, // Would need to implement for Charts embedded in docs disableSwitch: true, // Would need to implement for Charts embedded in docs
}, },
navbar: { navbar: {
title: 'Chart.js', title: 'Chart.js',
logo: { logo: {
alt: 'Chart.js Logo', alt: 'Chart.js Logo',
src: 'img/logo.svg', src: 'img/logo.svg',
}, },
}, },
footer: { footer: {
style: 'dark', style: 'dark',
links: [ links: [
{ {
title: 'Other Docs', title: 'Other Docs',
items: [ items: [
{ {
label: 'Samples', label: 'Samples',
href: 'https://www.chartjs.org/samples/VERSION/', href: 'https://www.chartjs.org/samples/VERSION/',
}, },
{ {
label: 'v2 Docs', label: 'v2 Docs',
href: 'https://www.chartjs.org/docs/2.9.4/', href: 'https://www.chartjs.org/docs/2.9.4/',
}, },
], ],
}, },
{ {
title: 'Community', title: 'Community',
items: [ items: [
{ {
label: 'Slack', label: 'Slack',
href: 'https://chartjs-slack.herokuapp.com/', href: 'https://chartjs-slack.herokuapp.com/',
}, },
{ {
label: 'Stack Overflow', label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/chart.js', href: 'https://stackoverflow.com/questions/tagged/chart.js',
}, },
], ],
}, },
{ {
title: 'Developers', title: 'Developers',
items: [ items: [
{ {
label: 'GitHub', label: 'GitHub',
href: 'https://github.com/chartjs/Chart.js', href: 'https://github.com/chartjs/Chart.js',
}, },
{ {
label: 'Contributing', label: 'Contributing',
to: 'developers/contributing', to: 'developers/contributing',
}, },
], ],
}, },
], ],
copyright: `Copyright © ${new Date().getFullYear()} Chart.js contributors.`, copyright: `Copyright © ${new Date().getFullYear()} Chart.js contributors.`,
}, },
}, },
presets: [ presets: [
[ [
'@docusaurus/preset-classic', '@docusaurus/preset-classic',
{ {
docs: { docs: {
sidebarPath: require.resolve('./sidebars.js'), sidebarPath: require.resolve('./sidebars.js'),
routeBasePath: '/', routeBasePath: '/',
editUrl: 'https://github.com/chartjs/Chart.js/edit/master/docs/', editUrl: 'https://github.com/chartjs/Chart.js/edit/master/docs/',
}, },
theme: { theme: {
customCss: require.resolve('./src/css/custom.css'), customCss: require.resolve('./src/css/custom.css'),
}, },
}, },
], ],
], ],
}; };

View File

@ -2,88 +2,88 @@ const pkg = require('../package.json');
const docsVersion = pkg.version.indexOf('-') > -1 ? 'next' : 'latest'; const docsVersion = pkg.version.indexOf('-') > -1 ? 'next' : 'latest';
module.exports = { module.exports = {
someSidebar: { someSidebar: {
Introduction: ['index'], Introduction: ['index'],
'Getting Started': [ 'Getting Started': [
'getting-started/index', 'getting-started/index',
'getting-started/installation', 'getting-started/installation',
'getting-started/integration', 'getting-started/integration',
'getting-started/usage', 'getting-started/usage',
'getting-started/v3-migration' 'getting-started/v3-migration'
], ],
General: [ General: [
'general/data-structures', 'general/data-structures',
'general/accessibility', 'general/accessibility',
'general/responsive', 'general/responsive',
'general/device-pixel-ratio', 'general/device-pixel-ratio',
'general/locale', 'general/locale',
{Interactions: ['general/interactions/index', 'general/interactions/events', 'general/interactions/modes']}, {Interactions: ['general/interactions/index', 'general/interactions/events', 'general/interactions/modes']},
'general/options', 'general/options',
'general/colors', 'general/colors',
'general/fonts', 'general/fonts',
'general/performance' 'general/performance'
], ],
Configuration: [ Configuration: [
'configuration/index', 'configuration/index',
'configuration/animations', 'configuration/animations',
'configuration/layout', 'configuration/layout',
'configuration/legend', 'configuration/legend',
'configuration/title', 'configuration/title',
'configuration/tooltip', 'configuration/tooltip',
'configuration/elements', 'configuration/elements',
'configuration/decimation' 'configuration/decimation'
], ],
'Chart Types': [ 'Chart Types': [
'charts/line', 'charts/line',
'charts/bar', 'charts/bar',
'charts/radar', 'charts/radar',
'charts/doughnut', 'charts/doughnut',
'charts/polar', 'charts/polar',
'charts/bubble', 'charts/bubble',
'charts/scatter', 'charts/scatter',
'charts/area', 'charts/area',
'charts/mixed' 'charts/mixed'
], ],
Axes: [ Axes: [
'axes/index', 'axes/index',
{Cartesian: [ {Cartesian: [
'axes/cartesian/index', 'axes/cartesian/index',
'axes/cartesian/category', 'axes/cartesian/category',
'axes/cartesian/linear', 'axes/cartesian/linear',
'axes/cartesian/logarithmic', 'axes/cartesian/logarithmic',
'axes/cartesian/time', 'axes/cartesian/time',
'axes/cartesian/timeseries' 'axes/cartesian/timeseries'
]}, ]},
{Radial: [ {Radial: [
'axes/radial/index', 'axes/radial/index',
'axes/radial/linear' 'axes/radial/linear'
]}, ]},
'axes/labelling', 'axes/labelling',
'axes/styling' 'axes/styling'
], ],
Developers: [ Developers: [
'developers/index', 'developers/index',
'developers/api', 'developers/api',
{ {
type: 'link', type: 'link',
label: 'TypeDoc', label: 'TypeDoc',
href: 'https://chartjs.org/docs/' + docsVersion + '/typedoc/' href: 'https://chartjs.org/docs/' + docsVersion + '/typedoc/'
}, },
'developers/updates', 'developers/updates',
'developers/plugins', 'developers/plugins',
'developers/charts', 'developers/charts',
'developers/axes', 'developers/axes',
'developers/contributing', 'developers/contributing',
'developers/publishing' 'developers/publishing'
], ],
'Additional Notes': [ 'Additional Notes': [
'notes/comparison', 'notes/comparison',
{ {
type: 'link', type: 'link',
label: 'Extensions', label: 'Extensions',
href: 'https://github.com/chartjs/awesome' href: 'https://github.com/chartjs/awesome'
}, },
'notes/license' 'notes/license'
] ]
}, },
}; };

View File

@ -6,118 +6,118 @@ const builds = require('./rollup.config');
const yargs = require('yargs'); const yargs = require('yargs');
module.exports = function(karma) { module.exports = function(karma) {
const args = yargs const args = yargs
.option('verbose', {default: false}) .option('verbose', {default: false})
.argv; .argv;
const grep = args.grep === true ? '' : args.grep; const grep = args.grep === true ? '' : args.grep;
const specPattern = 'test/specs/**/*' + grep + '*.js'; const specPattern = 'test/specs/**/*' + grep + '*.js';
// Use the same rollup config as our dist files: when debugging (npm run dev), // Use the same rollup config as our dist files: when debugging (npm run dev),
// we will prefer the unminified build which is easier to browse and works // we will prefer the unminified build which is easier to browse and works
// better with source mapping. In other cases, pick the minified build to // better with source mapping. In other cases, pick the minified build to
// make sure that the minification process (terser) doesn't break anything. // make sure that the minification process (terser) doesn't break anything.
const regex = karma.autoWatch ? /chart\.js$/ : /chart\.min\.js$/; const regex = karma.autoWatch ? /chart\.js$/ : /chart\.min\.js$/;
const build = builds.filter(v => v.output.file && v.output.file.match(regex))[0]; const build = builds.filter(v => v.output.file && v.output.file.match(regex))[0];
if (args.coverage) { if (args.coverage) {
build.plugins = [ build.plugins = [
json(), json(),
resolve(), resolve(),
istanbul({exclude: ['node_modules/**/*.js', 'package.json']}) istanbul({exclude: ['node_modules/**/*.js', 'package.json']})
]; ];
} }
karma.set({ karma.set({
frameworks: ['jasmine'], frameworks: ['jasmine'],
reporters: ['progress', 'kjhtml'], reporters: ['progress', 'kjhtml'],
browsers: (args.browsers || 'chrome,firefox').split(','), browsers: (args.browsers || 'chrome,firefox').split(','),
logLevel: karma.LOG_INFO, logLevel: karma.LOG_INFO,
client: { client: {
jasmine: { jasmine: {
failFast: !!karma.autoWatch failFast: !!karma.autoWatch
} }
}, },
// Explicitly disable hardware acceleration to make image // Explicitly disable hardware acceleration to make image
// diff more stable when ran on Travis and dev machine. // diff more stable when ran on Travis and dev machine.
// https://github.com/chartjs/Chart.js/pull/5629 // https://github.com/chartjs/Chart.js/pull/5629
customLaunchers: { customLaunchers: {
chrome: { chrome: {
base: 'Chrome', base: 'Chrome',
flags: [ flags: [
'--disable-accelerated-2d-canvas', '--disable-accelerated-2d-canvas',
'--disable-background-timer-throttling', '--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows', '--disable-backgrounding-occluded-windows',
'--disable-renderer-backgrounding' '--disable-renderer-backgrounding'
] ]
}, },
firefox: { firefox: {
base: 'Firefox', base: 'Firefox',
prefs: { prefs: {
'layers.acceleration.disabled': true 'layers.acceleration.disabled': true
} }
}, },
safari: { safari: {
base: 'SafariPrivate' base: 'SafariPrivate'
}, },
edge: { edge: {
base: 'Edge' base: 'Edge'
} }
}, },
files: [ files: [
{pattern: 'test/fixtures/**/*.js', included: false}, {pattern: 'test/fixtures/**/*.js', included: false},
{pattern: 'test/fixtures/**/*.json', included: false}, {pattern: 'test/fixtures/**/*.json', included: false},
{pattern: 'test/fixtures/**/*.png', included: false}, {pattern: 'test/fixtures/**/*.png', included: false},
'node_modules/moment/min/moment.min.js', 'node_modules/moment/min/moment.min.js',
{pattern: 'test/index.js', watched: false}, {pattern: 'test/index.js', watched: false},
{pattern: 'test/BasicChartWebWorker.js', included: false}, {pattern: 'test/BasicChartWebWorker.js', included: false},
{pattern: 'src/index.js', watched: false}, {pattern: 'src/index.js', watched: false},
'node_modules/chartjs-adapter-moment/dist/chartjs-adapter-moment.js', 'node_modules/chartjs-adapter-moment/dist/chartjs-adapter-moment.js',
{pattern: specPattern} {pattern: specPattern}
], ],
preprocessors: { preprocessors: {
'test/index.js': ['rollup'], 'test/index.js': ['rollup'],
'src/index.js': ['sources'] 'src/index.js': ['sources']
}, },
rollupPreprocessor: { rollupPreprocessor: {
plugins: [ plugins: [
json(), json(),
resolve(), resolve(),
commonjs({exclude: ['src/**', 'test/**']}), commonjs({exclude: ['src/**', 'test/**']}),
], ],
output: { output: {
name: 'test', name: 'test',
format: 'umd', format: 'umd',
sourcemap: karma.autoWatch ? 'inline' : false sourcemap: karma.autoWatch ? 'inline' : false
} }
}, },
customPreprocessors: { customPreprocessors: {
sources: { sources: {
base: 'rollup', base: 'rollup',
options: build options: build
} }
}, },
// These settings deal with browser disconnects. We had seen test flakiness from Firefox // These settings deal with browser disconnects. We had seen test flakiness from Firefox
// [Firefox 56.0.0 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms. // [Firefox 56.0.0 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
// https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551 // https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551
browserDisconnectTolerance: 3 browserDisconnectTolerance: 3
}); });
if (args.coverage) { if (args.coverage) {
karma.reporters.push('coverage'); karma.reporters.push('coverage');
karma.coverageReporter = { karma.coverageReporter = {
dir: 'coverage/', dir: 'coverage/',
reporters: [ reporters: [
{type: 'html', subdir: 'html'}, {type: 'html', subdir: 'html'},
{type: 'lcovonly', subdir: (browser) => browser.toLowerCase().split(/[ /-]/)[0]} {type: 'lcovonly', subdir: (browser) => browser.toLowerCase().split(/[ /-]/)[0]}
] ]
}; };
} }
}; };

View File

@ -1,6 +1,3 @@
/* eslint-disable import/no-commonjs */
/* eslint-env es6 */
const cleanup = require('rollup-plugin-cleanup'); const cleanup = require('rollup-plugin-cleanup');
const dts = require('rollup-plugin-dts').default; const dts = require('rollup-plugin-dts').default;
const json = require('@rollup/plugin-json'); const json = require('@rollup/plugin-json');
@ -10,12 +7,12 @@ const pkg = require('./package.json');
const input = 'src/index.js'; const input = 'src/index.js';
const inputESM = { const inputESM = {
'dist/chart.esm': 'src/index.esm.js', 'dist/chart.esm': 'src/index.esm.js',
'dist/helpers.esm': 'src/helpers/index.js' 'dist/helpers.esm': 'src/helpers/index.js'
}; };
const inputESMTypings = { const inputESMTypings = {
'dist/chart.esm': 'types/index.esm.d.ts', 'dist/chart.esm': 'types/index.esm.d.ts',
'dist/helpers.esm': 'types/helpers/index.d.ts' 'dist/helpers.esm': 'types/helpers/index.d.ts'
}; };
const banner = `/*! const banner = `/*!
@ -26,79 +23,79 @@ const banner = `/*!
*/`; */`;
module.exports = [ module.exports = [
// UMD builds // UMD builds
// dist/chart.min.js // dist/chart.min.js
// dist/chart.js // dist/chart.js
{ {
input, input,
plugins: [ plugins: [
json(), json(),
resolve(), resolve(),
cleanup({ cleanup({
sourcemap: true sourcemap: true
}) })
], ],
output: { output: {
name: 'Chart', name: 'Chart',
file: 'dist/chart.js', file: 'dist/chart.js',
banner, banner,
format: 'umd', format: 'umd',
indent: false, indent: false,
}, },
}, },
{ {
input, input,
plugins: [ plugins: [
json(), json(),
resolve(), resolve(),
terser({ terser({
output: { output: {
preamble: banner preamble: banner
} }
}) })
], ],
output: { output: {
name: 'Chart', name: 'Chart',
file: 'dist/chart.min.js', file: 'dist/chart.min.js',
format: 'umd', format: 'umd',
indent: false, indent: false,
}, },
}, },
// ES6 builds // ES6 builds
// dist/chart.esm.js // dist/chart.esm.js
// helpers/*.js // helpers/*.js
{ {
input: inputESM, input: inputESM,
plugins: [ plugins: [
json(), json(),
resolve(), resolve(),
cleanup({ cleanup({
sourcemap: true sourcemap: true
}) })
], ],
output: { output: {
dir: './', dir: './',
chunkFileNames: 'dist/chunks/[name].js', chunkFileNames: 'dist/chunks/[name].js',
banner, banner,
format: 'esm', format: 'esm',
indent: false, indent: false,
}, },
}, },
// ES6 Typings builds // ES6 Typings builds
// dist/chart.esm.d.ts // dist/chart.esm.d.ts
// helpers/*.d.ts // helpers/*.d.ts
{ {
input: inputESMTypings, input: inputESMTypings,
plugins: [ plugins: [
dts() dts()
], ],
output: { output: {
dir: './', dir: './',
chunkFileNames: 'dist/chunks/[name].ts', chunkFileNames: 'dist/chunks/[name].ts',
banner, banner,
format: 'esm', format: 'esm',
indent: false, indent: false,
}, },
} }
]; ];