8000 feat: adds possibility to trim / remove special characters before sor… · azat-io/eslint-plugin-perfectionist@96f8b10 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96f8b10

Browse files
authored
feat: adds possibility to trim / remove special characters before sorting
1 parent dc0a789 commit 96f8b10

Some content is hidden

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

63 files changed

+1432
-10
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ Controls whether sorting should be case-sensitive or not.
147147
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
148148
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
149149

150+
### specialCharacters
151+
152+
<sub>default: `keep`</sub>
153+
154+
Controls whether special characters should be trimmed, removed or kept before sorting.
155+
156+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
157+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
158+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
159+
150160

151161
### groupKind
152162

@@ -229,6 +239,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
229239
type: 'alphabetical',
230240
order: 'asc',
231241
ignoreCase: true,
242+
specialCharacters: 'keep',
232243
groupKind: 'literals-first',
233244
partitionByNewLine: false,
234245
matcher: 'minimatch',
@@ -255,6 +266,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
255266
type: 'alphabetical',
256267
order: 'asc',
257268
ignoreCase: true,
269+
specialCharacters: 'keep',
258270
groupKind: 'literals-first',
259271
partitionByNewLine: false,
260272
matcher: 'minimatch',

docs/content/rules/sort-astro-attributes.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ Controls whether sorting should be case-sensitive or not.
136136
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
137137
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
138138

139+
### specialCharacters
140+
141+
<sub>default: `keep`</sub>
142+
143+
Controls whether special characters should be trimmed, removed or kept before sorting.
144+
145+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
146+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
147+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
148+
139149
### groups
140150

141151
<sub>
@@ -310,6 +320,7 @@ In order to start using this rule, you need to install additional dependency:
310320
type: 'alphabetical',
311321
order: 'asc',
312322
ignoreCase: true,
323+
specialCharacters: 'keep',
313324
matcher: 'minimatch',
314325
groups: [],
315326
customGroups 10000 : {},
@@ -342,6 +353,7 @@ In order to start using this rule, you need to install additional dependency:
342353
type: 'alphabetical',
343354
order: 'asc',
344355
ignoreCase: true,
356+
specialCharacters: 'keep',
345357
matcher: 'minimatch',
346358
groups: [],
347359
customGroups: {},

docs/content/rules/sort-classes.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ Controls whether sorting should be case-sensitive or not.
181181
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
182182
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
183183

184+
### specialCharacters
185+
186+
<sub>default: `keep`</sub>
187+
188+
Controls whether special characters should be trimmed, removed or kept before sorting.
189+
190+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
191+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
192+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
193+
184194
### partitionByComment
185195

186196
<sub>default: `false`</sub>
@@ -604,6 +614,7 @@ Determines the matcher used for patterns in the `partitionByComment` and `custom
604614
type: 'alphabetical',
605615
order: 'asc',
606616
ignoreCase: true,
617+
specialCharacters: 'keep',
607618
partitionByComment: false,
608619
matcher: 'minimatch',
609620
groups: [
@@ -645,6 +656,7 @@ Determines the matcher used for patterns in the `partitionByComment` and `custom
645656
type: 'alphabetical',
646657
order: 'asc',
647658
ignoreCase: true,
659+
specialCharacters: 'keep',
648660
partitionByComment: false,
649661
matcher: 'minimatch',
650662
groups: [

docs/content/rules/sort-enums.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ Controls whether sorting should be case-sensitive or not.
112112
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
113113
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
114114

115+
### specialCharacters
116+
117+
<sub>default: `keep`</sub>
118+
119+
Controls whether special characters should be trimmed, removed or kept before sorting.
120+
121+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
122+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
123+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
124+
115125
### sortByValue
116126

117127
<sub>default: `false`</sub>
@@ -196,6 +206,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
196206
type: 'alphabetical',
197207
order: 'asc',
198208
ignoreCase: true,
209+
specialCharacters: 'keep',
199210
partitionByComment: false,
200211
partitionByNewLine: false,
201212
sortByValue: false,
@@ -223,6 +234,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
223234
type: 'alphabetical',
224235
order: 'asc',
225236
ignoreCase: true,
237+
specialCharacters: 'keep',
226238
partitionByComment: false,
227239
partitionByNewLine: false,
228240
sortByValue: false,

docs/content/rules/sort-exports.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ Controls whether sorting should be case-sensitive or not.
106106
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
107107
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
108108

109+
### specialCharacters
110+
111+
<sub>default: `keep`</sub>
112+
113+
Controls whether special characters should be trimmed, removed or kept before sorting.
114+
115+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
116+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
117+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
118+
109119
### partitionByComment
110120

111121
<sub>default: `false`</sub>
@@ -176,6 +186,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
176186
type: 'alphabetical',
177187
order: 'asc',
178188
ignoreCase: true,
189+
specialCharacters: 'keep',
179190
partitionByComment: false,
180191
partitionByNewLine: false,
181192
groupKind: 'mixed',
@@ -203,6 +214,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
203214
type: 'alphabetical',
204215
order: 'asc',
205216
ignoreCase: true,
217+
specialCharacters: 'keep',
206218
partitionByComment: false,
207219
partitionByNewLine: false,
208220
groupKind: 'mixed',

docs/content/rules/sort-imports.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ Controls whether sorting should be case-sensitive or not.
145145
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
146146
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
147147

148+
### specialCharacters
149+
150+
<sub>default: `keep`</sub>
151+
152+
Controls whether special characters should be trimmed, removed or kept before sorting.
153+
154+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
155+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
156+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
157+
148158
### internalPattern
149159

150160
<sub>default: `['~/**']` for `minimatch` matcher, `['^~/.*']` for `regex` matcher</sub>
@@ -349,6 +359,7 @@ Specifies which environment’s built-in modules should be recognized. If you ar
349359
type: 'alphabetical',
350360
order: 'asc',
351361
ignoreCase: true,
362+
specialCharacters: 'keep',
352363
matcher: 'minimatch',
353364
internalPattern: ['~/**'],
354365
newlinesBetween: 'always',
@@ -389,6 +400,7 @@ Specifies which environment’s built-in modules should be recognized. If you ar
389400
type: 'alphabetical',
390401
order: 'asc',
391402
ignoreCase: true,
403+
specialCharacters: 'keep',
392404
matcher: 'minimatch',
393405
internalPattern: ['~/**'],
394406
newlinesBetween: 'always',

docs/content/rules/sort-interfaces.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ Controls whether sorting should be case-sensitive or not.
161161
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
162162
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
163163

164+
### specialCharacters
165+
166+
<sub>default: `keep`</sub>
167+
168+
Controls whether special characters should be trimmed, removed or kept before sorting.
169+
170+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
171+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
172+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
173+
164174
### ignorePattern
165175

166176
<sub>default: `[]`</sub>
@@ -348,6 +358,7 @@ Determines the matcher used for patterns in the `partitionByComment`, `ignorePat
348358
type: 'alphabetical',
349359
order: 'asc',
350360
ignoreCase: true,
361+
specialCharacters: 'keep',
351362
ignorePattern: [],
352363
partitionByNewLine: false,
353364
optionalityOrder: 'ignore',
@@ -377,6 +388,7 @@ Determines the matcher used for patterns in the `partitionByComment`, `ignorePat
377388
type: 'alphabetical',
378389
order: 'asc',
379390
ignoreCase: true,
391+
specialCharacters: 'keep',
380392
ignorePattern: [],
381393
partitionByNewLine: false,
382394
optionalityOrder: 'ignore',

docs/content/rules/sort-intersection-types.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ Controls whether sorting should be case-sensitive or not.
102102
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
103103
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
104104

105+
### specialCharacters
106+
107+
<sub>default: `keep`</sub>
108+
109+
Controls whether special characters should be trimmed, removed or kept before sorting.
110+
111+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
112+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
113+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
114+
105115
### partitionByComment
106116

107117
<sub>default: `false`</sub>
@@ -283,6 +293,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
283293
type: 'alphabetical',
284294
order: 'asc',
285295
ignoreCase: true,
296+
specialCharacters: 'keep',
286297
partitionByNewLine: false,
287298
partitionByNewLine: false,
288299
matcher: 'minimatch',
@@ -310,6 +321,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
310321
type: 'alphabetical',
311322
order: 'asc',
312323
ignoreCase: true,
324+
specialCharacters: 'keep',
313325
partitionByNewLine: false,
314326
partitionByComment: false,
315327
matcher: 'minimatch',

docs/content/rules/sort-jsx-props.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ Controls whether sorting should be case-sensitive or not.
162162
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
163163
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
164164

165+
### specialCharacters
166+
167+
<sub>default: `keep`</sub>
168+
169+
Controls whether special characters should be trimmed, removed or kept before sorting.
170+
171+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
172+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
173+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
174+
165175
### ignorePattern
166176

167177
<sub>default: `[]`</sub>
@@ -259,6 +269,7 @@ Determines the matcher used for patterns in the `ignorePattern` and `customGroup
259269
type: 'alphabetical',
260270
order: 'asc',
261271
ignoreCase: true,
272+
specialCharacters: 'keep',
262273
ignorePattern: [],
263274
matcher: 'minimatch',
264275
groups: [],
@@ -286,6 +297,7 @@ Determines the matcher used for patterns in the `ignorePattern` and `customGroup
286297
type: 'alphabetical',
287298
order: 'asc',
288299
ignoreCase: true,
300+
specialCharacters: 'keep',
289301
ignorePattern: [],
290302
matcher: 'minimatch',
291303
groups: [],

docs/content/rules/sort-maps.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ Controls whether sorting should be case-sensitive or not.
107107
- `true` — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
108108
- `false` — Consider case when sorting (e.g., “A” comes before “a”).
109109

110+
### specialCharacters
111+
112+
<sub>default: `keep`</sub>
113+
114+
Controls whether special characters should be trimmed, removed or kept before sorting.
115+
116+
- `'keep'` — Keep special characters when sorting (e.g., “_a” comes before “a”).
117+
- `'trim'` — Trim special characters when sorting alphabetically or naturally (e.g., “_a” and “a” are the same).
118+
- `'remove'` — Remove special characters when sorting (e.g., “/a/b” and “ab” are the same).
119+
110120
### partitionByComment
111121

112122
<sub>default: `false`</sub>
@@ -177,6 +187,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
177187
type: 'alphabetical',
178188
order: 'asc',
179189
ignoreCase: true,
190+
specialCharacters: 'keep',
180191
partitionByNewLine: false,
181192
partitionByComment: false,
182193
matcher: 'minimatch',
@@ -203,6 +214,7 @@ Determines the matcher used for patterns in the `partitionByComment` option.
203214
type: 'alphabetical',
204215
order: 'asc',
205216
ignoreCase: true,
217+
specialCharacters: 'keep',
206218
partitionByNewLine: false,
207219
partitionByComment: false,
208220
matcher: 'minimatch',

0 commit comments

Comments
 (0)
0