Class static blocks are technically functions, so they have arguments. However, referencing those arguments is a parse-time error, so I didn't add those variables to class static block scopes because they have no observable effects. This is consistent with class field initializers, we didn't add arguments there either.
Logic for properties that are deprecated per this document, such as Scope#isThisMaterialized, is not updated.
An alternative to the new "class-static-block" type could be to use the existing "function" type, which might be more practical for some use cases, but also confusing for others. I think it's better to introduce a new scope type.
I tagged this as a breaking change as I'd like to suggest that we bump major version. While this is a new syntax for eslint-scope, parsers (including Espree) already support this syntax, and inserting a new scope where it didn't exist before looks like a relatively big change in scope analysis (from wrong to right, but still).
This PR adds new
"class-static-block"
scopes. EachStaticBlock
node creates a"class-static-block"
scope.https://github.com/tc39/proposal-class-static-block
Notes:
arguments
. However, referencing thosearguments
is a parse-time error, so I didn't add those variables to class static block scopes because they have no observable effects. This is consistent with class field initializers, we didn't addarguments
there either.Scope#isThisMaterialized
, is not updated."class-static-block"
type could be to use the existing"function"
type, which might be more practical for some use cases, but also confusing for others. I think it's better to introduce a new scope type.I tagged this as a breaking change as I'd like to suggest that we bump major version. While this is a new syntax for
eslint-scope
, parsers (including Espree) already support this syntax, and inserting a new scope where it didn't exist before looks like a relatively big change in scope analysis (from wrong to right, but still).