You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: the strict rule does not apply to class static blocks (#15314)
Documents that class static blocks do not have directives, and therefore the `strict` rule does not apply to them.
Also adds tests to confirm this behavior.
Refs #15016
Copy file name to clipboardExpand all lines: docs/rules/strict.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,8 @@ This rule disallows strict mode directives, no matter which option is specified,
49
49
50
50
This rule disallows strict mode directives, no matter which option is specified, in functions with non-simple parameter lists (for example, parameter lists with default parameter values) because that is a syntax error in **ECMAScript 2016** and later. See the examples of the [function](#function) option.
51
51
52
+
This rule does not apply to class static blocks, no matter which option is specified, because class static blocks do not have directives. Therefore, a `"use strict"` statement in a class static block is not a directive, and will be reported by the [no-unused-expressions](no-unused-expressions.md) rule.
53
+
52
54
The `--fix` option on the command line does not insert new `"use strict"` statements, but only removes unneeded statements.
0 commit comments