Open iliubinskii opened 2 years ago
Hi. I think you can allow /*eslint-disable*/
with no-use
and use no-restricted-disable
.
{
"no-restricted-disable": [
"error",
"*",
"!vue/no-bare-strings-in-template"
]
}
https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-restricted-disable.html
Hi, thx for the hint.
First, I tried to use "no-restricted-disable" and it works for rules without slash:
"eslint-comments/no-restricted-disable": [
"warn",
"*",
"!no-console"
],
but does not work for rules with slash (e.g. "vue/no-bare-strings-in-template")
Second, "no-restricted-disable" disallows disabling rule altogether. What I want is to restrict which rule can be disabled for entire file, while allowing any rule to be disabled per line.
but does not work for rules with slash (e.g. "vue/no-bare-strings-in-template")
I did not know that 😅
What I want is to restrict which rule can be disabled for entire file, while allowing any rule to be disabled per line.
Does that mean that you want to set the rules that can be used with eslint-disable and the rules that can be used with eslint-disable-next-line separately? If so, that may not be possible now.
Does that mean that you want to set the rules that can be used with eslint-disable and the rules that can be used with eslint-disable-next-line separately?
Yes. I prefer eslint-disable to be allowed only for selected rules, while eslint-disable-next-line can be allowed for all rules. I hope this makes sence.
If so, that may not be possible now.
I see that. This is why I am suggesting new feature.
Hi @iliubinskii!
Since this repo is unmaintained, you might want to re-open this issue in the @eslint-community fork https://github.com/eslint-community/eslint-plugin-eslint-comments
For more info about why we created this organization, you can read https://eslint.org/blog/2023/03/announcing-eslint-community-org
Thx for the plugin.
Is it possible to add "allowEslintDisable" setting that will accept an array of rule names?
Motivation: Consider "vue/no-bare-strings-in-template" rule that requires that all strings inside template are taken from language file. Imagine that you have a static untranslated page (e.g. privacy, etc). In this case, you want to disable "vue/no-bare-strings-in-template" rule for the entire file. However you may not want to allow global disabling for all other rules. In this case "allowEslintDisable" option may be helpful.
Similar settings may be added for other allowed syntaxes (e.g. eslint-disable-next-line)