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 class static blocks (stage-4) #15016
Comments
This looks like it will need a new scope in |
Yes, I think the same. |
acorn has been upgraded in ee1d3ec, this commit simiply added some tests. The tests were copied from test262, refs: tc39/test262@afe217b
acorn has been upgraded in ee1d3ec, this commit simiply added some tests. The tests were copied from test262, refs: tc39/test262@afe217b
acorn has been upgraded in ee1d3ec, this commit simiply added some tests. The tests were copied from test262, refs: tc39/test262@afe217b
acorn has been upgraded in ee1d3ec, this commit simiply added some tests. The tests were copied from test262, refs: tc39/test262@afe217b
I unchecked |
I added an initial list of rules that should be updated. A couple of them may need only docs/tests update. Note that class static blocks do not have directive prologue. |
Class static blocks are implicit functions. Therefore, they should be treated as separate code paths. This adds `class-static-block` code paths. Each `StaticBlock` node will start a new `class-static-block` code path. Refs #15016
Updates `omitLastInOneLineBlock` option to apply to class static blocks. Refs #15016
Updates the `no-extra-semi` rule to report semicolons after class static blocks. Refs #15016
Updates the `no-redeclare` rule to report redeclarations in class static blocks. Refs #15016
Fixes false positives at the top level of class static blocks. Refs #15016
Fixes false negatives at the top level of class static blocks. Refs #15016
Class static blocks are implicit functions. Therefore, they should be treated as separate code paths. This adds `class-static-block` code paths. Each `StaticBlock` node will start a new `class-static-block` code path. Refs #15016
Updates the `complexity` rule to apply to class static blocks. Refs #15016
Updates the `padded-blocks` rule to apply to class static blocks. Refs #15016
Fixes false negatives at the top level of class static blocks. Refs #15016
Updates the `max-statements` rule so that it does not apply to class static blocks and does not count statements in them as statements in the enclosing function. Refs #15016
* feat: update brace-style for class static blocks Updates the `brace-style` rule to apply to braces of class static blocks. Refs #15016 * Add note about indentation
Updates the `lines-around-comment` rule so that options `"allowBlockStart"` and `"allowBlockEnd"` apply to class static blocks. Refs #15016
Updates the `indent` rule to apply to class static blocks. Adds `StaticBlock.body` option that enforces indentation level for the body of a class static block. Refs #15016
Updates the `complexity` rule to apply to class static blocks. Refs #15016
Updates the `padded-blocks` rule to apply to class static blocks. Refs #15016
Updates the `max-depth` rule to treat class static blocks as separate contexts when calculating depth. Refs #15016
Updates the `no-inner-declarations` rule to allow declarations at the top level of class static blocks. Refs #15016
Updates the `no-redeclare` rule to report redeclarations in class static blocks. Refs #15016
Fixes false positive in the `semi-style` rule: the last statement in a class static block should be allowed to have its semicolon on the same line when the option is `first`. Refs #15016
Fixes the `vars-on-top` rule to allow `var` declarations at the top of class static blocks. Refs #15016
Updates logic related to class definition evaluation with class static blocks. Refs #15016
All currently-known work to implement class static blocks just shipped in ESLint v8.3.0! |
What is the name of the syntax to implement?
class static blocks
Please provide the TC39 URL for the syntax proposal:
https://github.com/tc39/proposal-class-static-block
Please provide some example code for the new syntax:
Implementation Checklist
Please check off all items that have already been completed. Be sure to paste the pull request URLs next to each item so we can verify the work as done.
static
initialization blocks tc39/ecma262#2440eslint-visitor-keys
update: Update: add StaticBlock eslint-visitor-keys#29, chore: upgrade eslint-visitor-keys for class static blocks #15277espree
update: feat: support class static blocks espree#518eslint-scope
update: feat!: support class static blocks eslint-scope#80, feat: update eslint-scope for class static blocks #15321eslint
update:block-scoped-var
docs: add examples for block-scoped-var with class static blocks #15302block-spacing
feat: update block-spacing for class static blocks #15297brace-style
feat: update brace-style for class static blocks #15322class-methods-use-this
feat: update class-methods-use-this for class static blocks #15298complexity
feat: update the complexity rule for class static blocks #15328indent
feat: update the indent rule for class static blocks #15324keyword-spacing
feat: update keyword-spacing for class static blocks #15289lines-around-comment
feat: update lines-around-comment for class static blocks #15323max-depth
feat: update max-depth for class static blocks #15316max-statements
feat: update max-statements for class static blocks #15315no-lone-blocks
feat: update no-lone-blocks for class static blocks #15295neither, possibly a new rule.no-empty
(orno-empty-function
?)no-eval
fix: update no-invalid-this and no-eval for class static blocks #15300no-extra-semi
feat: update no-extra-semi for class static blocks #15287no-inner-declarations
feat: update no-inner-declarations for class static blocks #15290no-invalid-this
fix: update no-invalid-this and no-eval for class static blocks #15300no-redeclare
feat: update no-redeclare for class static blocks #15313no-unused-expressions
docs: no-unused-expressions - class static blocks don't have directives #15283no-use-before-define
feat: update no-use-before-define for class static blocks #15312one-var
feat: update one-var for class static blocks #15317padded-blocks
feat: update padded-blocks for class static blocks #15333padding-line-between-statements
feat: update padding-line-between-statements for class static blocks #15318prefer-const
feat: update prefer-const for class static blocks #15325semi
feat: update semi rule for class static blocks #15286semi-style
fix: update semi-style for class static blocks #15309strict
docs: the strict rule does not apply to class static blocks #15314vars-on-top
fix: update vars-on-top for class static blocks #15306Are you willing to submit a pull request to implement this syntax?
y
The text was updated successfully, but these errors were encountered: