eslint-plugin-perfectionist 2.11.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/index.d.ts +379 -0
  2. package/dist/index.js +86 -129
  3. package/dist/index.mjs +85 -130
  4. package/dist/rules/sort-array-includes.js +120 -94
  5. package/dist/rules/sort-array-includes.mjs +116 -98
  6. package/dist/rules/sort-astro-attributes.js +142 -100
  7. package/dist/rules/sort-astro-attributes.mjs +132 -103
  8. package/dist/rules/sort-classes.js +334 -180
  9. package/dist/rules/sort-classes.mjs +321 -181
  10. package/dist/rules/sort-enums.js +109 -83
  11. package/dist/rules/sort-enums.mjs +105 -83
  12. package/dist/rules/sort-exports.js +65 -67
  13. package/dist/rules/sort-exports.mjs +64 -67
  14. package/dist/rules/sort-imports.js +420 -295
  15. package/dist/rules/sort-imports.mjs +405 -295
  16. package/dist/rules/sort-interfaces.js +235 -176
  17. package/dist/rules/sort-interfaces.mjs +220 -178
  18. package/dist/rules/sort-intersection-types.js +173 -66
  19. package/dist/rules/sort-intersection-types.mjs +166 -66
  20. package/dist/rules/sort-jsx-props.js +156 -100
  21. package/dist/rules/sort-jsx-props.mjs +146 -103
  22. package/dist/rules/sort-maps.js +90 -82
  23. package/dist/rules/sort-maps.mjs +86 -81
  24. package/dist/rules/sort-named-exports.js +94 -76
  25. package/dist/rules/sort-named-exports.mjs +90 -76
  26. package/dist/rules/sort-named-imports.js +104 -88
  27. package/dist/rules/sort-named-imports.mjs +100 -88
  28. package/dist/rules/sort-object-types.js +255 -134
  29. package/dist/rules/sort-object-types.mjs +242 -137
  30. package/dist/rules/sort-objects.js +330 -205
  31. package/dist/rules/sort-objects.mjs +311 -210
  32. package/dist/rules/sort-svelte-attributes.js +147 -105
  33. package/dist/rules/sort-svelte-attributes.mjs +137 -108
  34. package/dist/rules/sort-switch-case.js +238 -0
  35. package/dist/rules/sort-switch-case.mjs +223 -0
  36. package/dist/rules/sort-union-types.js +171 -92
  37. package/dist/rules/sort-union-types.mjs +164 -92
  38. package/dist/rules/sort-variable-declarations.js +142 -0
  39. package/dist/rules/sort-variable-declarations.mjs +136 -0
  40. package/dist/rules/sort-vue-attributes.js +148 -103
  41. package/dist/rules/sort-vue-attributes.mjs +138 -106
  42. package/dist/utils/compare.js +38 -25
  43. package/dist/utils/compare.mjs +36 -25
  44. package/dist/utils/complete.js +4 -4
  45. package/dist/utils/complete.mjs +2 -4
  46. package/dist/utils/create-eslint-rule.js +6 -6
  47. package/dist/utils/create-eslint-rule.mjs +4 -6
  48. package/dist/utils/get-comment-after.js +15 -10
  49. package/dist/utils/get-comment-after.mjs +13 -10
  50. package/dist/utils/get-comment-before.js +19 -10
  51. package/dist/utils/get-comment-before.mjs +17 -10
  52. package/dist/utils/get-group-number.js +14 -9
  53. package/dist/utils/get-group-number.mjs +12 -9
  54. package/dist/utils/get-lines-between.js +7 -7
  55. package/dist/utils/get-lines-between.mjs +5 -7
  56. package/dist/utils/get-node-parent.js +9 -9
  57. package/dist/utils/get-node-parent.mjs +7 -9
  58. package/dist/utils/get-node-range.js +37 -29
  59. package/dist/utils/get-node-range.mjs +35 -29
  60. package/dist/utils/get-source-code.js +7 -0
  61. package/dist/utils/get-source-code.mjs +5 -0
  62. package/dist/utils/is-member-optional.js +8 -8
  63. package/dist/utils/is-member-optional.mjs +6 -8
  64. package/dist/utils/is-partition-comment.js +16 -11
  65. package/dist/utils/is-partition-comment.mjs +14 -11
  66. package/dist/utils/is-positive.js +4 -4
  67. package/dist/utils/is-positive.mjs +2 -4
  68. package/dist/utils/make-fixes.js +37 -28
  69. package/dist/utils/make-fixes.mjs +28 -28
  70. package/dist/utils/pairwise.js +7 -7
  71. package/dist/utils/pairwise.mjs +5 -7
  72. package/dist/utils/range-to-diff.js +7 -7
  73. package/dist/utils/range-to-diff.mjs +5 -7
  74. package/dist/utils/sort-nodes.js +6 -5
  75. package/dist/utils/sort-nodes.mjs +4 -5
  76. package/dist/utils/to-single-line.js +4 -4
  77. package/dist/utils/to-single-line.mjs +2 -4
  78. package/dist/utils/use-groups.js +29 -23
  79. package/dist/utils/use-groups.mjs +27 -23
  80. package/package.json +14 -19
  81. package/readme.md +116 -166
  82. package/dist/configs/recommended-alphabetical.js +0 -9
  83. package/dist/configs/recommended-alphabetical.mjs +0 -10
  84. package/dist/configs/recommended-line-length.js +0 -9
  85. package/dist/configs/recommended-line-length.mjs +0 -10
  86. package/dist/configs/recommended-natural.js +0 -9
  87. package/dist/configs/recommended-natural.mjs +0 -10
  88. package/dist/package.json.js +0 -4
  89. package/dist/package.json.mjs +0 -4
  90. package/dist/typings/index.js +0 -29
  91. package/dist/typings/index.mjs +0 -29
@@ -0,0 +1,379 @@
1
+ import { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'
2
+ import { FlatConfig } from '@typescript-eslint/utils/ts-eslint'
3
+ import { RuleListener } from '@typescript-eslint/utils/ts-eslint'
4
+ import { RuleModule } from '@typescript-eslint/utils/ts-eslint'
5
+
6
+ declare const _default: {
7
+ configs: {
8
+ 'recommended-alphabetical-legacy': ClassicConfig.Config
9
+ 'recommended-line-length-legacy': ClassicConfig.Config
10
+ 'recommended-natural-legacy': ClassicConfig.Config
11
+ 'recommended-alphabetical': FlatConfig.Config
12
+ 'recommended-line-length': FlatConfig.Config
13
+ 'recommended-natural': FlatConfig.Config
14
+ }
15
+ rules: {
16
+ 'sort-variable-declarations': RuleModule<
17
+ 'unexpectedVariableDeclarationsOrder',
18
+ [
19
+ Partial<{
20
+ type: 'alphabetical' | 'line-length' | 'natural'
21
+ order: 'desc' | 'asc'
22
+ ignoreCase: boolean
23
+ }>,
24
+ ],
25
+ unknown,
26
+ RuleListener
27
+ >
28
+ 'sort-intersection-types': RuleModule<
29
+ 'unexpectedIntersectionTypesOrder',
30
+ [
31
+ Partial<{
32
+ type: 'alphabetical' | 'line-length' | 'natural'
33
+ groups: (
34
+ | (
35
+ | 'object'
36
+ | 'function'
37
+ | 'operator'
38
+ | 'unknown'
39
+ | 'intersection'
40
+ | 'conditional'
41
+ | 'keyword'
42
+ | 'literal'
43
+ | 'nullish'
44
+ | 'import'
45
+ | 'named'
46
+ | 'tuple'
47
+ | 'union'
48
+ )[]
49
+ | (
50
+ | 'object'
51
+ | 'function'
52
+ | 'operator'
53
+ | 'unknown'
54
+ | 'intersection'
55
+ | 'conditional'
56
+ | 'keyword'
57
+ | 'literal'
58
+ | 'nullish'
59
+ | 'import'
60
+ | 'named'
61
+ | 'tuple'
62
+ | 'union'
63
+ )
64
+ )[]
65
+ order: 'desc' | 'asc'
66
+ ignoreCase: boolean
67
+ }>,
68
+ ],
69
+ unknown,
70
+ RuleListener
71
+ >
72
+ 'sort-svelte-attributes': RuleModule<
73
+ 'unexpectedSvelteAttributesOrder',
74
+ [
75
+ Partial<{
76
+ customGroups: {
77
+ [x: string]: string | string[]
78
+ }
79
+ type: 'alphabetical' | 'line-length' | 'natural'
80
+ groups: (string | string[])[]
81
+ order: 'desc' | 'asc'
82
+ ignoreCase: boolean
83
+ }>,
84
+ ],
85
+ unknown,
86
+ RuleListener
87
+ >
88
+ 'sort-astro-attributes': RuleModule<
89
+ 'unexpectedAstroAttributesOrder',
90
+ [
91
+ Partial<{
92
+ customGroups: {
93
+ [x: string]: string | string[]
94
+ }
95
+ type: 'alphabetical' | 'line-length' | 'natural'
96
+ groups: (string | string[])[]
97
+ order: 'desc' | 'asc'
98
+ ignoreCase: boolean
99
+ }>,
100
+ ],
101
+ unknown,
102
+ RuleListener
103
+ >
104
+ 'sort-vue-attributes': RuleModule<
105
+ 'unexpectedVueAttributesOrder',
106
+ [
107
+ Partial<{
108
+ customGroups: {
109
+ [x: string]: string | string[]
110
+ }
111
+ type: 'alphabetical' | 'line-length' | 'natural'
112
+ groups: (string | string[])[]
113
+ order: 'desc' | 'asc'
114
+ ignoreCase: boolean
115
+ }>,
116
+ ],
117
+ unknown,
118
+ RuleListener
119
+ >
120
+ 'sort-array-includes': RuleModule<
121
+ 'unexpectedArrayIncludesOrder',
122
+ [
123
+ Partial<{
124
+ groupKind: 'literals-first' | 'spreads-first' | 'mixed'
125
+ type: 'alphabetical' | 'line-length' | 'natural'
126
+ order: 'desc' | 'asc'
127
+ ignoreCase: boolean
128
+ }>,
129
+ ],
130
+ unknown,
131
+ RuleListener
132
+ >
133
+ 'sort-named-imports': RuleModule<
134
+ 'unexpectedNamedImportsOrder',
135
+ [
136
+ Partial<{
137
+ groupKind: 'values-first' | 'types-first' | 'mixed'
138
+ type: 'alphabetical' | 'line-length' | 'natural'
139
+ order: 'desc' | 'asc'
140
+ ignoreAlias: boolean
141
+ ignoreCase: boolean
142
+ }>,
143
+ ],
144
+ unknown,
145
+ RuleListener
146
+ >
147
+ 'sort-named-exports': RuleModule<
148
+ 'unexpectedNamedExportsOrder',
149
+ [
150
+ Partial<{
151
+ groupKind: 'values-first' | 'types-first' | 'mixed'
152
+ type: 'alphabetical' | 'line-length' | 'natural'
153
+ order: 'desc' | 'asc'
154
+ ignoreCase: boolean
155
+ }>,
156
+ ],
157
+ unknown,
158
+ RuleListener
159
+ >
160
+ 'sort-object-types': RuleModule<
161
+ 'unexpectedObjectTypesOrder',
162
+ [
163
+ Partial<{
164
+ groupKind: 'required-first' | 'optional-first' | 'mixed'
165
+ type: 'alphabetical' | 'line-length' | 'natural'
166
+ groups: (string | string[])[]
167
+ partitionByNewLine: boolean
168
+ order: 'desc' | 'asc'
169
+ ignoreCase: boolean
170
+ customGroups: {}
171
+ }>,
172
+ ],
173
+ unknown,
174
+ RuleListener
175
+ >
176
+ 'sort-union-types': RuleModule<
177
+ 'unexpectedUnionTypesOrder',
178
+ [
179
+ Partial<{
180
+ type: 'alphabetical' | 'line-length' | 'natural'
181
+ groups: (
182
+ | (
183
+ | 'object'
184
+ | 'function'
185
+ | 'operator'
186
+ | 'unknown'
187
+ | 'intersection'
188
+ | 'conditional'
189
+ | 'keyword'
190
+ | 'literal'
191
+ | 'nullish'
192
+ | 'import'
193
+ | 'named'
194
+ | 'tuple'
195
+ | 'union'
196
+ )[]
197
+ | (
198
+ | 'object'
199
+ | 'function'
200
+ | 'operator'
201
+ | 'unknown'
202
+ | 'intersection'
203
+ | 'conditional'
204
+ | 'keyword'
205
+ | 'literal'
206
+ | 'nullish'
207
+ | 'import'
208
+ | 'named'
209
+ | 'tuple'
210
+ | 'union'
211
+ )
212
+ )[]
213
+ order: 'desc' | 'asc'
214
+ ignoreCase: boolean
215
+ }>,
216
+ ],
217
+ unknown,
218
+ RuleListener
219
+ >
220
+ 'sort-switch-case': RuleModule<
221
+ 'unexpectedSwitchCaseOrder',
222
+ [
223
+ Partial<{
224
+ type: 'alphabetical' | 'line-length' | 'natural'
225
+ order: 'desc' | 'asc'
226
+ ignoreCase: boolean
227
+ }>,
228
+ ],
229
+ unknown,
230
+ RuleListener
231
+ >
232
+ 'sort-interfaces': RuleModule<
233
+ 'unexpectedInterfacePropertiesOrder',
234
+ [
235
+ Partial<{
236
+ groupKind: 'optional-first' | 'required-first' | 'mixed'
237
+ customGroups: {
238
+ [key: string]: string[] | string
239
+ }
240
+ type: 'alphabetical' | 'line-length' | 'natural'
241
+ groups: (string | string[])[]
242
+ partitionByNewLine: boolean
243
+ ignorePattern: string[]
244
+ order: 'desc' | 'asc'
245
+ ignoreCase: boolean
246
+ }>,
247
+ ],
248
+ unknown,
249
+ RuleListener
250
+ >
251
+ 'sort-jsx-props': RuleModule<
252
+ 'unexpectedJSXPropsOrder',
253
+ [
254
+ Partial<{
255
+ customGroups: {
256
+ [x: string]: string | string[]
257
+ }
258
+ type: 'alphabetical' | 'line-length' | 'natural'
259
+ groups: (string | string[])[]
260
+ ignorePattern: string[]
261
+ order: 'desc' | 'asc'
262
+ ignoreCase: boolean
263
+ }>,
264
+ ],
265
+ unknown,
266
+ RuleListener
267
+ >
268
+ 'sort-classes': RuleModule<
269
+ 'unexpectedClassesOrder',
270
+ [
271
+ Partial<{
272
+ customGroups: {
273
+ [key: string]: string[] | string
274
+ }
275
+ type: 'alphabetical' | 'line-length' | 'natural'
276
+ partitionByComment: string[] | boolean | string
277
+ groups: (string[] | string)[]
278
+ order: 'desc' | 'asc'
279
+ ignoreCase: boolean
280
+ }>,
281
+ ],
282
+ unknown,
283
+ RuleListener
284
+ >
285
+ 'sort-imports': RuleModule<
286
+ | 'missedSpacingBetweenImports'
287
+ | 'extraSpacingBetweenImports'
288
+ | 'unexpectedImportsOrder',
289
+ [
290
+ Partial<{
291
+ customGroups: {
292
+ value?:
293
+ | {
294
+ [x: string]: string | string[]
295
+ }
296
+ | undefined
297
+ type?:
298
+ | {
299
+ [x: string]: string | string[]
300
+ }
301
+ | undefined
302
+ }
303
+ type: 'alphabetical' | 'line-length' | 'natural'
304
+ newlinesBetween: 'ignore' | 'always' | 'never'
305
+ groups: (string | string[])[]
306
+ environment: 'node' | 'bun'
307
+ internalPattern: string[]
308
+ maxLineLength?: number
309
+ order: 'desc' | 'asc'
310
+ ignoreCase: boolean
311
+ }>,
312
+ ],
313
+ unknown,
314
+ RuleListener
315
+ >
316
+ 'sort-exports': RuleModule<
317
+ 'unexpectedExportsOrder',
318
+ [
319
+ Partial<{
320
+ type: 'alphabetical' | 'line-length' | 'natural'
321
+ order: 'desc' | 'asc'
322
+ ignoreCase: boolean
323
+ }>,
324
+ ],
325
+ unknown,
326
+ RuleListener
327
+ >
328
+ 'sort-objects': RuleModule<
329
+ 'unexpectedObjectsOrder',
330
+ [
331
+ Partial<{
332
+ customGroups: {
333
+ [key: string]: string[] | string
334
+ }
335
+ type: 'alphabetical' | 'line-length' | 'natural'
336
+ partitionByComment: string[] | boolean | string
337
+ groups: (string[] | string)[]
338
+ partitionByNewLine: boolean
339
+ styledComponents: boolean
340
+ destructureOnly: boolean
341
+ ignorePattern: string[]
342
+ order: 'desc' | 'asc'
343
+ ignoreCase: boolean
344
+ }>,
345
+ ],
346
+ unknown,
347
+ RuleListener
348
+ >
349
+ 'sort-enums': RuleModule<
350
+ 'unexpectedEnumsOrder',
351
+ [
352
+ Partial<{
353
+ type: 'alphabetical' | 'line-length' | 'natural'
354
+ partitionByComment: string[] | boolean | string
355
+ order: 'desc' | 'asc'
356
+ ignoreCase: boolean
357
+ }>,
358
+ ],
359
+ unknown,
360
+ RuleListener
361
+ >
362
+ 'sort-maps': RuleModule<
363
+ 'unexpectedMapElementsOrder',
364
+ [
365
+ Partial<{
366
+ type: 'alphabetical' | 'line-length' | 'natural'
367
+ order: 'desc' | 'asc'
368
+ ignoreCase: boolean
369
+ }>,
370
+ ],
371
+ unknown,
372
+ RuleListener
373
+ >
374
+ }
375
+ name: string
376
+ }
377
+ export default _default
378
+
379
+ export {}
package/dist/index.js CHANGED
@@ -1,135 +1,92 @@
1
- "use strict";
2
- const sortIntersectionTypes = require("./rules/sort-intersection-types.js");
3
- const sortSvelteAttributes = require("./rules/sort-svelte-attributes.js");
4
- const sortAstroAttributes = require("./rules/sort-astro-attributes.js");
5
- const sortArrayIncludes = require("./rules/sort-array-includes.js");
6
- const sortVueAttributes = require("./rules/sort-vue-attributes.js");
7
- const sortNamedExports = require("./rules/sort-named-exports.js");
8
- const sortNamedImports = require("./rules/sort-named-imports.js");
9
- const sortObjectTypes = require("./rules/sort-object-types.js");
10
- const sortUnionTypes = require("./rules/sort-union-types.js");
11
- const sortInterfaces = require("./rules/sort-interfaces.js");
12
- const sortJsxProps = require("./rules/sort-jsx-props.js");
13
- const sortExports = require("./rules/sort-exports.js");
14
- const sortImports = require("./rules/sort-imports.js");
15
- const sortObjects = require("./rules/sort-objects.js");
16
- const sortClasses = require("./rules/sort-classes.js");
17
- const sortEnums = require("./rules/sort-enums.js");
18
- const sortMaps = require("./rules/sort-maps.js");
19
- const index = require("./typings/index.js");
20
- const _package = require("./package.json.js");
21
- let createConfigWithOptions = (options) => {
22
- let recommendedRules = {
23
- [sortImports.RULE_NAME]: [
24
- "error",
25
- {
26
- groups: [
27
- "type",
28
- ["builtin", "external"],
29
- "internal-type",
30
- "internal",
31
- ["parent-type", "sibling-type", "index-type"],
32
- ["parent", "sibling", "index"],
33
- "object",
34
- "unknown"
35
- ],
36
- "custom-groups": {
37
- value: {},
38
- type: {}
39
- },
40
- "newlines-between": "always",
41
- "internal-pattern": ["~/**"]
42
- }
43
- ],
44
- [sortClasses.RULE_NAME]: [
45
- "error",
46
- {
47
- groups: [
48
- "index-signature",
49
- "static-property",
50
- "private-property",
51
- "property",
52
- "constructor",
53
- "static-method",
54
- "private-method",
55
- "method",
56
- ["get-method", "set-method"],
57
- "unknown"
58
- ]
59
- }
60
- ],
61
- [sortObjects.RULE_NAME]: [
62
- "error",
63
- {
64
- "partition-by-comment": false
65
- }
66
- ],
67
- [sortArrayIncludes.RULE_NAME]: [
68
- "error",
69
- {
70
- "spread-last": true
71
- }
72
- ],
73
- [sortIntersectionTypes.RULE_NAME]: ["error"],
74
- [sortSvelteAttributes.RULE_NAME]: ["error"],
75
- [sortAstroAttributes.RULE_NAME]: ["error"],
76
- [sortVueAttributes.RULE_NAME]: ["error"],
77
- [sortNamedExports.RULE_NAME]: ["error"],
78
- [sortNamedImports.RULE_NAME]: ["error"],
79
- [sortObjectTypes.RULE_NAME]: ["error"],
80
- [sortUnionTypes.RULE_NAME]: ["error"],
81
- [sortInterfaces.RULE_NAME]: ["error"],
82
- [sortJsxProps.RULE_NAME]: ["error"],
83
- [sortExports.RULE_NAME]: ["error"],
84
- [sortEnums.RULE_NAME]: ["error"],
85
- [sortMaps.RULE_NAME]: ["error"]
86
- };
87
- return {
88
- rules: Object.fromEntries(
89
- Object.entries(recommendedRules).map(([key, [message, baseOptions = {}]]) => [
90
- `perfectionist/${key}`,
91
- [message, Object.assign(baseOptions, options)]
92
- ])
93
- ),
94
- plugins: ["perfectionist"]
95
- };
96
- };
97
- const mod = {
1
+ 'use strict'
2
+ const sortVariableDeclarations = require('./rules/sort-variable-declarations.js')
3
+ const sortIntersectionTypes = require('./rules/sort-intersection-types.js')
4
+ const sortSvelteAttributes = require('./rules/sort-svelte-attributes.js')
5
+ const sortAstroAttributes = require('./rules/sort-astro-attributes.js')
6
+ const sortArrayIncludes = require('./rules/sort-array-includes.js')
7
+ const sortVueAttributes = require('./rules/sort-vue-attributes.js')
8
+ const sortNamedImports = require('./rules/sort-named-imports.js')
9
+ const sortNamedExports = require('./rules/sort-named-exports.js')
10
+ const sortObjectTypes = require('./rules/sort-object-types.js')
11
+ const sortSwitchCase = require('./rules/sort-switch-case.js')
12
+ const sortUnionTypes = require('./rules/sort-union-types.js')
13
+ const sortInterfaces = require('./rules/sort-interfaces.js')
14
+ const sortJsxProps = require('./rules/sort-jsx-props.js')
15
+ const sortClasses = require('./rules/sort-classes.js')
16
+ const sortImports = require('./rules/sort-imports.js')
17
+ const sortExports = require('./rules/sort-exports.js')
18
+ const sortObjects = require('./rules/sort-objects.js')
19
+ const sortEnums = require('./rules/sort-enums.js')
20
+ const sortMaps = require('./rules/sort-maps.js')
21
+ let name = 'perfectionist'
22
+ let plugin = {
98
23
  rules: {
99
- [sortArrayIncludes.RULE_NAME]: sortArrayIncludes.default,
100
- [sortAstroAttributes.RULE_NAME]: sortAstroAttributes.default,
101
- [sortClasses.RULE_NAME]: sortClasses.default,
102
- [sortEnums.RULE_NAME]: sortEnums.default,
103
- [sortExports.RULE_NAME]: sortExports.default,
104
- [sortImports.RULE_NAME]: sortImports.default,
105
- [sortInterfaces.RULE_NAME]: sortInterfaces.default,
106
- [sortJsxProps.RULE_NAME]: sortJsxProps.default,
107
- [sortMaps.RULE_NAME]: sortMaps.default,
108
- [sortNamedExports.RULE_NAME]: sortNamedExports.default,
109
- [sortNamedImports.RULE_NAME]: sortNamedImports.default,
110
- [sortObjectTypes.RULE_NAME]: sortObjectTypes.default,
111
- [sortObjects.RULE_NAME]: sortObjects.default,
112
- [sortSvelteAttributes.RULE_NAME]: sortSvelteAttributes.default,
113
- [sortIntersectionTypes.RULE_NAME]: sortIntersectionTypes.default,
114
- [sortUnionTypes.RULE_NAME]: sortUnionTypes.default,
115
- [sortVueAttributes.RULE_NAME]: sortVueAttributes.default
24
+ 'sort-variable-declarations': sortVariableDeclarations,
25
+ 'sort-intersection-types': sortIntersectionTypes,
26
+ 'sort-svelte-attributes': sortSvelteAttributes,
27
+ 'sort-astro-attributes': sortAstroAttributes,
28
+ 'sort-vue-attributes': sortVueAttributes,
29
+ 'sort-array-includes': sortArrayIncludes,
30
+ 'sort-named-imports': sortNamedImports,
31
+ 'sort-named-exports': sortNamedExports,
32
+ 'sort-object-types': sortObjectTypes,
33
+ 'sort-union-types': sortUnionTypes,
34
+ 'sort-switch-case': sortSwitchCase,
35
+ 'sort-interfaces': sortInterfaces,
36
+ 'sort-jsx-props': sortJsxProps,
37
+ 'sort-classes': sortClasses,
38
+ 'sort-imports': sortImports,
39
+ 'sort-exports': sortExports,
40
+ 'sort-objects': sortObjects,
41
+ 'sort-enums': sortEnums,
42
+ 'sort-maps': sortMaps,
116
43
  },
44
+ name,
45
+ }
46
+ let getRules = options =>
47
+ Object.fromEntries(
48
+ Object.keys(plugin.rules).map(rule => [
49
+ `${name}/${rule}`,
50
+ ['error', options],
51
+ ]),
52
+ )
53
+ let createConfig = options => ({
54
+ plugins: {
55
+ [name]: plugin,
56
+ },
57
+ rules: getRules(options),
58
+ })
59
+ let createLegacyConfig = options => ({
60
+ rules: getRules(options),
61
+ plugins: [name],
62
+ })
63
+ const index = {
64
+ ...plugin,
117
65
  configs: {
118
- "recommended-alphabetical": createConfigWithOptions({
119
- type: index.SortType.alphabetical,
120
- order: index.SortOrder.asc,
121
- "ignore-case": false
66
+ 'recommended-alphabetical-legacy': createLegacyConfig({
67
+ type: 'alphabetical',
68
+ order: 'asc',
69
+ }),
70
+ 'recommended-line-length-legacy': createLegacyConfig({
71
+ type: 'line-length',
72
+ order: 'desc',
73
+ }),
74
+ 'recommended-natural-legacy': createLegacyConfig({
75
+ type: 'natural',
76
+ order: 'asc',
77
+ }),
78
+ 'recommended-alphabetical': createConfig({
79
+ type: 'alphabetical',
80
+ order: 'asc',
81
+ }),
82
+ 'recommended-line-length': createConfig({
83
+ type: 'line-length',
84
+ order: 'desc',
122
85
  }),
123
- "recommended-natural": createConfigWithOptions({
124
- type: index.SortType.natural,
125
- order: index.SortOrder.asc,
126
- "ignore-case": false
86
+ 'recommended-natural': createConfig({
87
+ type: 'natural',
88
+ order: 'asc',
127
89
  }),
128
- "recommended-line-length": createConfigWithOptions({
129
- type: index.SortType["line-length"],
130
- order: index.SortOrder.desc
131
- })
132
90
  },
133
- name: _package.name
134
- };
135
- module.exports = mod;
91
+ }
92
+ module.exports = index