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/content/rules/sort-array-includes.mdx
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,6 @@ Enforce sorted array values if the `includes` method is immediately called after
20
20
21
21
By keeping arrays sorted, developers can quickly scan and verify the values, making the code more predictable and reducing the likelihood of errors. This practice simplifies debugging and enhances the overall clarity of the codebase.
Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option,
256
260
it will automatically be added to the end of the list.
257
261
258
-
##### Newlines between groups
259
-
260
-
You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups.
262
+
##### Group with overridden settings
261
263
262
-
See the [`newlinesBetween`](#newlinesbetween)option.
264
+
You may directly override options for a specific group by using an object with the `group` property and other option overrides.
263
265
264
-
This feature is only applicable when [`partitionByNewLine`](#partitionbynewline) is `false`.
266
+
-`type` — Overrides the [`type`](#type) option for that group.
267
+
-`commentAbove` — Enforces the presence of a comment containing the content of `commentAbove` above the top element of the group.
268
+
- An error will be raised if no comment containing the content of `commentAbove` is found above the top element of the
269
+
group.
270
+
- Auto-fixing will add a comment containing the content of `commentAbove` above the top element of the group.
271
+
- Auto-fixing will also remove invalid auto-added comments (only comments existing in `commentAbove` objects are
272
+
considered as auto-removable).
265
273
266
274
```ts
267
275
{
268
-
newlinesBetween: 1,
269
276
groups: [
270
-
'a',
271
-
{ newlinesBetween: 0 }, // Overrides the global newlinesBetween option
0 commit comments