Skip to content
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

no-unused-disable does not work when turned on in a flat config #244

Open
Zamiell opened this issue Aug 6, 2024 · 2 comments
Open

no-unused-disable does not work when turned on in a flat config #244

Zamiell opened this issue Aug 6, 2024 · 2 comments

Comments

@Zamiell
Copy link

Zamiell commented Aug 6, 2024

n/t

@FloBam
Copy link

FloBam commented Sep 30, 2024

Just to add my use case here since I've seen the discussion in #133

It's possible to configure the severity globally with

export default [
    linterOptions: {
      reportUnusedDisableDirectives: 'off',
    },
    [...]
];

With a rule it would be possible to add a file matcher and apply it accordingly (what I would prefer).

Concrete use case: We generate api code via openapi generator, which includes the comments

/* tslint:disable */
/* eslint-disable */

I would like to exclude the directory of the generated code, but everything else should be marked depending of the configured severity(for example error).

@Samuel-Therrien-Beslogic

#249 (comment)

Idk if that still true, but in #234 (comment) I mentioned that the ESLint option "Doesn't seem to be picked up by extending configurations". But even if it is now:

There's one use-case where it's still not fully redundant: Flagging without autofixes. Which is especially sensical with this rules as you may not want a "disable removal" to slip through unnoticed due to a bad configuration change.

Using the npmjs.com/package/eslint-plugin-no-autofix plugin:

'@eslint-community/eslint-comments/no-unused-disable': 'off',
'no-autofix/@eslint-community/eslint-comments/no-unused-disable': 'error',
In VSCode settings:

"eslint.codeActionsOnSave.rules": [
// Clearing imports, unused vars and comments because of commented code while testing is annoying
...
"!@eslint-community/eslint-comments/no-unused-disable",
"*"
],
There is a RFC to obsolete eslint-plugin-no-autofix and include the functionality in base ESLint, but I need help completing that

The RFC currently doesn't even mention linterOptions.reportUnusedDisableDirectives as I just learned about it. I'll have to add it.

However, this rule is currently broken on flat-configs anyway, unfortunately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants