Reputation: 4414
In my React project, I have an .eslintrc.json that includes these rules:
...
"rules": {
"react/display-name": 1,
"no-console": 1
},
...
Sometimes instead of linting via my npm run lint
command from package.json, I want to just check for one rule, so I run:
eslint --no-eslintrc --rule "no-console:2" --parser "babel-eslint" C:/src/**/*.{js,jsx}\
That works fine. However, it does not work for the react/display-name
rule:
eslint --no-eslintrc --rule "react/display-name:2" --parser "babel-eslint" C:/src/**/*.{js,jsx}\
For that, I get:
1:1 error Definition for rule 'react/display-name' was not found react/display-name
Why is the definition not found for react/display-name
?
Upvotes: 0
Views: 906
Reputation: 9954
The problem is that the rule react/display-name
depends on the plugins section of your eslintrc.
Adding --plugin "react"
should solve the problem
Upvotes: 3