From: Jukka Kurkela Date: Wed, 17 Feb 2021 13:11:40 +0000 (+0200) Subject: Update .editorconfig and fix conf indents (#8442) X-Git-Tag: v3.0.0-beta.11~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c96c167074d5c6e1f420d4be03baa484dafda726;p=thirdparty%2FChart.js.git Update .editorconfig and fix conf indents (#8442) --- diff --git a/.editorconfig b/.editorconfig index a56f2d2d2..063c99ae9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,3 +8,7 @@ end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true + +[*.html] +indent_style = tab +indent_size = 4 diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 9f520403f..c7472de5a 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -1,98 +1,97 @@ -/* eslint-disable import/no-commonjs */ // VERSION replaced by deploy script module.exports = { - title: 'Chart.js', - tagline: 'Open source HTML5 Charts for your website', - url: 'https://chartjs.org', - baseUrl: '/docs/VERSION/', - favicon: 'img/favicon.ico', - organizationName: 'chartjs', // Usually your GitHub org/user name. - projectName: 'chartjs.github.io', // Usually your repo name. - scripts: ['https://www.chartjs.org/dist/VERSION/chart.min.js'], - themes: ['@docusaurus/theme-live-codeblock'], - onBrokenLinks: 'warn', - themeConfig: { - algolia: { - apiKey: 'd7ee00a3cbaaf3c33e28ad1c274e7ba6', - indexName: 'chartjs', - algoliaOptions: { - facetFilters: ['version:VERSION'], - } - }, - googleAnalytics: { - trackingID: 'UA-28909194-3', - // Optional fields. - anonymizeIP: true, // Should IPs be anonymized? - }, - colorMode: { - disableSwitch: true, // Would need to implement for Charts embedded in docs - }, - navbar: { - title: 'Chart.js', - logo: { - alt: 'Chart.js Logo', - src: 'img/logo.svg', - }, - }, - footer: { - style: 'dark', - links: [ - { - title: 'Other Docs', - items: [ - { - label: 'Samples', - href: 'https://www.chartjs.org/samples/VERSION/', - }, - { - label: 'v2 Docs', - href: 'https://www.chartjs.org/docs/2.9.4/', - }, - ], - }, - { - title: 'Community', - items: [ - { - label: 'Slack', - href: 'https://chartjs-slack.herokuapp.com/', - }, - { - label: 'Stack Overflow', - href: 'https://stackoverflow.com/questions/tagged/chart.js', - }, - ], - }, - { - title: 'Developers', - items: [ - { - label: 'GitHub', - href: 'https://github.com/chartjs/Chart.js', - }, - { - label: 'Contributing', - to: 'developers/contributing', - }, - ], - }, - ], - copyright: `Copyright © ${new Date().getFullYear()} Chart.js contributors.`, - }, - }, - presets: [ - [ - '@docusaurus/preset-classic', - { - docs: { - sidebarPath: require.resolve('./sidebars.js'), - routeBasePath: '/', - editUrl: 'https://github.com/chartjs/Chart.js/edit/master/docs/', - }, - theme: { - customCss: require.resolve('./src/css/custom.css'), - }, - }, - ], - ], + title: 'Chart.js', + tagline: 'Open source HTML5 Charts for your website', + url: 'https://chartjs.org', + baseUrl: '/docs/VERSION/', + favicon: 'img/favicon.ico', + organizationName: 'chartjs', // Usually your GitHub org/user name. + projectName: 'chartjs.github.io', // Usually your repo name. + scripts: ['https://www.chartjs.org/dist/VERSION/chart.min.js'], + themes: ['@docusaurus/theme-live-codeblock'], + onBrokenLinks: 'warn', + themeConfig: { + algolia: { + apiKey: 'd7ee00a3cbaaf3c33e28ad1c274e7ba6', + indexName: 'chartjs', + algoliaOptions: { + facetFilters: ['version:VERSION'], + } + }, + googleAnalytics: { + trackingID: 'UA-28909194-3', + // Optional fields. + anonymizeIP: true, // Should IPs be anonymized? + }, + colorMode: { + disableSwitch: true, // Would need to implement for Charts embedded in docs + }, + navbar: { + title: 'Chart.js', + logo: { + alt: 'Chart.js Logo', + src: 'img/logo.svg', + }, + }, + footer: { + style: 'dark', + links: [ + { + title: 'Other Docs', + items: [ + { + label: 'Samples', + href: 'https://www.chartjs.org/samples/VERSION/', + }, + { + label: 'v2 Docs', + href: 'https://www.chartjs.org/docs/2.9.4/', + }, + ], + }, + { + title: 'Community', + items: [ + { + label: 'Slack', + href: 'https://chartjs-slack.herokuapp.com/', + }, + { + label: 'Stack Overflow', + href: 'https://stackoverflow.com/questions/tagged/chart.js', + }, + ], + }, + { + title: 'Developers', + items: [ + { + label: 'GitHub', + href: 'https://github.com/chartjs/Chart.js', + }, + { + label: 'Contributing', + to: 'developers/contributing', + }, + ], + }, + ], + copyright: `Copyright © ${new Date().getFullYear()} Chart.js contributors.`, + }, + }, + presets: [ + [ + '@docusaurus/preset-classic', + { + docs: { + sidebarPath: require.resolve('./sidebars.js'), + routeBasePath: '/', + editUrl: 'https://github.com/chartjs/Chart.js/edit/master/docs/', + }, + theme: { + customCss: require.resolve('./src/css/custom.css'), + }, + }, + ], + ], }; diff --git a/docs/sidebars.js b/docs/sidebars.js index 53aff1964..9d728900b 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -2,88 +2,88 @@ const pkg = require('../package.json'); const docsVersion = pkg.version.indexOf('-') > -1 ? 'next' : 'latest'; module.exports = { - someSidebar: { - Introduction: ['index'], - 'Getting Started': [ - 'getting-started/index', - 'getting-started/installation', - 'getting-started/integration', - 'getting-started/usage', - 'getting-started/v3-migration' - ], - General: [ - 'general/data-structures', - 'general/accessibility', - 'general/responsive', - 'general/device-pixel-ratio', - 'general/locale', - {Interactions: ['general/interactions/index', 'general/interactions/events', 'general/interactions/modes']}, - 'general/options', - 'general/colors', - 'general/fonts', - 'general/performance' - ], - Configuration: [ - 'configuration/index', - 'configuration/animations', - 'configuration/layout', - 'configuration/legend', - 'configuration/title', - 'configuration/tooltip', - 'configuration/elements', - 'configuration/decimation' - ], - 'Chart Types': [ - 'charts/line', - 'charts/bar', - 'charts/radar', - 'charts/doughnut', - 'charts/polar', - 'charts/bubble', - 'charts/scatter', - 'charts/area', - 'charts/mixed' - ], - Axes: [ - 'axes/index', - {Cartesian: [ - 'axes/cartesian/index', - 'axes/cartesian/category', - 'axes/cartesian/linear', - 'axes/cartesian/logarithmic', - 'axes/cartesian/time', - 'axes/cartesian/timeseries' - ]}, - {Radial: [ - 'axes/radial/index', - 'axes/radial/linear' - ]}, - 'axes/labelling', - 'axes/styling' - ], - Developers: [ - 'developers/index', - 'developers/api', - { - type: 'link', - label: 'TypeDoc', - href: 'https://chartjs.org/docs/' + docsVersion + '/typedoc/' - }, - 'developers/updates', - 'developers/plugins', - 'developers/charts', - 'developers/axes', - 'developers/contributing', - 'developers/publishing' - ], - 'Additional Notes': [ - 'notes/comparison', - { - type: 'link', - label: 'Extensions', - href: 'https://github.com/chartjs/awesome' - }, - 'notes/license' - ] - }, + someSidebar: { + Introduction: ['index'], + 'Getting Started': [ + 'getting-started/index', + 'getting-started/installation', + 'getting-started/integration', + 'getting-started/usage', + 'getting-started/v3-migration' + ], + General: [ + 'general/data-structures', + 'general/accessibility', + 'general/responsive', + 'general/device-pixel-ratio', + 'general/locale', + {Interactions: ['general/interactions/index', 'general/interactions/events', 'general/interactions/modes']}, + 'general/options', + 'general/colors', + 'general/fonts', + 'general/performance' + ], + Configuration: [ + 'configuration/index', + 'configuration/animations', + 'configuration/layout', + 'configuration/legend', + 'configuration/title', + 'configuration/tooltip', + 'configuration/elements', + 'configuration/decimation' + ], + 'Chart Types': [ + 'charts/line', + 'charts/bar', + 'charts/radar', + 'charts/doughnut', + 'charts/polar', + 'charts/bubble', + 'charts/scatter', + 'charts/area', + 'charts/mixed' + ], + Axes: [ + 'axes/index', + {Cartesian: [ + 'axes/cartesian/index', + 'axes/cartesian/category', + 'axes/cartesian/linear', + 'axes/cartesian/logarithmic', + 'axes/cartesian/time', + 'axes/cartesian/timeseries' + ]}, + {Radial: [ + 'axes/radial/index', + 'axes/radial/linear' + ]}, + 'axes/labelling', + 'axes/styling' + ], + Developers: [ + 'developers/index', + 'developers/api', + { + type: 'link', + label: 'TypeDoc', + href: 'https://chartjs.org/docs/' + docsVersion + '/typedoc/' + }, + 'developers/updates', + 'developers/plugins', + 'developers/charts', + 'developers/axes', + 'developers/contributing', + 'developers/publishing' + ], + 'Additional Notes': [ + 'notes/comparison', + { + type: 'link', + label: 'Extensions', + href: 'https://github.com/chartjs/awesome' + }, + 'notes/license' + ] + }, }; diff --git a/karma.conf.js b/karma.conf.js index 3eefdae6c..c8f678ff6 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -6,118 +6,118 @@ const builds = require('./rollup.config'); const yargs = require('yargs'); module.exports = function(karma) { - const args = yargs - .option('verbose', {default: false}) - .argv; + const args = yargs + .option('verbose', {default: false}) + .argv; - const grep = args.grep === true ? '' : args.grep; - const specPattern = 'test/specs/**/*' + grep + '*.js'; + const grep = args.grep === true ? '' : args.grep; + const specPattern = 'test/specs/**/*' + grep + '*.js'; - // 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 - // better with source mapping. In other cases, pick the minified build to - // make sure that the minification process (terser) doesn't break anything. - const regex = karma.autoWatch ? /chart\.js$/ : /chart\.min\.js$/; - const build = builds.filter(v => v.output.file && v.output.file.match(regex))[0]; + // 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 + // better with source mapping. In other cases, pick the minified build to + // make sure that the minification process (terser) doesn't break anything. + const regex = karma.autoWatch ? /chart\.js$/ : /chart\.min\.js$/; + const build = builds.filter(v => v.output.file && v.output.file.match(regex))[0]; - if (args.coverage) { - build.plugins = [ - json(), - resolve(), - istanbul({exclude: ['node_modules/**/*.js', 'package.json']}) - ]; - } + if (args.coverage) { + build.plugins = [ + json(), + resolve(), + istanbul({exclude: ['node_modules/**/*.js', 'package.json']}) + ]; + } - karma.set({ - frameworks: ['jasmine'], - reporters: ['progress', 'kjhtml'], - browsers: (args.browsers || 'chrome,firefox').split(','), - logLevel: karma.LOG_INFO, + karma.set({ + frameworks: ['jasmine'], + reporters: ['progress', 'kjhtml'], + browsers: (args.browsers || 'chrome,firefox').split(','), + logLevel: karma.LOG_INFO, - client: { - jasmine: { - failFast: !!karma.autoWatch - } - }, + client: { + jasmine: { + failFast: !!karma.autoWatch + } + }, - // Explicitly disable hardware acceleration to make image - // diff more stable when ran on Travis and dev machine. - // https://github.com/chartjs/Chart.js/pull/5629 - customLaunchers: { - chrome: { - base: 'Chrome', - flags: [ - '--disable-accelerated-2d-canvas', - '--disable-background-timer-throttling', - '--disable-backgrounding-occluded-windows', - '--disable-renderer-backgrounding' - ] - }, - firefox: { - base: 'Firefox', - prefs: { - 'layers.acceleration.disabled': true - } - }, - safari: { - base: 'SafariPrivate' - }, - edge: { - base: 'Edge' - } - }, + // Explicitly disable hardware acceleration to make image + // diff more stable when ran on Travis and dev machine. + // https://github.com/chartjs/Chart.js/pull/5629 + customLaunchers: { + chrome: { + base: 'Chrome', + flags: [ + '--disable-accelerated-2d-canvas', + '--disable-background-timer-throttling', + '--disable-backgrounding-occluded-windows', + '--disable-renderer-backgrounding' + ] + }, + firefox: { + base: 'Firefox', + prefs: { + 'layers.acceleration.disabled': true + } + }, + safari: { + base: 'SafariPrivate' + }, + edge: { + base: 'Edge' + } + }, - files: [ - {pattern: 'test/fixtures/**/*.js', included: false}, - {pattern: 'test/fixtures/**/*.json', included: false}, - {pattern: 'test/fixtures/**/*.png', included: false}, - 'node_modules/moment/min/moment.min.js', - {pattern: 'test/index.js', watched: false}, - {pattern: 'test/BasicChartWebWorker.js', included: false}, - {pattern: 'src/index.js', watched: false}, - 'node_modules/chartjs-adapter-moment/dist/chartjs-adapter-moment.js', - {pattern: specPattern} - ], + files: [ + {pattern: 'test/fixtures/**/*.js', included: false}, + {pattern: 'test/fixtures/**/*.json', included: false}, + {pattern: 'test/fixtures/**/*.png', included: false}, + 'node_modules/moment/min/moment.min.js', + {pattern: 'test/index.js', watched: false}, + {pattern: 'test/BasicChartWebWorker.js', included: false}, + {pattern: 'src/index.js', watched: false}, + 'node_modules/chartjs-adapter-moment/dist/chartjs-adapter-moment.js', + {pattern: specPattern} + ], - preprocessors: { - 'test/index.js': ['rollup'], - 'src/index.js': ['sources'] - }, + preprocessors: { + 'test/index.js': ['rollup'], + 'src/index.js': ['sources'] + }, - rollupPreprocessor: { - plugins: [ - json(), - resolve(), - commonjs({exclude: ['src/**', 'test/**']}), - ], - output: { - name: 'test', - format: 'umd', - sourcemap: karma.autoWatch ? 'inline' : false - } - }, + rollupPreprocessor: { + plugins: [ + json(), + resolve(), + commonjs({exclude: ['src/**', 'test/**']}), + ], + output: { + name: 'test', + format: 'umd', + sourcemap: karma.autoWatch ? 'inline' : false + } + }, - customPreprocessors: { - sources: { - base: 'rollup', - options: build - } - }, + customPreprocessors: { + sources: { + base: 'rollup', + options: build + } + }, - // 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. - // https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551 - browserDisconnectTolerance: 3 - }); + // 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. + // https://github.com/jasmine/jasmine/issues/1327#issuecomment-332939551 + browserDisconnectTolerance: 3 + }); - if (args.coverage) { - karma.reporters.push('coverage'); - karma.coverageReporter = { - dir: 'coverage/', - reporters: [ - {type: 'html', subdir: 'html'}, - {type: 'lcovonly', subdir: (browser) => browser.toLowerCase().split(/[ /-]/)[0]} - ] - }; - } + if (args.coverage) { + karma.reporters.push('coverage'); + karma.coverageReporter = { + dir: 'coverage/', + reporters: [ + {type: 'html', subdir: 'html'}, + {type: 'lcovonly', subdir: (browser) => browser.toLowerCase().split(/[ /-]/)[0]} + ] + }; + } }; diff --git a/rollup.config.js b/rollup.config.js index d3f8d4e1e..ea84da7a6 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,6 +1,3 @@ -/* eslint-disable import/no-commonjs */ -/* eslint-env es6 */ - const cleanup = require('rollup-plugin-cleanup'); const dts = require('rollup-plugin-dts').default; const json = require('@rollup/plugin-json'); @@ -10,12 +7,12 @@ const pkg = require('./package.json'); const input = 'src/index.js'; const inputESM = { - 'dist/chart.esm': 'src/index.esm.js', - 'dist/helpers.esm': 'src/helpers/index.js' + 'dist/chart.esm': 'src/index.esm.js', + 'dist/helpers.esm': 'src/helpers/index.js' }; const inputESMTypings = { - 'dist/chart.esm': 'types/index.esm.d.ts', - 'dist/helpers.esm': 'types/helpers/index.d.ts' + 'dist/chart.esm': 'types/index.esm.d.ts', + 'dist/helpers.esm': 'types/helpers/index.d.ts' }; const banner = `/*! @@ -26,79 +23,79 @@ const banner = `/*! */`; module.exports = [ - // UMD builds - // dist/chart.min.js - // dist/chart.js - { - input, - plugins: [ - json(), - resolve(), - cleanup({ - sourcemap: true - }) - ], - output: { - name: 'Chart', - file: 'dist/chart.js', - banner, - format: 'umd', - indent: false, - }, - }, - { - input, - plugins: [ - json(), - resolve(), - terser({ - output: { - preamble: banner - } - }) - ], - output: { - name: 'Chart', - file: 'dist/chart.min.js', - format: 'umd', - indent: false, - }, - }, + // UMD builds + // dist/chart.min.js + // dist/chart.js + { + input, + plugins: [ + json(), + resolve(), + cleanup({ + sourcemap: true + }) + ], + output: { + name: 'Chart', + file: 'dist/chart.js', + banner, + format: 'umd', + indent: false, + }, + }, + { + input, + plugins: [ + json(), + resolve(), + terser({ + output: { + preamble: banner + } + }) + ], + output: { + name: 'Chart', + file: 'dist/chart.min.js', + format: 'umd', + indent: false, + }, + }, - // ES6 builds - // dist/chart.esm.js - // helpers/*.js - { - input: inputESM, - plugins: [ - json(), - resolve(), - cleanup({ - sourcemap: true - }) - ], - output: { - dir: './', - chunkFileNames: 'dist/chunks/[name].js', - banner, - format: 'esm', - indent: false, - }, - }, - // ES6 Typings builds - // dist/chart.esm.d.ts - // helpers/*.d.ts - { - input: inputESMTypings, - plugins: [ - dts() - ], - output: { - dir: './', - chunkFileNames: 'dist/chunks/[name].ts', - banner, - format: 'esm', - indent: false, - }, - } + // ES6 builds + // dist/chart.esm.js + // helpers/*.js + { + input: inputESM, + plugins: [ + json(), + resolve(), + cleanup({ + sourcemap: true + }) + ], + output: { + dir: './', + chunkFileNames: 'dist/chunks/[name].js', + banner, + format: 'esm', + indent: false, + }, + }, + // ES6 Typings builds + // dist/chart.esm.d.ts + // helpers/*.d.ts + { + input: inputESMTypings, + plugins: [ + dts() + ], + output: { + dir: './', + chunkFileNames: 'dist/chunks/[name].ts', + banner, + format: 'esm', + indent: false, + }, + } ];