Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

How to get class properties to stop throwing? #156

Closed
corysimmons opened this issue Aug 31, 2018 · 3 comments
Closed

How to get class properties to stop throwing? #156

corysimmons opened this issue Aug 31, 2018 · 3 comments

Comments

@corysimmons
Copy link

I was getting class property errors in ESLint so I Googled "eslint class properties", landed on https://npm.im/eslint-plugin-class-property which said:

Please use babel-plugin-eslint with the babel/semi rule!

So I did, and I'm still getting ESLint errors on class properties. What am I doing wrong?

npm i eslint-plugin-babel

// package.json
"eslintConfig": {
  "plugins": ["babel"],
  "rules": {
    "babel/semi": 0
  }
}
class FooComponent {
  state = { // throws on the equal sign
    a: 1
  }
}

Thank you.

@ljharb
Copy link
Member

ljharb commented Aug 31, 2018

you need the babel-eslint parser, the plugin is just for rules.

@corysimmons
Copy link
Author

Oh thanks @ljharb 👌

@kfprimm
Copy link

kfprimm commented Jun 22, 2019

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

No branches or pull requests

3 participants