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
feat: update the indent rule for class static blocks (#15324)
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
Copy file name to clipboardExpand all lines: docs/rules/indent.md
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,8 @@ This rule has an object option:
79
79
*`"FunctionExpression"` takes an object to define rules for function expressions.
80
80
*`parameters` (default: 1) enforces indentation level for parameters in a function expression. This can either be a number indicating indentation level, or the string `"first"` indicating that all parameters of the expression must be aligned with the first parameter. This can also be set to `"off"` to disable checking for FunctionExpression parameters.
81
81
*`body` (default: 1) enforces indentation level for the body of a function expression.
82
+
*`"StaticBlock"` takes an object to define rules for class static blocks.
83
+
*`body` (default: 1) enforces indentation level for the body of a class static block.
82
84
*`"CallExpression"` takes an object to define rules for function call expressions.
83
85
*`arguments` (default: 1) enforces indentation level for arguments in a call expression. This can either be a number indicating indentation level, or the string `"first"` indicating that all arguments of the expression must be aligned with the first argument. This can also be set to `"off"` to disable checking for CallExpression arguments.
84
86
*`"ArrayExpression"` (default: 1) enforces indentation level for elements in arrays. It can also be set to the string `"first"`, indicating that all the elements in the array should be aligned with the first element. This can also be set to `"off"` to disable checking for array elements.
@@ -484,6 +486,56 @@ var foo = function(bar, baz,
484
486
}
485
487
```
486
488
489
+
### StaticBlock
490
+
491
+
Examples of **incorrect** code for this rule with the `2, { "StaticBlock": {"body": 1} }` option:
0 commit comments