`eslint-disable` comments in svelte html don't work with `eslint-plugin-eslint-comments`
Before You File a Bug Report Please Confirm You Have Done The Following...
- [X] I have tried restarting my IDE and the issue persists.
- [X] I have updated to the latest version of the packages.
What version of ESLint are you using?
8.30.0
What version of eslint-plugin-svelte are you using?
2.14.1
What did you do?
Configuration
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
"extends": ["plugin:svelte/recommended", "plugin:eslint-comments/recommended"],
plugins: ["@typescript-eslint"],
ignorePatterns: ["*.cjs"],
settings: {
'import/parsers': {
'@typescript-eslint/parser': [ '.ts', '.tsx', '.cts', '.mts' ],
'espree': [ '.js', 'jsx', '.cjs', '.mjs' ],
}
},
rules: {
'svelte/html-self-closing':'error',
'eslint-comments/require-description': 'error'
},
overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
},
},
]
};
<script>
// error: eslint-comments/require-description
//eslint-disable-next-line
console.log(1)
</script>
<!-- no error -->
<!-- eslint-disable-next-line -->
<input value="asdf">
What did you expect to happen?
eslint-comments/require-description error on the html comment
What actually happened?
no error on the html comment
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/DetachHead/eslint-plugin-svelte-issue/tree/d0eb35b9d72cd26928488f7bbe8cb0ee0f0d1222
Additional comments
i'm not sure whether this is an issue with this plugin or eslint-plugin-eslint-comments, so i'm raising it in both projects
https://github.com/mysticatea/eslint-plugin-eslint-comments/issues/74
Thank you for posting the issue. eslint-disable HTML comments provided by eslint-plugin-svelte are completely different from eslint-disable comments provided by ESLint.
https://sveltejs.github.io/eslint-plugin-svelte/rules/comment-directive/
Therefore, they are not compatible with eslint-plugin-eslint-comments. If we want to do similar checks, we need to add our own functionality to eslint-plugin-svelte, like the reportUnusedDisableDirectives option.
https://sveltejs.github.io/eslint-plugin-svelte/rules/comment-directive/#options
I'm not using esling-plugin-eslint-comments, but I'm finding that:
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html foobar}
doesn't work either. Is that expected? Is there another way to ignore rules from this plugin on specific lines?
(This is one particular case where I do want the tag, and it's guarded by a check that it's been stripped of anything potentially malicious.)
@OJFord that works for me. could you share some more info like your eslint config or maybe some of the surrounding code?
Hello! Just a note that I have tried this out, with a different rule from @intlify and it seems to be working for me, the rule is disabled as expected:
<!-- eslint-disable-next-line @intlify/svelte/no-raw-text -->
<strong>Raw string</strong>