Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for class properties ?

See original GitHub issue

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 ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

Timercommented, 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

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.

Sharlaancommented, Apr 23, 2017

mmmm very impresssive, fast formatter. Thanks for the suggestion 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Below is a class with four class properties which will be transformed. class Bork { //Property initializer syntax instanceProperty = "bork"; boundFunction =...
Read more >
How to write clean and easy to understand React code using ...
The class properties syntax allows us to bind the properties like state or instance variables directly inside the class without the need for...
Read more >
Classes - JavaScript - MDN Web Docs
Classes are a template for creating objects. They encapsulate data with code to work on that data. Classes in JS are built on...
Read more >
Support for the experimental syntax 'classProperties' isn't ...
I just solve this problem by adding @babel/plugin-proposal-class-properties into webpack config plugin. The module section of my ...
Read more >
Support for static class properties without babel plugin #9178
A babel plugin shouldn't be required to use static class properties (a native Node LTS feature now). Motivation. Node LTS is v12.x now...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found