{ "rules": { "no-unused" : "warn"}}
My dislocation lead me so many times to type wrong variable names in code. In Javascript that is don't cause immediately error, because thats name use as undeclared global. My solution is really simple under vs-code. With esLint no-unused rule help to mark red underline the typing errors.
This setup also show console.log, console.warn, which is also don't good to stay in product code. You can choose this rule set as warn or error, by own taste.
This method also good for alert outer dependency.
esLint json with no-unused example ::
{
"parser": "babel-eslint",
"plugins": ["unused-imports", "react", "react-hooks"],
"rules": {
"unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": [
"warn",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
],
"no-undef" : "error",
"react/jsx-uses-vars": "warn",
"react/jsx-uses-react": "warn"
}
}
Top comments (0)