Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definition for rule 'react/state-in-constructor' was not found #2174

Closed
kurtgn opened this issue Feb 22, 2019 · 7 comments
Closed

Definition for rule 'react/state-in-constructor' was not found #2174

kurtgn opened this issue Feb 22, 2019 · 7 comments

Comments

@kurtgn
Copy link

kurtgn commented Feb 22, 2019

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
├─┬ eslint-plugin-react@7.12.4

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?

@ljharb
Copy link
Member

ljharb commented Feb 22, 2019

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

@alexzherdev
Copy link
Contributor

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

@ljharb
Copy link
Member

ljharb commented Feb 22, 2019

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

@ljharb ljharb closed this as completed Feb 22, 2019
@willklein
Copy link

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

@ljharb
Copy link
Member

ljharb commented Mar 15, 2019

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

@willklein
Copy link

willklein commented Mar 15, 2019

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. 😄

@ljharb
Copy link
Member

ljharb commented Mar 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants