-
Notifications
You must be signed in to change notification settings - Fork 20.6k
Build: Enable reportUnusedDisableDirectives in ESLint #4520
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
Conversation
Gruntfile.js
Outdated
@@ -77,7 +77,8 @@ module.exports = function( grunt ) { | |||
options: { | |||
|
|||
// See https://github.com/sindresorhus/grunt-eslint/issues/119 | |||
quiet: true | |||
quiet: true, | |||
reportUnusedDisableDirectives: 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.
Is it possible to configure in the ESLint configuration file instead of here?
I like it. One question. |
@edg2s Do you want to update it or should we take over? |
Adding reportUnusedDisableDirectives in the config was only added in ESLint 6.3.0. This repo currently only requires version 6.0.1 (via grunt-eslint 22.0.0). |
@edg2s We can update ESLint if that helps, I don’t mind including it in a PR. |
@edg2s You said before this doesn't work with the currently used ESLint version. Did anything change? |
Sorry, I assumed you would update ESLint separately. I can do it here though. |
@edg2s I've noticed |
This prevents issues such as jquerygh-4095
5e8514c
to
d7a6ac6
Compare
Done. |
I merged the PR to both
I'm not sure how to proceed here due to the above. We can catch some things through these warnings but only when calling the ESLint binary directly and we have to ignore at least this one |
Seems to be a common-but-not-enough request: eslint/eslint#12703 The workaround they suggest is |
A couple of options:
|
@dmethvin Their reasoning sounds reasonable. We could work with it only if we pinned our ESLint version so that patch updates don't make our build fail. Currently we have it pinned via @edg2s I'd go for the first option; way smaller complexity. This doesn't resolve the issue that |
Yeah, you would have to use it in combination with max-warnings and version pinning. |
This disable-directive only applies to the built version, so put it in /dist. This avoids a warning about an unused directive in the source version. Follow-up to jquery#4520
Another issue is that grunt-eslint is giving use warnings for files that listed in src: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
// Ignore files from .eslintignore
// See https://github.com/sindresorhus/grunt-eslint/issues/119
.concat(
new CLIEngine()
.getConfigForFile( "Gruntfile.js" )
.ignorePatterns.map( p => "!" + p )
) |
Summary
The reportUnusedDisableDirectives option in ESLint will report an error when in inline disable directive is no longer required, such as what happened gh-4095.
Checklist