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
Proposal: reportUnusedDisableDirectives
in config files
#9382
Comments
I'm fine with having a config option for this, but I'm a bit worried about allowing shareable configs to set this option, due to the warning here. It seems like if a user inherits this value from a shareable config, they might not expect their build to get broken by a patch release of ESLint. When a command-line flag is used, this isn't a problem because each project opts into the warning. |
Does this need to go on the TSC agenda? And I'd be 100% 👍 for it myself, if we only allowed it in configurations with |
It will need to go on the agenda eventually in order to be accepted, yes. In general I think it's better if we continue discussion on the issue, and then add it to the TSC agenda when the discussion is finished (after we either reach an agreement, or we are unable to resolve our disagreement, or there just hasn't been any discussion for awhile). Otherwise, we can end up in a situation where we're still working out a lot of the details during the TSC meeting itself, and so we're less likely to reach consensus than if we had discussed the details on the issue. Of course, you're free to add issues to the agenda at any point -- this is just my personal view of how the discussion would be most effective. |
I thought we discussed this limitation during TSC meeting, and we're fine with it? |
The resolution was to accept the option as a command-line flag now, but discuss improving things for editor integrations afterwards. Could you clarify what "limitation" you're referring to? Are you talking about the fact that the option can't currently be used in a config file, or are you talking about the fact that it can cause additional errors to be reported as a result of bugfixes? |
I mean config file limitation. |
Though I don't think |
TSC Summary: This issue proposes adding TSC Question:
|
The TSC did not reach a consensus on this issue in today's meeting, so I'm leaving it on the agenda for next meeting. |
By the way, I created an alternative proposal which would make it possible to declare command-line options for a project without being able to inherit them from shareable configs. |
TSC Resolution: We will not accept this proposal for now until we can come up with better way of handing CLI option configurations. |
Now I'm investigating another way..., implementing One idea is that the rule uses const CLIEngine = require("eslint").CLIEngine
function create(context) {
const filePath = context.getFilename()
if (filePath === "<input>") {
// The code came from stdin.
// TODO: what config should I use?
} else {
const eslint = new CLIEngine() // TODO: `rulePaths` is...?
const report = eslint.executeOnFiles([filePath])
// Check the report...
}
} Could somebody advise me? |
I don't think it's possible to do this. (I had also tried to refactor |
The version of ESLint you are using.
The problem you want to solve.
As a great work of @not-an-aardvark, #9371 added
--reportUnusedDisableDirectives
CLI option. It's useful in order to detect unused disable directives which can hide errors unintentionally.But unfortunately, we cannot enable the feature with config files (e.g.
.eslintrc.json
). As a result, there is no simple way to enable the feature equally on CI and the editors of team members. I have to write npm-scripts and config files of several editors.It's convenient if we can configure the feature with config files.
Your take on the correct solution to problem.
This proposal adds a top-level property:
reportUnusedDisableDirectives
. It has a number or a string as their value as same as rules.0
or"off"
... ESLint does not report unused disable directives. This is default.1
or"warn"
... ESLint reports unused disable directives as warning.2
or"error"
... ESLint reports unused disable directives as error. (exit with non-zero if the error exists)overrides
field values can include the setting.Linter
/CLIEngine
override the setting of config files.I'll champion and implement this.
The text was updated successfully, but these errors were encountered: