Open ToP29 opened 2 years ago
I was trying to figure out how to do this too. These docs seemed relevant: https://eslint.org/docs/latest/user-guide/configuring/rules#rules-from-plugins
For my specific problem though (disabling svelte(security-anchor-rel-noreferrer)
warnings in VSCode), I figured out there are more variables at play beyond this plugin:
When adding ESLint rules, none of the following worked for me to remove warning from VSCode, neither when adding to the top-level ESLint config or svelte processor overrides
entry:
rules: {
'svelte3(security-anchor-rel-noreferrer)': 'off',
'svelte/security-anchor-rel-noreferrer': 'off',
'svelte3/security-anchor-rel-noreferrer': 'off',
'security-anchor-rel-noreferrer': 'off',
'svelte(security-anchor-rel-noreferrer)': 'off',
'svelte3/svelte3/svelte3(security-anchor-rel-noreferrer)': 'off',
'svelte3/svelte3/security-anchor-rel-noreferrer': 'off'
}
However, configuring the Svelte extension like this removed the warnings:
// .vscode/settings.json
{
"svelte.plugin.svelte.compilerWarnings": {
"security-anchor-rel-noreferrer": "ignore"
},
}
More configuration (outside of ESLint) is possible, I used these links as references:
Particularly, that first reference mentions that you can remove ESLint warnings like this in your ESLint config. I haven't tested this yet:
settings: {
'svelte3/ignore-warnings': ({ code }) => code === 'a11y-no-onchange',
// ...
},
I'm also stumped on this, but for an issue related to using web components. I don't want to remove or disable the a11y rules, but rather configure them to recognize web components by prefix
I was trying to get rid of missing-declarations rule and svelte3/ignore-warnings
seems to work.
It's somewhat buggy in VS Code though. Whenever I introduce new code that violates the rule, there will be a warning until it's restarted.
For example missing-declaration is warn and I think it should be error, because if something is not defined, lint step should fail with error. But if I try to add
"missing-declaration": "error"
or"svelte3/missing-declaration": "error"
to my.eslintrc.json
rules, I will get errorDefinition for rule 'missing-declaration' was not found
I think that it should be documented how to override linter rules and possibly even have some list of rules that we can use.