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

Update rules to support ES2022 class fields #14857

Closed
32 tasks done
btmills opened this issue Jul 30, 2021 · 27 comments
Closed
32 tasks done

Update rules to support ES2022 class fields #14857

btmills opened this issue Jul 30, 2021 · 27 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint new syntax This issue is related to new syntax that has reached stage 4 rule Relates to ESLint's core rules

Comments

@btmills
Copy link
Member

btmills commented Jul 30, 2021

What is the name of the syntax to implement?

Class fields

Please provide the TC39 URL for the syntax proposal:

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.

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.

@btmills btmills added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules new syntax This issue is related to new syntax that has reached stage 4 labels Jul 30, 2021
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Jul 30, 2021
@btmills btmills moved this from Needs Triage to Ready to Implement in Triage Jul 30, 2021
@btmills btmills added this to Planned in v8.0.0 Jul 30, 2021
@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 6, 2021

Working on prefer-destructuring

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 6, 2021

Checked off rules that already look good: computed-property-spacing, no-eval, no-extra-semi, no-invalid-this, no-self-assign, prefer-exponentiation-operator, quotes, semi-spacing, semi-style, space-infix-ops.

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 6, 2021

Working on dot-notation.

@snitin315
Copy link
Contributor

snitin315 commented Aug 7, 2021

working on keyword-spacing

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 7, 2021

Working on no-useless-computed-key.

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 8, 2021

Working on no-extra-parens.

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 8, 2021

Working on no-multi-assign (it's a documentation-only issue).

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 8, 2021

Working on func-names (it's a documentation-only issue).

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 26, 2021

@eslint/eslint-tsc thoughts about #14591 (comment) - should the no-undef-init rule apply to class fields by default, or behind an option, or not at all?

Currently, as implemented in #14591, it applies to class fields by default. If that's the desired behavior, we should fix a bug (#14591 (comment)) and update the docs to complete the task since the documentation for this rule says that it targets variables.

I'm leaning toward making a separate rule so that users can enable/disable them separately. The new rule would also emphasize the fact that class field definition always creates a property, even if the initial value is not specified. It wouldn't be a blocker for v8.0.0, the task for v8.0.0 would be just to revert the change made in #14591.

@nzakas
Copy link
Member

nzakas commented Aug 27, 2021

@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.

@btmills
Copy link
Member Author

btmills commented Aug 29, 2021

I could make a case either way for no-undef-init applying to class fields with an option or as a separate rule, so I’ll defer to consensus in favor of leaving it for a separate rule.

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 30, 2021

Working on no-undef-init

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 30, 2021

#14994 fixes #14591 (comment) as agreed (no-undef-init should not apply to class fields), so #14591 (comment) no longer applies.

@yeonjuan
Copy link
Member

yeonjuan commented Aug 31, 2021

Working on class-methods-use-this

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 31, 2021

Prepared #15005 to update documentation for no-dupe-class-members.

Regarding #14591 (comment), we discussed that question in #14979 and decided to not make any changes for now.

mdjermanovic added a commit that referenced this issue Sep 2, 2021
…4994)

* Fix: no-undef-init should not apply to class fields (refs #14857)

* update docs
@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label Sep 5, 2021
mdjermanovic pushed a commit that referenced this issue Sep 5, 2021
* Fix: Update semi for class-fields (refs #14591)

* Fixed several bugs

* Ensure beforeStatementContinuationChars does not apply to class fields

* Fix semi rule bugs for class fields

* Fix edge cases
@mdjermanovic
Copy link
Member

mdjermanovic commented Sep 7, 2021

Working on lines-between-class-members

mdjermanovic added a commit that referenced this issue Sep 10, 2021
…#15018)

* Update: update options in class-methods-use (refs #14857)

* fix default option

* fix review

* fix

* remove unnecessary listener

* Update docs/rules/class-methods-use-this.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update docs/rules/class-methods-use-this.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update docs/rules/class-methods-use-this.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update docs/rules/class-methods-use-this.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update docs/rules/class-methods-use-this.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update docs/rules/class-methods-use-this.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update docs/rules/class-methods-use-this.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* change example order

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
mdjermanovic added a commit that referenced this issue Sep 10, 2021
…14957)

* Update: support class fields in the `complexity` rule (refs #14857)

* Use code path analysis

* Remove an extra empty line
@mdjermanovic
Copy link
Member

mdjermanovic commented Sep 10, 2021

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.

Triage automation moved this from Ready to Implement to Complete Sep 10, 2021
v8.0.0 automation moved this from Pull Request Opened to Done Sep 10, 2021
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Mar 10, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint new syntax This issue is related to new syntax that has reached stage 4 rule Relates to ESLint's core rules
Projects
Triage
Complete
v8.0.0
  
Done
Development

No branches or pull requests

5 participants