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
Copy file name to clipboardexpand all lines: docs/src/rules/object-shorthand.md
+17
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,7 @@ Additionally, the rule takes an optional object configuration:
115
115
116
116
*`"avoidQuotes": true` indicates that long-form syntax is preferred whenever the object key is a string literal (default: `false`). Note that this option can only be enabled when the string option is set to `"always"`, `"methods"`, or `"properties"`.
117
117
*`"ignoreConstructors": true` can be used to prevent the rule from reporting errors for constructor functions. (By default, the rule treats constructors the same way as other functions.) Note that this option can only be enabled when the string option is set to `"always"` or `"methods"`.
118
+
*`"methodsIgnorePattern"` (`string`) for methods whose names match this regex pattern, the method shorthand will not be enforced. Note that this option can only be used when the string option is set to `"always"` or `"methods"`.
118
119
*`"avoidExplicitReturnArrows": true` indicates that methods are preferred over explicit-return arrow functions for function properties. (By default, the rule allows either of these.) Note that this option can only be enabled when the string option is set to `"always"` or `"methods"`.
119
120
120
121
### `avoidQuotes`
@@ -179,6 +180,22 @@ var foo = {
179
180
180
181
:::
181
182
183
+
### `methodsIgnorePattern`
184
+
185
+
Example of **correct** code for this rule with the `"always", { "methodsIgnorePattern": "^bar$" }` option:
0 commit comments