Categories
React Answers

How to fix ESLint with React giving no-unused-vars errors?

Spread the love

Sometimes, we want to fix ESLint with React giving no-unused-vars errors.

In this article, we’ll look at how to fix ESLint with React giving no-unused-vars errors.

How to fix ESLint with React giving no-unused-vars errors?

To fix ESLint with React giving no-unused-vars errors, we can use the eslint-plugin-react plugin.

To install it, we run

npm install --save-dev eslint-plugin-react

Then we add it to .eslintrc.json by writing

{
  //...
  "extends": ["plugin:react/recommended"]
  //...
}

to add the "plugin:react/recommended" rules from the eslint-plugin-react plugin to our project.

Conclusion

To fix ESLint with React giving no-unused-vars errors, we can use the eslint-plugin-react plugin.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *