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

Support for class properties ? #2019

Closed
Sharlaan opened this issue Apr 23, 2017 · 5 comments
Closed

Support for class properties ? #2019

Sharlaan opened this issue Apr 23, 2017 · 5 comments

Comments

@Sharlaan
Copy link

Sharlaan commented Apr 23, 2017

Sorry if this already has been posted, but i didnot find in issues with keyword "class properties".

My problem is basically at every new project i start with CRA and then starting to right my components, ESLINT complains about unexpected token =.

Thing is i always start implementing my components with :
static propTypes = ...
static defaultProps = ...
static contextTypes = ...
state = { ... }
method = () => { ... }
etc ...

Research told me these are all under the concept of "class-properties", i thought CRA has already included ?

I'm on Windows10, node 7.9.0, CRA 1.3.0, and almost nothing installed globally besides yarn and npm-check.

Do i have to install (or write) something else on top of CRA's base installation ?

@Timer
Copy link
Contributor

Timer commented Apr 23, 2017

This works fine for me, where are you seeing these ESLint errors, in your IDE/text editor or the output from npm start?

You may need to follow the instructions provided here.

@Sharlaan
Copy link
Author

Sharlaan commented Apr 23, 2017

in IDE both Webstorm and Atom
but i realized a typo in my report: this isnot Eslint but standard...

i recently removed everything globally installed, including all eslint/babel related stuff

@Timer
Copy link
Contributor

Timer commented Apr 23, 2017

Sorry, we don't support standard. There's not much we can do to help you, unfortunately.
You may be better off asking a question like this on StackOverflow.

I suggest you look prettier if you want to format your code.
If you want to be close to standard, you can add this script to your package.json:

"format": "prettier --single-quote --no-semi --trailing-comma es5 --write 'src/**/*.js'"

Be sure to run npm install prettier --save-dev.

You can format your code on-demand by running npm run format.

If you want to automate this, check out #2006.

If you can figure out how to get standard working, I would be open to a pull request which explains it for people in the future.

@Timer
Copy link
Contributor

Timer commented Apr 23, 2017

I'm going to close this since it's largely unactionable by us, but let me know if you need help getting prettier set up.

@Timer Timer closed this as completed Apr 23, 2017
@Sharlaan
Copy link
Author

mmmm very impresssive, fast formatter.
Thanks for the suggestion ;)

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants