Eslint-plugin-react: Definition for rule 'react/state-in-constructor' was not found

Created on 22 Feb 2019  Â·  7Comments  Â·  Source: yannickcr/eslint-plugin-react

I have a rule in my .eslintrc:

"react/state-in-constructor": [2, "always"]

my eslint version is 7.12.4:

npm list -g | grep eslint-plugin-react
├─┬ [email protected]

however eslint is unable to find this rule:

  1:1  error  Definition for rule 'react/state-in-constructor' was not found  react/state-in-constructor

how do I plug this rule in?

Most helpful comment

Totally understood, we all do it :-) just train yourself whenever you see something that seems weird, to actually go drill down to the proper version tag

All 7 comments

Have eslint-plugin-react installed, and somewhere in your config, have 'react' in the plugins array.

Wait, I think this is a rule we haven’t released yet 😄

oh, oops :-) in that case, it's a duplicate of #2162, and you'll have to wait for a release.

This just bit me... do we ever mark rules as unreleased in the README? Would we be open to that?

@willklein no - you shouldn’t be reading master, you should be reading the version tag that you have installed.

Cool, that's a good point. I have this terrible habit of referring to READMEs on GitHub as the documentation. _Not_ being sarcastic, it's just my tendency. 😄

Totally understood, we all do it :-) just train yourself whenever you see something that seems weird, to actually go drill down to the proper version tag

Was this page helpful?
0 / 5 - 0 ratings