eslint-plugin-perfectionist 2.11.0 → 3.0.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 +365 -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 +141 -99
  7. package/dist/rules/sort-astro-attributes.mjs +131 -102
  8. package/dist/rules/sort-classes.js +314 -180
  9. package/dist/rules/sort-classes.mjs +301 -181
  10. package/dist/rules/sort-enums.js +107 -81
  11. package/dist/rules/sort-enums.mjs +103 -81
  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 +405 -293
  15. package/dist/rules/sort-imports.mjs +392 -293
  16. package/dist/rules/sort-interfaces.js +234 -175
  17. package/dist/rules/sort-interfaces.mjs +219 -177
  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 +200 -129
  21. package/dist/rules/sort-jsx-props.mjs +185 -129
  22. package/dist/rules/sort-maps.js +89 -81
  23. package/dist/rules/sort-maps.mjs +85 -80
  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 +103 -87
  27. package/dist/rules/sort-named-imports.mjs +99 -87
  28. package/dist/rules/sort-object-types.js +254 -133
  29. package/dist/rules/sort-object-types.mjs +241 -136
  30. package/dist/rules/sort-objects.js +333 -205
  31. package/dist/rules/sort-objects.mjs +314 -210
  32. package/dist/rules/sort-svelte-attributes.js +146 -104
  33. package/dist/rules/sort-svelte-attributes.mjs +136 -107
  34. package/dist/rules/sort-switch-case.js +185 -0
  35. package/dist/rules/sort-switch-case.mjs +175 -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 +147 -102
  41. package/dist/rules/sort-vue-attributes.mjs +137 -105
  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 +13 -8
  53. package/dist/utils/get-group-number.mjs +11 -8
  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 +36 -27
  69. package/dist/utils/make-fixes.mjs +27 -27
  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 +87 -162
  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,365 @@
1
+ import { ClassicConfig } from '@typescript-eslint/utils/ts-eslint'
2
+ import { FlatConfig } from '@typescript-eslint/utils/ts-eslint'
3
+ import { ObjectExpression } from 'node_modules/@typescript-eslint/types/dist/generated/ast-spec'
4
+ import { ObjectPattern } from 'node_modules/@typescript-eslint/types/dist/generated/ast-spec'
5
+ import { RuleListener } from '@typescript-eslint/utils/ts-eslint'
6
+ import { RuleModule } from '@typescript-eslint/utils/ts-eslint'
7
+
8
+ declare const _default: {
9
+ configs: {
10
+ 'recommended-alphabetical-legacy': ClassicConfig.Config
11
+ 'recommended-line-length-legacy': ClassicConfig.Config
12
+ 'recommended-natural-legacy': ClassicConfig.Config
13
+ 'recommended-alphabetical': FlatConfig.Config
14
+ 'recommended-line-length': FlatConfig.Config
15
+ 'recommended-natural': FlatConfig.Config
16
+ }
17
+ rules: {
18
+ 'sort-variable-declarations': RuleModule<
19
+ 'unexpectedVariableDeclarationsOrder',
20
+ [
21
+ Partial<{
22
+ type: 'alphabetical' | 'line-length' | 'natural'
23
+ order: 'desc' | 'asc'
24
+ ignoreCase: boolean
25
+ }>,
26
+ ],
27
+ RuleListener
28
+ >
29
+ 'sort-intersection-types': RuleModule<
30
+ 'unexpectedIntersectionTypesOrder',
31
+ [
32
+ Partial<{
33
+ type: 'alphabetical' | 'line-length' | 'natural'
34
+ groups: (
35
+ | (
36
+ | 'object'
37
+ | 'function'
38
+ | 'operator'
39
+ | 'unknown'
40
+ | 'intersection'
41
+ | 'conditional'
42
+ | 'keyword'
43
+ | 'literal'
44
+ | 'nullish'
45
+ | 'import'
46
+ | 'named'
47
+ | 'tuple'
48
+ | 'union'
49
+ )[]
50
+ | (
51
+ | 'object'
52
+ | 'function'
53
+ | 'operator'
54
+ | 'unknown'
55
+ | 'intersection'
56
+ | 'conditional'
57
+ | 'keyword'
58
+ | 'literal'
59
+ | 'nullish'
60
+ | 'import'
61
+ | 'named'
62
+ | 'tuple'
63
+ | 'union'
64
+ )
65
+ )[]
66
+ order: 'desc' | 'asc'
67
+ ignoreCase: boolean
68
+ }>,
69
+ ],
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
+ RuleListener
86
+ >
87
+ 'sort-astro-attributes': RuleModule<
88
+ 'unexpectedAstroAttributesOrder',
89
+ [
90
+ Partial<{
91
+ customGroups: {
92
+ [x: string]: string | string[]
93
+ }
94
+ type: 'alphabetical' | 'line-length' | 'natural'
95
+ groups: (string | string[])[]
96
+ order: 'desc' | 'asc'
97
+ ignoreCase: boolean
98
+ }>,
99
+ ],
100
+ RuleListener
101
+ >
102
+ 'sort-vue-attributes': RuleModule<
103
+ 'unexpectedVueAttributesOrder',
104
+ [
105
+ Partial<{
106
+ customGroups: {
107
+ [x: string]: string | string[]
108
+ }
109
+ type: 'alphabetical' | 'line-length' | 'natural'
110
+ groups: (string | string[])[]
111
+ order: 'desc' | 'asc'
112
+ ignoreCase: boolean
113
+ }>,
114
+ ],
115
+ RuleListener
116
+ >
117
+ 'sort-array-includes': RuleModule<
118
+ 'unexpectedArrayIncludesOrder',
119
+ [
120
+ Partial<{
121
+ groupKind: 'literals-first' | 'spreads-first' | 'mixed'
122
+ type: 'alphabetical' | 'line-length' | 'natural'
123
+ order: 'desc' | 'asc'
124
+ ignoreCase: boolean
125
+ }>,
126
+ ],
127
+ RuleListener
128
+ >
129
+ 'sort-named-imports': RuleModule<
130
+ 'unexpectedNamedImportsOrder',
131
+ [
132
+ Partial<{
133
+ groupKind: 'values-first' | 'types-first' | 'mixed'
134
+ type: 'alphabetical' | 'line-length' | 'natural'
135
+ order: 'desc' | 'asc'
136
+ ignoreAlias: boolean
137
+ ignoreCase: boolean
138
+ }>,
139
+ ],
140
+ RuleListener
141
+ >
142
+ 'sort-named-exports': RuleModule<
143
+ 'unexpectedNamedExportsOrder',
144
+ [
145
+ Partial<{
146
+ groupKind: 'values-first' | 'types-first' | 'mixed'
147
+ type: 'alphabetical' | 'line-length' | 'natural'
148
+ order: 'desc' | 'asc'
149
+ ignoreCase: boolean
150
+ }>,
151
+ ],
152
+ RuleListener
153
+ >
154
+ 'sort-object-types': RuleModule<
155
+ 'unexpectedObjectTypesOrder',
156
+ [
157
+ Partial<{
158
+ groupKind: 'required-first' | 'optional-first' | 'mixed'
159
+ type: 'alphabetical' | 'line-length' | 'natural'
160
+ groups: (string | string[])[]
161
+ partitionByNewLine: boolean
162
+ order: 'desc' | 'asc'
163
+ ignoreCase: boolean
164
+ customGroups: {}
165
+ }>,
166
+ ],
167
+ RuleListener
168
+ >
169
+ 'sort-union-types': RuleModule<
170
+ 'unexpectedUnionTypesOrder',
171
+ [
172
+ Partial<{
173
+ type: 'alphabetical' | 'line-length' | 'natural'
174
+ groups: (
175
+ | (
176
+ | 'object'
177
+ | 'function'
178
+ | 'operator'
179
+ | 'unknown'
180
+ | 'intersection'
181
+ | 'conditional'
182
+ | 'keyword'
183
+ | 'literal'
184
+ | 'nullish'
185
+ | 'import'
186
+ | 'named'
187
+ | 'tuple'
188
+ | 'union'
189
+ )[]
190
+ | (
191
+ | 'object'
192
+ | 'function'
193
+ | 'operator'
194
+ | 'unknown'
195
+ | 'intersection'
196
+ | 'conditional'
197
+ | 'keyword'
198
+ | 'literal'
199
+ | 'nullish'
200
+ | 'import'
201
+ | 'named'
202
+ | 'tuple'
203
+ | 'union'
204
+ )
205
+ )[]
206
+ order: 'desc' | 'asc'
207
+ ignoreCase: boolean
208
+ }>,
209
+ ],
210
+ RuleListener
211
+ >
212
+ 'sort-switch-case': RuleModule<
213
+ 'unexpectedSwitchCaseOrder',
214
+ [
215
+ Partial<{
216
+ type: 'alphabetical' | 'line-length' | 'natural'
217
+ order: 'desc' | 'asc'
218
+ ignoreCase: boolean
219
+ }>,
220
+ ],
221
+ RuleListener
222
+ >
223
+ 'sort-interfaces': RuleModule<
224
+ 'unexpectedInterfacePropertiesOrder',
225
+ [
226
+ Partial<{
227
+ groupKind: 'optional-first' | 'required-first' | 'mixed'
228
+ customGroups: {
229
+ [key: string]: string[] | string
230
+ }
231
+ type: 'alphabetical' | 'line-length' | 'natural'
232
+ groups: (string | string[])[]
233
+ partitionByNewLine: boolean
234
+ ignorePattern: string[]
235
+ order: 'desc' | 'asc'
236
+ ignoreCase: boolean
237
+ }>,
238
+ ],
239
+ RuleListener
240
+ >
241
+ 'sort-jsx-props': RuleModule<
242
+ 'unexpectedJSXPropsOrder',
243
+ [
244
+ Partial<{
245
+ customGroups: {
246
+ [x: string]: string | string[]
247
+ }
248
+ type: 'alphabetical' | 'line-length' | 'natural'
249
+ groups: (string | string[])[]
250
+ ignorePattern: string[]
251
+ order: 'desc' | 'asc'
252
+ ignoreCase: boolean
253
+ }>,
254
+ ],
255
+ RuleListener
256
+ >
257
+ 'sort-classes': RuleModule<
258
+ 'unexpectedClassesOrder',
259
+ [
260
+ Partial<{
261
+ customGroups: {
262
+ [key: string]: string[] | string
263
+ }
264
+ type: 'alphabetical' | 'line-length' | 'natural'
265
+ partitionByComment: string[] | boolean | string
266
+ groups: (string[] | string)[]
267
+ order: 'desc' | 'asc'
268
+ ignoreCase: boolean
269
+ }>,
270
+ ],
271
+ RuleListener
272
+ >
273
+ 'sort-imports': RuleModule<
274
+ | 'missedSpacingBetweenImports'
275
+ | 'extraSpacingBetweenImports'
276
+ | 'unexpectedImportsOrder',
277
+ [
278
+ Partial<{
279
+ customGroups: {
280
+ value?:
281
+ | {
282
+ [x: string]: string | string[]
283
+ }
284
+ | undefined
285
+ type?:
286
+ | {
287
+ [x: string]: string | string[]
288
+ }
289
+ | undefined
290
+ }
291
+ type: 'alphabetical' | 'line-length' | 'natural'
292
+ newlinesBetween: 'ignore' | 'always' | 'never'
293
+ groups: (string | string[])[]
294
+ environment: 'node' | 'bun'
295
+ internalPattern: string[]
296
+ maxLineLength?: number
297
+ order: 'desc' | 'asc'
298
+ ignoreCase: boolean
299
+ }>,
300
+ ],
301
+ RuleListener
302
+ >
303
+ 'sort-exports': RuleModule<
304
+ 'unexpectedExportsOrder',
305
+ [
306
+ Partial<{
307
+ type: 'alphabetical' | 'line-length' | 'natural'
308
+ order: 'desc' | 'asc'
309
+ ignoreCase: boolean
310
+ }>,
311
+ ],
312
+ RuleListener
313
+ >
314
+ 'sort-objects': RuleModule<
315
+ 'unexpectedObjectsOrder',
316
+ [
317
+ Partial<{
318
+ customIgnore: ((
319
+ object: ObjectExpression | ObjectPattern,
320
+ filename: string,
321
+ ) => boolean)[]
322
+ customGroups: {
323
+ [key: string]: string[] | string
324
+ }
325
+ type: 'alphabetical' | 'line-length' | 'natural'
326
+ partitionByComment: string[] | boolean | string
327
+ groups: (string[] | string)[]
328
+ partitionByNewLine: boolean
329
+ styledComponents: boolean
330
+ ignorePattern: string[]
331
+ order: 'desc' | 'asc'
332
+ ignoreCase: boolean
333
+ }>,
334
+ ],
335
+ RuleListener
336
+ >
337
+ 'sort-enums': RuleModule<
338
+ 'unexpectedEnumsOrder',
339
+ [
340
+ Partial<{
341
+ type: 'alphabetical' | 'line-length' | 'natural'
342
+ partitionByComment: string[] | boolean | string
343
+ order: 'desc' | 'asc'
344
+ ignoreCase: boolean
345
+ }>,
346
+ ],
347
+ RuleListener
348
+ >
349
+ 'sort-maps': RuleModule<
350
+ 'unexpectedMapElementsOrder',
351
+ [
352
+ Partial<{
353
+ type: 'alphabetical' | 'line-length' | 'natural'
354
+ order: 'desc' | 'asc'
355
+ ignoreCase: boolean
356
+ }>,
357
+ ],
358
+ RuleListener
359
+ >
360
+ }
361
+ name: string
362
+ }
363
+ export default _default
364
+
365
+ 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