Skip to content

Commit 00a8080

Browse files
authoredFeb 11, 2025··
feat: improve regex-related options
1 parent 103a8c9 commit 00a8080

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1722
-1481
lines changed
 

‎docs/content/rules/sort-array-includes.mdx

+7-7
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ Allows you to group array elements by their kind, determining whether spread val
197197
Allows you to use comments to separate the members of arrays into logical groups. This can help in organizing and maintaining large arrays by creating partitions based on comments.
198198

199199
- `true` — All comments will be treated as delimiters, creating partitions.
200-
- `false` — Comments will not be used as delimiters.
201-
- `string` — A regexp pattern to specify which comments should act as delimiters.
202-
- `string[]` — A list of regexp patterns to specify which comments should act as delimiters.
203-
- `{ block: boolean | string | string[]; line: boolean | string | string[] }` — Specify which block and line comments should act as delimiters.
200+
- `false` — Comments will not be used as delimiters.
201+
- `RegExpPattern = string | { pattern: string; flags: string}` — A regexp pattern to specify which comments should act as delimiters.
202+
- `RegExpPattern[]` — A list of regexp patterns to specify which comments should act as delimiters.
203+
- `{ block: boolean | RegExpPattern | RegExpPattern[]; line: boolean | RegExpPattern | RegExpPattern[] }` — Specify which block and line comments should act as delimiters.
204204

205205
### partitionByNewLine
206206

@@ -251,7 +251,7 @@ This option is only applicable when `partitionByNewLine` is `false`.
251251
### useConfigurationIf
252252

253253
<sub>
254-
type: `{ allNamesMatchPattern?: string }`
254+
type: `{ allNamesMatchPattern?: string | string[] | { pattern: string; flags: string } | { pattern: string; flags: string }[] }`
255255
</sub>
256256
<sub>default: `{}`</sub>
257257

@@ -353,7 +353,7 @@ interface CustomGroupDefinition {
353353
type?: 'alphabetical' | 'natural' | 'line-length' | 'unsorted'
354354
order?: 'asc' | 'desc'
355355
selector?: string
356-
elementNamePattern?: string
356+
elementNamePattern?: string | string[] | { pattern: string; flags?: string } | { pattern: string; flags?: string }[]
357357
}
358358

359359
```
@@ -368,7 +368,7 @@ interface CustomGroupAnyOfDefinition {
368368
order?: 'asc' | 'desc'
369369
anyOf: Array<{
370370
selector?: string
371-
elementNamePattern?: string
371+
elementNamePattern?: string | string[] | { pattern: string; flags?: string } | { pattern: string; flags?: string }[]
372372
}>
373373
}
374374
```

‎docs/content/rules/sort-classes.mdx

+10-9
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,10 @@ Specifies the sorting locales. See [String.prototype.localeCompare() - locales](
219219
Allows you to use comments to separate the class members into logical groups. This can help in organizing and maintaining large classes by creating partitions within the class based on comments.
220220

221221
- `true` — All comments will be treated as delimiters, creating partitions.
222-
- `false` — Comments will not be used as delimiters.
223-
- string — A regexp pattern to specify which comments should act as delimiters.
224-
- `{ block: boolean | string | string[]; line: boolean | string | string[] }` — Specify which block and line comments should act as delimiters.
222+
- `false` — Comments will not be used as delimiters.
223+
- `RegExpPattern = string | { pattern: string; flags: string}` — A regexp pattern to specify which comments should act as delimiters.
224+
- `RegExpPattern[]` — A list of regexp patterns to specify which comments should act as delimiters.
225+
- `{ block: boolean | RegExpPattern | RegExpPattern[]; line: boolean | RegExpPattern | RegExpPattern[] }` — Specify which block and line comments should act as delimiters.
225226

226227
### partitionByNewLine
227228

@@ -626,9 +627,9 @@ interface CustomGroupDefinition {
626627
newlinesInside?: 'always' | 'never'
627628
selector?: string
628629
modifiers?: string[]
629-
elementNamePattern?: string
630-
elementValuePattern?: string
631-
decoratorNamePattern?: string
630+
elementNamePattern?: string | string[] | { pattern: string; flags?: string } | { pattern: string; flags?: string }[]
631+
elementValuePattern?: string | string[] | { pattern: string; flags?: string } | { pattern: string; flags?: string }[]
632+
decoratorNamePattern?: string | string[] | { pattern: string; flags?: string } | { pattern: string; flags?: string }[]
632633
}
633634
```
634635
A class member will match a `CustomGroupDefinition` group if it matches all the filters of the custom group's definition.
@@ -644,9 +645,9 @@ interface CustomGroupAnyOfDefinition {
644645
anyOf: Array<{
645646
selector?: string
646647
modifiers?: string[]
647-
elementNamePattern?: string
648-
elementValuePattern?: string
649-
decoratorNamePattern?: string
648+
elementNamePattern?: string | string[] | { pattern: string; flags?: string } | { pattern: string; flags?: string }[]
649+
elementValuePattern?: string | string[] | { pattern: string; flags?: string } | { pattern: string; flags?: string }[]
650+
decoratorNamePattern?: string | string[] | { pattern: string; flags?: string } | { pattern: string; flags?: string }[]
650651
}>
651652
}
652653
```

0 commit comments

Comments
 (0)
Please sign in to comment.