Reputation: 814
I'm trying to set up a React app with Gatsby, and for some reason the ESLint doesn't seem to be fully working properly.
I put the code const test = 4;
and left the variable unused, which I would expect to throw an unused-variable error in ESLint, but it does not.
I use VSCode.
This is my eslintrc.json
{
"extends": ["airbnb", "prettier", "prettier/react"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
}
These are the dependencies in my package.json
"dependencies": {
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"gatsby": "^2.24.67",
"gatsby-cli": "^2.12.102",
"gatsby-plugin-material-ui": "^2.1.10",
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"devDependencies": {
"eslint": "^7.10.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "2.0.5"
},
Upvotes: 1
Views: 320
Reputation: 29318
You need to add the rule in your eslintrc.json
file:
"rules":{
"no-unused-vars": "warn",
}
Of course, you can change the warning for your desired behavior. You can check for further details in ESLint docs.
Upvotes: 1