-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Fix lint:fix package script #5204
base: main
Are you sure you want to change the base?
Conversation
Some developers run `yarn lint:fix` before pushing. After the ESLint 9 upgrade, however, this package script has been broken because it fixes all lint warnings in addition to errors. Since there are many, many warnings, this ends up making all kind of changes. In addition, the fixing step was happening twice, meaning that the package script was very, very slow. This commit gets this script in working order again.
@@ -25,7 +25,7 @@ | |||
"lint:dependencies": "depcheck && yarn dedupe --check", | |||
"lint:dependencies:fix": "depcheck && yarn dedupe", | |||
"lint:eslint": "yarn build:only-clean && yarn ts-node ./scripts/run-eslint.ts --cache", | |||
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies:fix", | |||
"lint:fix": "yarn lint:eslint --quiet --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies:fix", |
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.
--quiet
hides warnings, and the combination of --quiet
and --fix
will only autofix errors and not warnings.
@@ -44,7 +44,7 @@ main().catch((error) => { | |||
async function main() { | |||
const { cache, fix, quiet } = parseCommandLineArguments(); | |||
|
|||
const eslint = new ESLint({ cache, fix }); |
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 fix
option instructs lintFiles
to autofix errors as it finds them. We manually call outputFixes
in runESLint
further down which does the same thing.
Explanation
Some developers run
yarn lint:fix
before pushing. After the ESLint 9 upgrade, however, this package script has been broken because it fixes all lint warnings in addition to errors. Since there are many, many warnings, this ends up making all kind of changes. In addition, the fixing step was happening twice, meaning that the package script was very, very slow.This commit gets this script in working order again.
References
Changelog
(N/A, developer-only change)
Checklist