Support for class properties ?
See original GitHub issueSorry 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:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
babel/plugin-proposal-class-properties
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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 yourpackage.json
: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 https://github.com/facebookincubator/create-react-app/pull/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.
mmmm very impresssive, fast formatter. Thanks for the suggestion 😉