How do I correctly add React to the allowed list of unused variables?
Problem highlight in editor tab
Problem highlighting in yaml config file
.eslintrc.yml
env:
browser: true
commonjs: true
es6: true
node: true
extends: 'eslint:recommended'
parserOptions:
ecmaFeatures:
experimentalObjectRestSpread: true
jsx: true
sourceType: module
plugins:
- react
rules:
indent:
- error
- tab
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- never
globals:
React: true
In fact, the React imported as a variable is used by the JSX as an environment. You can see this if you do not import React.