-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
feat: Reporting unused inline configs #121
base: main
Are you sure you want to change the base?
feat: Reporting unused inline configs #121
Conversation
Co-authored-by: Francesco Trotta <[email protected]>
One way to reduce costs could be to wait until ESLint completely removes support for legacy configs. | ||
That way, only the new ("flat") config system would need to be tested with this change. |
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 think it makes sense to enable this change only for the new config system. Probably we don't want to add a new option to eslintrc, even if it's only for internal usage by the CLI. But we should still make sure that no new problems are reported when the Linter
runs in eslintrc mode and the default value for reportUnusedInlineConfigs
changes to "error"
or "warn"
.
Additional logic can be added to the existing code points in `Linter` that validate inline config options: | ||
|
||
- [`_verifyWithFlatConfigArrayAndWithoutProcessors`](https://github.com/eslint/eslint/blob/7c78ad9d9f896354d557f24e2d37710cf79a27bf/lib/linter/linter.js#L1650): called in the current ("flat") config system | ||
- [`getDirectiveComments`](https://github.com/eslint/eslint/blob/7c78ad9d9f896354d557f24e2d37710cf79a27bf/lib/linter/linter.js#L387): called when `ESLINT_USE_FLAT_CONFIG=true` |
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 think that getDirectiveComments
is also called when ESLINT_USE_FLAT_CONFIG
is not set?
The existing `--report-unused-disable-directives` (enabling) and `--report-unused-disable-directives-severity` (severity) options were kept separate for backwards compatibility. | ||
|
||
Adding a sole `--report-unused-inline-configs` CLI option presents a discrepency between the two sets of options. | ||
An alternative could be to instead add `--report-unused-inline-configs` an `--report-unused-inline-configs-severity` options for consistency's sake. |
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.
An alternative could be to instead add `--report-unused-inline-configs` an `--report-unused-inline-configs-severity` options for consistency's sake. | |
An alternative could be to instead add `--report-unused-inline-configs` and `--report-unused-inline-configs-severity` options for consistency's sake. |
Per eslint/eslint#15476 (comment), converting to a draft so I can rework this to encompass eslint/eslint#15476. |
Summary
Proposes adding a CLI option to report
/* eslint... */
comments that don't change any settings.Related Issues