Update rules to support ES2022 class fields
See original GitHub issueWhat is the name of the syntax to implement?
Class fields
Please provide the TC39 URL for the syntax proposal:
- Private methods and getter/setters for JavaScript classes
- Class field declarations for JavaScript
- Static class features
Implementation Checklist
This issue tracks rules that need to be updated to support ES2022 class fields. Please add to this list if there are any additional rules that need to be updated. I’ve linked to any comments on the original PR for easier reference. Some rule updates may have been finished in #14591, in which case we can confirm the updates are sufficient and check off the rule here.
-
camelcase
https://github.com/eslint/eslint/pull/14966 -
class-methods-use-this
https://github.com/eslint/eslint/pull/15018 -
complexity
https://github.com/eslint/eslint/pull/14957 -
computed-property-spacing
-
dot-notation
https://github.com/eslint/eslint/pull/14898 -
func-name-matching
https://github.com/eslint/eslint/pull/14964 -
func-names
https://github.com/eslint/eslint/pull/14908 -
id-denylist
: https://github.com/eslint/eslint/pull/14591 -
id-length
: https://github.com/eslint/eslint/pull/14591 -
id-match
: https://github.com/eslint/eslint/pull/14591 -
indent
-
keyword-spacing
https://github.com/eslint/eslint/pull/14946 -
lines-between-class-members
https://github.com/eslint/eslint/pull/15045 -
no-dupe-class-members
https://github.com/eslint/eslint/pull/15005 -
no-eval
-
no-extra-parens
https://github.com/eslint/eslint/pull/14906 -
no-extra-semi
-
no-invalid-this
-
no-multi-assign
https://github.com/eslint/eslint/pull/14907 -
no-self-assign
-
no-undef-init
https://github.com/eslint/eslint/pull/14994 -
no-underscore-dangle
-
no-unreachable
https://github.com/eslint/eslint/pull/14920 -
no-useless-computed-key
https://github.com/eslint/eslint/pull/14903 -
operator-linebreak
https://github.com/eslint/eslint/pull/14915 -
prefer-destructuring
https://github.com/eslint/eslint/pull/14897 -
prefer-exponentiation-operator
-
quotes
-
semi-spacing
-
semi-style
-
semi
https://github.com/eslint/eslint/pull/14945 -
space-infix-ops
Are you willing to submit a pull request to implement this syntax?
We can work on these in parallel. To avoid redundant effort, please claim a rule when you start working on it.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:27 (27 by maintainers)
Top Results From Across the Web
ESLint v8.0.0-beta.2 released - Pluggable JavaScript Linter
All core rules have been updated to support ES2022 class fields and private class members. ESLint now fully supports the following ES2022 syntax ......
Read more >Public class fields - JavaScript - MDN Web Docs - Mozilla
Public instance fields exist on every created instance of a class. By declaring a public field, you can ensure the field is always...
Read more >Private class fields in Javascript (ES2022) - DEV Community
Class fields and class methods are public by default. It is common you may want to make your class fields private.
Read more >ES2022: A Complete Guide on Private Class Fields, Methods ...
Let's take a look at ES2022 changes for JavaScript classes, which includes the following new syntaxes: Private class fields and methods ...
Read more >Master The Best New JavaScript Features in 2022 (ES2022 ...
Class Fields. The second feature that I think you should be most excited about is the accessor improvements to properties, fields and methods ......
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 Free
Top 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
All planned tasks are done 🎉
I made a quick pass through all rules to check if anything should be additionally updated because of the new code path and new scope for class field initializers, and I didn’t see any problems.
If anyone finds more rules that need to be updated, please open new issues.
@mdjermanovic I think
no-undef-init
should not apply to class fields. If we do anything, I think a separate rule would make sense, though I’m not sure it’s important enough to warrant a core rule. I’ll defer to consensus on that.