New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from CLIEngine to the new ESLint class. #22756
Conversation
// eslint-disable-next-line no-unused-vars | ||
const {_, ...cliOptions} = minimist(process.argv.slice(2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add destructuring to prevent passing _
, which minimist
generates by default. Otherwise, ESlint
returns this error:
yarn linc
yarn run v1.22.17
$ node ./scripts/tasks/linc.js
Linting changed files...
Lint passed for changed files.
(node:84712) UnhandledPromiseRejectionWarning: Error: Invalid Options:
- Unknown options: _
at processOptions (/Users/XXX/projects/react/node_modules/eslint/lib/eslint/eslint.js:273:15)
at new ESLint (/Users/XXX/projects/react/node_modules/eslint/lib/eslint/eslint.js:416:34)
// eslint-disable-next-line no-unused-vars | ||
const {_, ...cliOptions} = minimist(process.argv.slice(2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
const errorCount = results.reduce( | ||
(count, result) => count + result.errorCount, | ||
0 | ||
); | ||
const warningCount = results.reduce( | ||
(count, result) => count + result.warningCount, | ||
0 | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new class no longer returns a global report with errorCount
and warningCount
, so I calculated them manually.
Comparing: c0c71a8...0987cfd Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
thank you |
* Migrate from CLIEngine to the new ESLint class. * fix output property
Summary
In ESLint 8,
CLIEngine
was removed. To migrate from version 7 to 8, we need to replaceCLIEngine
with the newESLint
class.More information here:
CLIEngine
class.ESLint
class.How did you test this change?
I tested the following commands before and after the migration:
yarn lint
andyarn linc
, the output was the same.yarn lint --fix
andyarn linc --fix
, the output was the same and the fixable errors got fixed.Pass example:
Error example: