-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
feat: Reporting unused inline configs #121
Conversation
Co-authored-by: Francesco Trotta <[email protected]>
Per eslint/eslint#15476 (comment), converting to a draft so I can rework this to encompass eslint/eslint#15476. |
Co-authored-by: 唯然 <[email protected]>
Co-authored-by: Francesco Trotta <[email protected]>
… configs" This reverts commit c339a59.
|
||
[eslint/eslint#15476 Change Request: report unnecessary config overrides](https://github.com/eslint/eslint/issues/15476) previously suggested also checking config files (`eslint.config.*`). | ||
Doing so could be beneficial to flag values that become unnecessary in config files over time. | ||
However, because flat config purely involves spreading objects, there's no way to know what objects originate from shared configs or shared packages. |
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.
FYI @ljharb. I really wanted to get this support in, but just don't see a way to get it to work in this major version. 😞
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 this is probably something better located in the config inspector, where we could give people a visualization of duplicate configs.
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.
This looks like a really solid proposal to me. I left a few comments for clarifications but overall I like the direction of this RFC so happy to approve it.
|
||
[eslint/eslint#15476 Change Request: report unnecessary config overrides](https://github.com/eslint/eslint/issues/15476) previously suggested also checking config files (`eslint.config.*`). | ||
Doing so could be beneficial to flag values that become unnecessary in config files over time. | ||
However, because flat config purely involves spreading objects, there's no way to know what objects originate from shared configs or shared packages. |
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 this is probably something better located in the config inspector, where we could give people a visualization of duplicate configs.
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` and `--report-unused-inline-configs-severity` options for consistency's sake. | ||
|
||
This RFC's opinion is that the consistency of adding two new options is not worth the excess options logic. |
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.
Agreed. 👍
### Separate CLI Option | ||
|
||
Unlike the changes discussed in [Change Request: Enable reportUnusedDisableDirectives config option by default](https://github.com/eslint/eslint/issues/15466) -> [feat!: flexible config + default reporting of unused disable directives](https://github.com/eslint/rfcs/pull/100), reporting unused inline configs does not have legacy behavior to keep to. | ||
The existing `--report-unused-disable-directives` (enabling) and `--report-unused-disable-directives-severity` (severity) options were kept separate for backwards compatibility. |
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.
Just to clarify, --report-unused-disable-directives
is the same as --report-unused-disable-directives-severity error
, and it isn't necessary to pass --report-unused-disable-directives
to enable reporting when --report-unused-disable-directives-severity
is used. In fact, these two options cannot be used together.
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.
Looks good to me, thanks!
We have two approvals so moving to final commenting. |
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.
Thanks for this RFC! Just a question, then LGTM.
dbd33bc
Just needs to stay open for one more day to finish out the final commenting period, then we're ready to merge. |
Summary
Proposes adding a CLI option to report
/* eslint... */
comments that don't change any settings.Related Issues