10/6/2023 0 Comments Airbnb js formatterminor versions are used to add new non-breaking features. Patch versions are used to fix bugs and upgrade dependencies. The project is built on targeting each supported Node.js versions (see the list above).ĭuring the CI build all source files are linted and all unit tests need to pass resulting in a coverage report. Once the project is built the distribution version can be tested via passing a. The transpiled code is generated under the dist/ folder and it is the one used to generate the summary output of ESLint rather than the original ES7+ source code under lib/. This will use babel-cli to transpile the source code targeting node v4 (the lowest supported Node.js version) to dist folder. When changing code, you might want to run unit tests and re-build the project on file changes: yarn test -watch and etc., for that core-js is being used. The project's code is written using the latest EcmaScript standard's features, some of which needs to be polyfilled in older Node.js versions e.g. PRs are also welcome! Install dependencies yarn Please feel free to submit an issue describing your proposal you would like to discuss. Please open an issue if you need support for other versions of ESLint. Supported ESLint versionsĮSLint versions are supported from v4 onwards, although eslint-formatter-summary may also work with lower versions of ESLint. The distribution version targets Node.js v4 and should work on this version and above. Supported Node.js versions are the latest: The project came alive with the specific intention to support all Node.js version from v4.x as this formatter is supposed to be an enabler for most projects and does not want to stand in the way by supporting only the latest Node.js versions. The sorted results are shown in ASCENDING order by default but the order can also be reversed using DESC=true: SORT_BY=rule DESC=true eslint -f summary. Using the SORT_BY env var the aggregated results can be sorted by either rule, errors or warnings e.g. > Default sorting is by rule in an ascending orderĬonfiguration options can be passed to the formatter to alter the output. In the above example we can notice that the comma-dangle rule is responsible for about 2/3 of the failures, so we can consider turning it off or just suppressing it to a warning for now as we can do so with the other failing rules. The Summary Formatter simply aggregates the ESLint results by rule and shows the following output instead: With the default ESLint formatter you might get several thousands of lines of failing rules in various files in the output e.g.: to consider suppressing certain rules for now and bringing them back in later when we are ready to fix them. Having this summary overview can give us the opportunity e.g. It gives an overview of all rules failing showing the total number of errors and warnings summed up by rule. This package provides a custom ESLint formatter to help in these situations to make the right decisions by showing the linting results aggregated by rule. Possibly hundreds if not thousands of errors will pop up which can seem overwhelming to be fixed when we see the default formatted output, forcing us to back up from making our code base better / more consistent. It is a matter of minutes to add ESLint to a new project, however it can be quite challenging to introduce it (or just add a stricter rule set) to existing projects, already large codebases. Or if you use an older version of ESLint: eslint -f node_modules/eslint-formatter-summary * When you run ESLint just specify eslint-formatter-summary as the formatter: eslint -f summary * Otherwise with npm run npm i -save-dev eslint-formatter-summary If you're using yarn just run yarn add -D eslint-formatter-summary SORT_BY=rule DESC=true eslint -f summary. It can also be configured to sort results by rule, errors or warnings using env vars e.g. This formatter simply aggregates the ESLint results by rule and shows the following output: sort by rule name, number of errors or warnings.ESLint formatter aggregating results by rule Features
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |