-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support RegExp in ignore
option of no-unresolved
#3087
Comments
Supporting regular expressions in an eslint config is a CVE magnet, and a very bad idea. What would linters be checking? |
ESLint configuration is written in JavaScript. You can already use export default [{
rules: {
"import/no-unresolved": ["error", { ignore: [/\.img$/.source] }],
}
]}; It's cumbersome to write a
I check my ESLint configuration with ESLint, which has a few rules on For example, in this configuration, I don't get a warning by export default [{
rules: {
"import/no-unresolved": ["error", { ignore: ["\\.(png|jpg|gif|webp|jpg)$"] }],
}
]}; |
In flat config, yes - not so in eslintrc. Either way, allowing regexp is a footgun because of the CVE potential (whether it's initially a string or not). The only patterns that I'd see accepting are globs. |
You can add an And you can do the same for the setting |
Sure, that would be fine (i'd call it |
An array of
RegExp
pattern strings must be set to theignore
option of theimport/no-unresolved
rule. With a string, linters (and text editors) don't know that it contains a regex and can't check it.It would be simpler and safer if we could set the
RegExp
directly:The text was updated successfully, but these errors were encountered: