eslint-plugin-perfectionist 4.15.0 → 5.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.
- package/dist/alphabet.d.ts +1 -174
- package/dist/index.d.ts +209 -9
- package/dist/index.js +103 -93
- package/dist/package.json.js +2 -5
- package/dist/rules/sort-array-includes/types.d.ts +70 -0
- package/dist/rules/sort-array-includes/types.js +3 -7
- package/dist/rules/sort-array-includes.d.ts +38 -0
- package/dist/rules/sort-array-includes.js +106 -137
- package/dist/rules/sort-classes/get-overload-signature-groups.d.ts +10 -0
- package/dist/rules/sort-classes/get-overload-signature-groups.js +4 -6
- package/dist/rules/sort-classes/types.d.ts +103 -0
- package/dist/rules/sort-classes/types.js +10 -12
- package/dist/rules/sort-classes.d.ts +19 -0
- package/dist/rules/sort-classes.js +117 -127
- package/dist/rules/sort-decorators/types.d.ts +24 -0
- package/dist/rules/sort-decorators.d.ts +17 -0
- package/dist/rules/sort-decorators.js +133 -111
- package/dist/rules/sort-enums/build-comparator-by-options-computer.d.ts +16 -0
- package/dist/rules/sort-enums/build-comparator-by-options-computer.js +67 -0
- package/dist/rules/sort-enums/types.d.ts +52 -0
- package/dist/rules/sort-enums/types.js +3 -6
- package/dist/rules/sort-enums.d.ts +19 -0
- package/dist/rules/sort-enums.js +141 -192
- package/dist/rules/sort-export-attributes/types.d.ts +15 -0
- package/dist/rules/sort-export-attributes.d.ts +18 -0
- package/dist/rules/sort-export-attributes.js +178 -0
- package/dist/rules/sort-exports/types.d.ts +72 -0
- package/dist/rules/sort-exports/types.js +15 -11
- package/dist/rules/sort-exports.d.ts +20 -0
- package/dist/rules/sort-exports.js +143 -121
- package/dist/rules/sort-heritage-clauses/types.d.ts +11 -0
- package/dist/rules/sort-heritage-clauses.d.ts +17 -0
- package/dist/rules/sort-heritage-clauses.js +116 -64
- package/dist/rules/sort-import-attributes/types.d.ts +15 -0
- package/dist/rules/sort-import-attributes.d.ts +18 -0
- package/dist/rules/sort-import-attributes.js +178 -0
- package/dist/rules/sort-imports/comparator-by-options-computer.d.ts +6 -0
- package/dist/rules/sort-imports/comparator-by-options-computer.js +31 -0
- package/dist/rules/sort-imports/compute-common-selectors.d.ts +52 -0
- package/dist/rules/sort-imports/compute-common-selectors.js +52 -49
- package/dist/rules/sort-imports/compute-dependencies.d.ts +13 -0
- package/dist/rules/sort-imports/compute-dependencies.js +46 -0
- package/dist/rules/sort-imports/compute-dependency-names.d.ts +20 -0
- package/dist/rules/sort-imports/compute-dependency-names.js +28 -0
- package/dist/rules/sort-imports/compute-node-name.d.ts +20 -0
- package/dist/rules/sort-imports/compute-node-name.js +31 -0
- package/dist/rules/sort-imports/compute-specifier-modifiers.d.ts +15 -0
- package/dist/rules/sort-imports/compute-specifier-modifiers.js +25 -0
- package/dist/rules/sort-imports/get-typescript-import.d.ts +7 -0
- package/dist/rules/sort-imports/get-typescript-import.js +4 -18
- package/dist/rules/sort-imports/is-non-external-reference-ts-import-equals.d.ts +15 -0
- package/dist/rules/sort-imports/is-non-external-reference-ts-import-equals.js +8 -0
- package/dist/rules/sort-imports/is-side-effect-import.d.ts +20 -0
- package/dist/rules/sort-imports/is-side-effect-import.js +19 -0
- package/dist/rules/sort-imports/is-side-effect-only-group.d.ts +14 -0
- package/dist/rules/sort-imports/is-side-effect-only-group.js +9 -13
- package/dist/rules/sort-imports/is-string-group-side-effect-only-group.d.ts +12 -0
- package/dist/rules/sort-imports/is-string-group-side-effect-only-group.js +4 -0
- package/dist/rules/sort-imports/matches-tsconfig-paths.d.ts +20 -0
- package/dist/rules/sort-imports/matches-tsconfig-paths.js +6 -6
- package/dist/rules/sort-imports/read-closest-ts-config-by-path.d.ts +58 -0
- package/dist/rules/sort-imports/read-closest-ts-config-by-path.js +14 -42
- package/dist/rules/sort-imports/types.d.ts +148 -0
- package/dist/rules/sort-imports/types.js +15 -21
- package/dist/rules/sort-imports/validate-side-effects-configuration.d.ts +21 -0
- package/dist/rules/sort-imports/validate-side-effects-configuration.js +10 -11
- package/dist/rules/sort-imports.d.ts +22 -0
- package/dist/rules/sort-imports.js +224 -390
- package/dist/rules/sort-interfaces.d.ts +17 -0
- package/dist/rules/sort-interfaces.js +38 -43
- package/dist/rules/sort-intersection-types.d.ts +17 -0
- package/dist/rules/sort-intersection-types.js +25 -16
- package/dist/rules/sort-jsx-props/types.d.ts +93 -0
- package/dist/rules/sort-jsx-props/types.js +10 -12
- package/dist/rules/sort-jsx-props.d.ts +18 -0
- package/dist/rules/sort-jsx-props.js +130 -147
- package/dist/rules/sort-maps/types.d.ts +37 -0
- package/dist/rules/sort-maps.d.ts +18 -0
- package/dist/rules/sort-maps.js +93 -91
- package/dist/rules/sort-modules/types.d.ts +76 -0
- package/dist/rules/sort-modules/types.js +9 -11
- package/dist/rules/sort-modules.d.ts +20 -0
- package/dist/rules/sort-modules.js +136 -132
- package/dist/rules/sort-named-exports/types.d.ts +74 -0
- package/dist/rules/sort-named-exports/types.js +7 -10
- package/dist/rules/sort-named-exports.d.ts +17 -0
- package/dist/rules/sort-named-exports.js +96 -113
- package/dist/rules/sort-named-imports/types.d.ts +75 -0
- package/dist/rules/sort-named-imports/types.js +7 -10
- package/dist/rules/sort-named-imports.d.ts +17 -0
- package/dist/rules/sort-named-imports.js +96 -117
- package/dist/rules/sort-object-types/build-options-by-group-index-computer.d.ts +18 -0
- package/dist/rules/sort-object-types/build-options-by-group-index-computer.js +33 -0
- package/dist/rules/sort-object-types/comparator-by-options-computer.d.ts +6 -0
- package/dist/rules/sort-object-types/comparator-by-options-computer.js +36 -0
- package/dist/rules/sort-object-types/compute-matched-context-options.d.ts +24 -0
- package/dist/rules/sort-object-types/compute-matched-context-options.js +81 -0
- package/dist/rules/sort-object-types/compute-node-name.d.ts +17 -0
- package/dist/rules/sort-object-types/compute-node-name.js +46 -0
- package/dist/rules/sort-object-types/compute-node-parent-name.d.ts +13 -0
- package/dist/rules/sort-object-types/compute-node-parent-name.js +38 -0
- package/dist/rules/sort-object-types/is-member-optional.d.ts +17 -0
- package/dist/rules/sort-object-types/is-member-optional.js +11 -8
- package/dist/rules/sort-object-types/passes-declaration-comment-matches-filter.d.ts +21 -0
- package/dist/rules/sort-object-types/passes-declaration-comment-matches-filter.js +40 -0
- package/dist/rules/sort-object-types/passes-declaration-matches-pattern-filter.d.ts +22 -0
- package/dist/rules/sort-object-types/passes-declaration-matches-pattern-filter.js +19 -0
- package/dist/rules/sort-object-types/types.d.ts +174 -0
- package/dist/rules/sort-object-types/types.js +23 -18
- package/dist/rules/sort-object-types.d.ts +38 -0
- package/dist/rules/sort-object-types.js +229 -307
- package/dist/rules/sort-objects/compute-matched-context-options.d.ts +24 -0
- package/dist/rules/sort-objects/compute-matched-context-options.js +124 -0
- package/dist/rules/sort-objects/compute-property-or-variable-declarator-name.d.ts +17 -0
- package/dist/rules/sort-objects/compute-property-or-variable-declarator-name.js +24 -0
- package/dist/rules/sort-objects/is-style-node.d.ts +8 -0
- package/dist/rules/sort-objects/is-style-node.js +32 -0
- package/dist/rules/sort-objects/passes-calling-function-name-pattern-filter.d.ts +21 -0
- package/dist/rules/sort-objects/passes-calling-function-name-pattern-filter.js +18 -0
- package/dist/rules/sort-objects/passes-declaration-comment-matches-filter.d.ts +21 -0
- package/dist/rules/sort-objects/passes-declaration-comment-matches-filter.js +38 -0
- package/dist/rules/sort-objects/passes-declaration-matches-pattern-filter.d.ts +22 -0
- package/dist/rules/sort-objects/passes-declaration-matches-pattern-filter.js +25 -0
- package/dist/rules/sort-objects/types.d.ts +142 -0
- package/dist/rules/sort-objects/types.js +31 -12
- package/dist/rules/sort-objects.d.ts +9 -0
- package/dist/rules/sort-objects.js +202 -328
- package/dist/rules/sort-sets.d.ts +17 -0
- package/dist/rules/sort-sets.js +28 -22
- package/dist/rules/sort-switch-case.d.ts +10 -0
- package/dist/rules/sort-switch-case.js +85 -93
- package/dist/rules/sort-union-types/types.d.ts +55 -0
- package/dist/rules/sort-union-types/types.js +3 -7
- package/dist/rules/sort-union-types.d.ts +39 -0
- package/dist/rules/sort-union-types.js +99 -98
- package/dist/rules/sort-variable-declarations/types.d.ts +43 -0
- package/dist/rules/sort-variable-declarations/types.js +3 -7
- package/dist/rules/sort-variable-declarations.d.ts +22 -0
- package/dist/rules/sort-variable-declarations.js +115 -114
- package/dist/types/common-groups-options.d.ts +206 -0
- package/dist/types/common-options.d.ts +241 -0
- package/dist/types/common-partition-options.d.ts +55 -0
- package/dist/types/join.d.ts +19 -0
- package/dist/types/node-of-type.d.ts +5 -0
- package/dist/types/scoped-regex-option.d.ts +6 -0
- package/dist/types/scoped-regex-option.js +2 -0
- package/dist/types/sorting-node.d.ts +96 -0
- package/dist/utils/alphabet.d.ts +201 -0
- package/dist/utils/alphabet.js +127 -139
- package/dist/utils/build-default-options-by-group-index-computer.d.ts +29 -0
- package/dist/utils/build-default-options-by-group-index-computer.js +5 -0
- package/dist/utils/compare/build-line-length-comparator.d.ts +13 -0
- package/dist/utils/compare/build-line-length-comparator.js +10 -0
- package/dist/utils/compare/build-string-formatter.d.ts +29 -0
- package/dist/utils/compare/build-string-formatter.js +30 -0
- package/dist/utils/compare/compare-alphabetically.d.ts +29 -0
- package/dist/utils/compare/compare-alphabetically.js +15 -0
- package/dist/utils/compare/compare-by-custom-sort.d.ts +14 -0
- package/dist/utils/compare/compare-by-custom-sort.js +47 -0
- package/dist/utils/compare/compare-naturally.d.ts +30 -0
- package/dist/utils/compare/compare-naturally.js +19 -0
- package/dist/utils/compare/compute-comparators.d.ts +25 -0
- package/dist/utils/compare/compute-comparators.js +13 -0
- package/dist/utils/compare/compute-ordered-value.d.ts +15 -0
- package/dist/utils/compare/compute-ordered-value.js +13 -0
- package/dist/utils/compare/default-comparator-by-options-computer.d.ts +16 -0
- package/dist/utils/compare/default-comparator-by-options-computer.js +24 -0
- package/dist/utils/compare/unsorted-comparator.d.ts +3 -0
- package/dist/utils/compare/unsorted-comparator.js +2 -0
- package/dist/utils/complete.d.ts +33 -0
- package/dist/utils/complete.js +55 -8
- package/dist/utils/compute-group-name.d.ts +13 -0
- package/dist/utils/compute-group-name.js +22 -0
- package/dist/utils/compute-group.d.ts +69 -0
- package/dist/utils/compute-group.js +10 -32
- package/dist/utils/compute-groups-names.d.ts +8 -0
- package/dist/utils/compute-groups-names.js +25 -0
- package/dist/utils/compute-nodes-in-circular-dependencies.d.ts +33 -0
- package/dist/utils/compute-nodes-in-circular-dependencies.js +3 -5
- package/dist/utils/compute-overridden-options-by-group-index.d.ts +48 -0
- package/dist/utils/compute-overridden-options-by-group-index.js +30 -0
- package/dist/utils/compute-parent-nodes-with-types.d.ts +20 -0
- package/dist/utils/compute-parent-nodes-with-types.js +13 -0
- package/dist/utils/convert-boolean-to-sign.d.ts +21 -0
- package/dist/utils/convert-boolean-to-sign.js +4 -4
- package/dist/utils/create-eslint-rule.d.ts +48 -0
- package/dist/utils/create-eslint-rule.js +3 -5
- package/dist/utils/create-node-index-map.d.ts +27 -0
- package/dist/utils/create-node-index-map.js +2 -4
- package/dist/utils/does-custom-group-match.d.ts +119 -0
- package/dist/utils/does-custom-group-match.js +12 -20
- package/dist/utils/filter-options-by-all-names-match.d.ts +84 -0
- package/dist/utils/filter-options-by-all-names-match.js +11 -0
- package/dist/utils/generate-predefined-groups.d.ts +25 -0
- package/dist/utils/generate-predefined-groups.js +6 -8
- package/dist/utils/get-array-combinations.d.ts +11 -0
- package/dist/utils/get-array-combinations.js +3 -5
- package/dist/utils/get-comment-above-that-should-exist.d.ts +77 -0
- package/dist/utils/get-comment-above-that-should-exist.js +19 -20
- package/dist/utils/get-comments-before.d.ts +24 -0
- package/dist/utils/get-comments-before.js +10 -15
- package/dist/utils/get-decorator-name.d.ts +36 -0
- package/dist/utils/get-decorator-name.js +2 -4
- package/dist/utils/get-enum-members.d.ts +25 -0
- package/dist/utils/get-enum-members.js +6 -6
- package/dist/utils/get-eslint-disabled-lines.d.ts +44 -0
- package/dist/utils/get-eslint-disabled-lines.js +13 -16
- package/dist/utils/get-eslint-disabled-rules.d.ts +48 -0
- package/dist/utils/get-eslint-disabled-rules.js +5 -8
- package/dist/utils/get-group-index.d.ts +38 -0
- package/dist/utils/get-group-index.js +24 -10
- package/dist/utils/get-lines-between.d.ts +38 -0
- package/dist/utils/get-lines-between.js +2 -4
- package/dist/utils/get-newlines-between-errors.d.ts +102 -0
- package/dist/utils/get-newlines-between-errors.js +12 -20
- package/dist/utils/get-newlines-between-option.d.ts +37 -0
- package/dist/utils/get-newlines-between-option.js +88 -102
- package/dist/utils/get-node-decorators.d.ts +33 -0
- package/dist/utils/get-node-decorators.js +7 -4
- package/dist/utils/get-node-range.d.ts +79 -0
- package/dist/utils/get-node-range.js +16 -25
- package/dist/utils/get-options-with-clean-groups.d.ts +55 -0
- package/dist/utils/get-options-with-clean-groups.js +16 -13
- package/dist/utils/get-settings.d.ts +54 -0
- package/dist/utils/get-settings.js +3 -6
- package/dist/utils/is-group-with-overrides-option.d.ts +33 -0
- package/dist/utils/is-group-with-overrides-option.js +4 -0
- package/dist/utils/is-newlines-between-option.d.ts +37 -0
- package/dist/utils/is-newlines-between-option.js +4 -5
- package/dist/utils/is-node-dependent-on-other-node.d.ts +42 -0
- package/dist/utils/is-node-dependent-on-other-node.js +2 -4
- package/dist/utils/is-node-eslint-disabled.d.ts +29 -0
- package/dist/utils/is-node-eslint-disabled.js +4 -5
- package/dist/utils/is-node-function-type.d.ts +48 -0
- package/dist/utils/is-node-function-type.js +2 -4
- package/dist/utils/is-node-on-single-line.d.ts +8 -0
- package/dist/utils/is-node-on-single-line.js +4 -0
- package/dist/utils/is-partition-comment.d.ts +64 -0
- package/dist/utils/is-partition-comment.js +10 -22
- package/dist/utils/is-sortable.d.ts +7 -0
- package/dist/utils/is-sortable.js +4 -4
- package/dist/utils/json-schemas/common-groups-json-schemas.d.ts +99 -0
- package/dist/utils/json-schemas/common-groups-json-schemas.js +201 -0
- package/dist/utils/json-schemas/common-json-schemas.d.ts +70 -0
- package/dist/utils/json-schemas/common-json-schemas.js +144 -0
- package/dist/utils/json-schemas/common-partition-json-schemas.d.ts +11 -0
- package/dist/utils/json-schemas/common-partition-json-schemas.js +35 -0
- package/dist/utils/json-schemas/scoped-regex-json-schema.d.ts +2 -0
- package/dist/utils/json-schemas/scoped-regex-json-schema.js +11 -0
- package/dist/utils/make-comment-above-fixes.d.ts +48 -0
- package/dist/utils/make-comment-above-fixes.js +25 -32
- package/dist/utils/make-comment-after-fixes.d.ts +46 -0
- package/dist/utils/make-comment-after-fixes.js +4 -6
- package/dist/utils/make-fixes.d.ts +93 -0
- package/dist/utils/make-fixes.js +13 -18
- package/dist/utils/make-newlines-between-fixes.d.ts +74 -0
- package/dist/utils/make-newlines-between-fixes.js +28 -38
- package/dist/utils/make-order-fixes.d.ts +70 -0
- package/dist/utils/make-order-fixes.js +8 -12
- package/dist/utils/make-single-node-comment-after-fixes.d.ts +46 -0
- package/dist/utils/make-single-node-comment-after-fixes.js +6 -10
- package/dist/utils/matches.d.ts +41 -0
- package/dist/utils/matches.js +2 -4
- package/dist/utils/pairwise.d.ts +32 -0
- package/dist/utils/pairwise.js +2 -4
- package/dist/utils/range-to-diff.d.ts +34 -0
- package/dist/utils/range-to-diff.js +2 -4
- package/dist/utils/report-all-errors.d.ts +181 -0
- package/dist/utils/report-all-errors.js +30 -40
- package/dist/utils/report-errors.d.ts +101 -0
- package/dist/utils/report-errors.js +21 -22
- package/dist/utils/scoped-regex/matches-scoped-expressions.d.ts +30 -0
- package/dist/utils/scoped-regex/matches-scoped-expressions.js +75 -0
- package/dist/utils/scoped-regex/partition-patterns-by-scope.d.ts +20 -0
- package/dist/utils/scoped-regex/partition-patterns-by-scope.js +33 -0
- package/dist/utils/should-partition.d.ts +68 -0
- package/dist/utils/should-partition.js +12 -13
- package/dist/utils/sort-nodes-by-dependencies.d.ts +99 -0
- package/dist/utils/sort-nodes-by-dependencies.js +7 -15
- package/dist/utils/sort-nodes-by-groups.d.ts +103 -0
- package/dist/utils/sort-nodes-by-groups.js +23 -24
- package/dist/utils/sort-nodes.d.ts +47 -0
- package/dist/utils/sort-nodes.js +16 -18
- package/dist/utils/unreachable-case-error.d.ts +40 -0
- package/dist/utils/unreachable-case-error.js +8 -3
- package/dist/utils/validate-custom-sort-configuration.d.ts +21 -0
- package/dist/utils/validate-custom-sort-configuration.js +19 -6
- package/dist/utils/validate-groups-configuration.d.ts +74 -0
- package/dist/utils/{validate-generated-groups-configuration.js → validate-groups-configuration.js} +16 -27
- package/dist/utils/validate-newlines-and-partition-configuration.d.ts +92 -0
- package/dist/utils/validate-newlines-and-partition-configuration.js +5 -8
- package/dist/utils/validate-no-duplicated-groups.d.ts +13 -0
- package/dist/utils/validate-no-duplicated-groups.js +8 -17
- package/dist/utils/validate-objects-inside-groups.d.ts +55 -0
- package/dist/utils/validate-objects-inside-groups.js +10 -12
- package/package.json +4 -8
- package/readme.md +2 -0
- package/dist/rules/sort-maps/types.js +0 -7
- package/dist/rules/sort-object-types/build-node-value-getter.js +0 -5
- package/dist/rules/sort-object-types/get-custom-groups-compare-options.js +0 -44
- package/dist/rules/sort-objects/get-first-node-parent-with-type.js +0 -16
- package/dist/utils/common-json-schemas.js +0 -302
- package/dist/utils/compare.js +0 -159
- package/dist/utils/get-custom-groups-compare-options.js +0 -47
- package/dist/utils/get-matching-context-options.js +0 -18
- package/dist/utils/is-comment-above-option.js +0 -5
package/dist/alphabet.d.ts
CHANGED
|
@@ -1,175 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Utility class to build alphabets
|
|
3
|
-
*/
|
|
4
|
-
export declare class Alphabet {
|
|
5
|
-
private _characters
|
|
6
|
-
private constructor()
|
|
7
|
-
/**
|
|
8
|
-
* Generates an alphabet from the given characters.
|
|
9
|
-
* @param {string|string[]} values - The characters to generate the alphabet from
|
|
10
|
-
* @returns {Alphabet} - The wrapped alphabet
|
|
11
|
-
*/
|
|
12
|
-
static generateFrom(values: string[] | string): Alphabet
|
|
13
|
-
/**
|
|
14
|
-
* Generates an alphabet containing relevant characters from the Unicode
|
|
15
|
-
* standard. Contains the Unicode planes 0 and 1.
|
|
16
|
-
* @returns {Alphabet} - The generated alphabet
|
|
17
|
-
*/
|
|
18
|
-
static generateRecommendedAlphabet(): Alphabet
|
|
19
|
-
/**
|
|
20
|
-
* Generates an alphabet containing all characters from the Unicode standard
|
|
21
|
-
* except for irrelevant Unicode planes.
|
|
22
|
-
* Contains the Unicode planes 0, 1, 2 and 3.
|
|
23
|
-
* @returns {Alphabet} - The generated alphabet
|
|
24
|
-
*/
|
|
25
|
-
static generateCompleteAlphabet(): Alphabet
|
|
26
|
-
private static _convertCodepointToCharacter
|
|
27
|
-
/**
|
|
28
|
-
* Generates an alphabet containing relevant characters from the Unicode
|
|
29
|
-
* standard.
|
|
30
|
-
* @param {number} maxCodePoint - The maximum code point to generate the
|
|
31
|
-
* alphabet to
|
|
32
|
-
* @returns {Alphabet} - The generated alphabet
|
|
33
|
-
*/
|
|
34
|
-
private static _generateAlphabetToRange
|
|
35
|
-
/**
|
|
36
|
-
* For each character with a lower and upper case, permutes the two cases
|
|
37
|
-
* so that the alphabet is ordered by the case priority entered.
|
|
38
|
-
* @param {string} casePriority - The case to prioritize
|
|
39
|
-
* @returns {Alphabet} - The same alphabet instance with the cases prioritized
|
|
40
|
-
* @example
|
|
41
|
-
* Alphabet.generateFrom('aAbBcdCD')
|
|
42
|
-
* .prioritizeCase('uppercase') // Returns 'AaBbCDcd'.
|
|
43
|
-
*/
|
|
44
|
-
prioritizeCase(casePriority: 'lowercase' | 'uppercase'): this
|
|
45
|
-
/**
|
|
46
|
-
* Adds specific characters to the end of the alphabet.
|
|
47
|
-
* @param {string|string[]} values - The characters to push to the alphabet
|
|
48
|
-
* @returns {Alphabet} - The same alphabet instance without the specified
|
|
49
|
-
* characters
|
|
50
|
-
* @example
|
|
51
|
-
* Alphabet.generateFrom('ab')
|
|
52
|
-
* .pushCharacters('cd')
|
|
53
|
-
* // Returns 'abcd'
|
|
54
|
-
*/
|
|
55
|
-
pushCharacters(values: string[] | string): this
|
|
56
|
-
/**
|
|
57
|
-
* Permutes characters with cases so that all characters with the entered case
|
|
58
|
-
* are put before the other characters.
|
|
59
|
-
* @param {string} caseToComeFirst - The case to put before the other
|
|
60
|
-
* characters
|
|
61
|
-
* @returns {Alphabet} - The same alphabet instance with all characters with
|
|
62
|
-
* case before all the characters with the other case
|
|
63
|
-
*/
|
|
64
|
-
placeAllWithCaseBeforeAllWithOtherCase(
|
|
65
|
-
caseToComeFirst: 'uppercase' | 'lowercase',
|
|
66
|
-
): this
|
|
67
|
-
/**
|
|
68
|
-
* Places a specific character right before another character in the alphabet.
|
|
69
|
-
* @param {object} params - The parameters for the operation
|
|
70
|
-
* @param {string} params.characterBefore - The character to come before
|
|
71
|
-
* characterAfter
|
|
72
|
-
* @param {string} params.characterAfter - The target character
|
|
73
|
-
* @returns {Alphabet} - The same alphabet instance with the specific
|
|
74
|
-
* character prioritized
|
|
75
|
-
* @example
|
|
76
|
-
* Alphabet.generateFrom('ab-cd/')
|
|
77
|
-
* .placeCharacterBefore({ characterBefore: '/', characterAfter: '-' })
|
|
78
|
-
* // Returns 'ab/-cd'
|
|
79
|
-
*/
|
|
80
|
-
placeCharacterBefore({
|
|
81
|
-
characterBefore,
|
|
82
|
-
characterAfter,
|
|
83
|
-
}: {
|
|
84
|
-
characterBefore: string
|
|
85
|
-
characterAfter: string
|
|
86
|
-
}): this
|
|
87
|
-
/**
|
|
88
|
-
* Places a specific character right after another character in the alphabet.
|
|
89
|
-
* @param {object} params - The parameters for the operation
|
|
90
|
-
* @param {string} params.characterBefore - The target character
|
|
91
|
-
* @param {string} params.characterAfter - The character to come after
|
|
92
|
-
* characterBefore
|
|
93
|
-
* @returns {Alphabet} - The same alphabet instance with the specific
|
|
94
|
-
* character prioritized
|
|
95
|
-
* @example
|
|
96
|
-
* Alphabet.generateFrom('ab-cd/')
|
|
97
|
-
* .placeCharacterAfter({ characterBefore: '/', characterAfter: '-' })
|
|
98
|
-
* // Returns 'abcd/-'
|
|
99
|
-
*/
|
|
100
|
-
placeCharacterAfter({
|
|
101
|
-
characterBefore,
|
|
102
|
-
characterAfter,
|
|
103
|
-
}: {
|
|
104
|
-
characterBefore: string
|
|
105
|
-
characterAfter: string
|
|
106
|
-
}): this
|
|
107
|
-
/**
|
|
108
|
-
* Removes specific characters from the alphabet by their range.
|
|
109
|
-
* @param {object} range - The Unicode range to remove characters from
|
|
110
|
-
* @param {number} range.start - The starting Unicode codepoint
|
|
111
|
-
* @param {number} range.end - The ending Unicode codepoint
|
|
112
|
-
* @returns {Alphabet} - The same alphabet instance without the characters
|
|
113
|
-
* from the specified range
|
|
114
|
-
*/
|
|
115
|
-
removeUnicodeRange({ start, end }: { start: number; end: number }): this
|
|
116
|
-
/**
|
|
117
|
-
* Sorts the alphabet by the sorting function provided.
|
|
118
|
-
* @param {Function} sortingFunction - The sorting function to use
|
|
119
|
-
* @returns {Alphabet} - The same alphabet instance sorted by the sorting function provided
|
|
120
|
-
*/
|
|
121
|
-
sortBy(
|
|
122
|
-
sortingFunction: (characterA: string, characterB: string) => number,
|
|
123
|
-
): this
|
|
124
|
-
/**
|
|
125
|
-
* Removes specific characters from the alphabet.
|
|
126
|
-
* @param {string|string[]} values - The characters to remove from the
|
|
127
|
-
* alphabet
|
|
128
|
-
* @returns {Alphabet} - The same alphabet instance without the specified
|
|
129
|
-
* characters
|
|
130
|
-
* @example
|
|
131
|
-
* Alphabet.generateFrom('abcd')
|
|
132
|
-
* .removeCharacters('dcc')
|
|
133
|
-
* // Returns 'ab'
|
|
134
|
-
*/
|
|
135
|
-
removeCharacters(values: string[] | string): this
|
|
136
|
-
/**
|
|
137
|
-
* Sorts the alphabet by the natural order of the characters using
|
|
138
|
-
* `natural-orderby`.
|
|
139
|
-
* @param {string} locale - The locale to use for sorting
|
|
140
|
-
* @returns {Alphabet} - The same alphabet instance sorted by the natural
|
|
141
|
-
* order of the characters
|
|
142
|
-
*/
|
|
143
|
-
sortByNaturalSort(locale?: string): this
|
|
144
|
-
/**
|
|
145
|
-
* Sorts the alphabet by the character code point.
|
|
146
|
-
* @returns {Alphabet} - The same alphabet instance sorted by the character
|
|
147
|
-
* code point
|
|
148
|
-
*/
|
|
149
|
-
sortByCharCodeAt(): this
|
|
150
|
-
/**
|
|
151
|
-
* Sorts the alphabet by the locale order of the characters.
|
|
152
|
-
* @param {Intl.LocalesArgument} locales - The locales to use for sorting
|
|
153
|
-
* @returns {Alphabet} - The same alphabet instance sorted by the locale
|
|
154
|
-
* order of the characters
|
|
155
|
-
*/
|
|
156
|
-
sortByLocaleCompare(locales?: Intl.LocalesArgument): this
|
|
157
|
-
/**
|
|
158
|
-
* Retrieves the characters from the alphabet.
|
|
159
|
-
* @returns {string} The characters from the alphabet
|
|
160
|
-
*/
|
|
161
|
-
getCharacters(): string
|
|
162
|
-
/**
|
|
163
|
-
* Reverses the alphabet.
|
|
164
|
-
* @returns {Alphabet} - The same alphabet instance reversed
|
|
165
|
-
* @example
|
|
166
|
-
* Alphabet.generateFrom('ab')
|
|
167
|
-
* .reverse()
|
|
168
|
-
* // Returns 'ba'
|
|
169
|
-
*/
|
|
170
|
-
reverse(): this
|
|
171
|
-
private _placeCharacterBeforeOrAfter
|
|
172
|
-
private _getCharactersWithCase
|
|
173
|
-
}
|
|
174
|
-
|
|
1
|
+
export * from './utils/alphabet'
|
|
175
2
|
export {}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { Linter } from 'eslint'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare const _default: PluginConfig
|
|
5
|
-
|
|
6
|
-
declare interface PluginConfig {
|
|
1
|
+
import { Linter, Rule } from 'eslint'
|
|
2
|
+
interface PluginConfig {
|
|
7
3
|
rules: {
|
|
8
4
|
'sort-variable-declarations': Rule.RuleModule
|
|
9
5
|
'sort-intersection-types': Rule.RuleModule
|
|
6
|
+
'sort-import-attributes': Rule.RuleModule
|
|
7
|
+
'sort-export-attributes': Rule.RuleModule
|
|
10
8
|
'sort-heritage-clauses': Rule.RuleModule
|
|
11
9
|
'sort-array-includes': Rule.RuleModule
|
|
12
10
|
'sort-named-imports': Rule.RuleModule
|
|
@@ -41,6 +39,208 @@ declare interface PluginConfig {
|
|
|
41
39
|
name: string
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
export declare let rules: {
|
|
43
|
+
'sort-variable-declarations': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
44
|
+
| 'unexpectedVariableDeclarationsOrder'
|
|
45
|
+
| 'unexpectedVariableDeclarationsGroupOrder'
|
|
46
|
+
| 'extraSpacingBetweenVariableDeclarationsMembers'
|
|
47
|
+
| 'missedSpacingBetweenVariableDeclarationsMembers'
|
|
48
|
+
| 'unexpectedVariableDeclarationsDependencyOrder',
|
|
49
|
+
import('./rules/sort-variable-declarations/types').Options,
|
|
50
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
51
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
52
|
+
>
|
|
53
|
+
'sort-intersection-types': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
54
|
+
| 'unexpectedIntersectionTypesOrder'
|
|
55
|
+
| 'unexpectedIntersectionTypesGroupOrder'
|
|
56
|
+
| 'extraSpacingBetweenIntersectionTypes'
|
|
57
|
+
| 'missedSpacingBetweenIntersectionTypes',
|
|
58
|
+
import('./rules/sort-union-types/types').Options,
|
|
59
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
60
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
61
|
+
>
|
|
62
|
+
'sort-import-attributes': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
63
|
+
| 'unexpectedImportAttributesOrder'
|
|
64
|
+
| 'unexpectedImportAttributesGroupOrder'
|
|
65
|
+
| 'extraSpacingBetweenImportAttributes'
|
|
66
|
+
| 'missedSpacingBetweenImportAttributes',
|
|
67
|
+
import('./rules/sort-import-attributes/types').Options,
|
|
68
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
69
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
70
|
+
>
|
|
71
|
+
'sort-export-attributes': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
72
|
+
| 'unexpectedExportAttributesOrder'
|
|
73
|
+
| 'unexpectedExportAttributesGroupOrder'
|
|
74
|
+
| 'extraSpacingBetweenExportAttributes'
|
|
75
|
+
| 'missedSpacingBetweenExportAttributes',
|
|
76
|
+
import('./rules/sort-export-attributes/types').Options,
|
|
77
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
78
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
79
|
+
>
|
|
80
|
+
'sort-heritage-clauses': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
81
|
+
| 'unexpectedHeritageClausesOrder'
|
|
82
|
+
| 'unexpectedHeritageClausesGroupOrder'
|
|
83
|
+
| 'extraSpacingBetweenHeritageClauses'
|
|
84
|
+
| 'missedSpacingBetweenHeritageClauses',
|
|
85
|
+
import('./rules/sort-heritage-clauses/types').Options,
|
|
86
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
87
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
88
|
+
>
|
|
89
|
+
'sort-array-includes': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
90
|
+
| 'unexpectedArrayIncludesOrder'
|
|
91
|
+
| 'unexpectedArrayIncludesGroupOrder'
|
|
92
|
+
| 'extraSpacingBetweenArrayIncludesMembers'
|
|
93
|
+
| 'missedSpacingBetweenArrayIncludesMembers',
|
|
94
|
+
import('./rules/sort-array-includes/types').Options,
|
|
95
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
96
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
97
|
+
>
|
|
98
|
+
'sort-named-imports': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
99
|
+
| 'unexpectedNamedImportsOrder'
|
|
100
|
+
| 'unexpectedNamedImportsGroupOrder'
|
|
101
|
+
| 'extraSpacingBetweenNamedImports'
|
|
102
|
+
| 'missedSpacingBetweenNamedImports',
|
|
103
|
+
import('./rules/sort-named-imports/types').Options,
|
|
104
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
105
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
106
|
+
>
|
|
107
|
+
'sort-named-exports': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
108
|
+
| 'unexpectedNamedExportsOrder'
|
|
109
|
+
| 'unexpectedNamedExportsGroupOrder'
|
|
110
|
+
| 'extraSpacingBetweenNamedExports'
|
|
111
|
+
| 'missedSpacingBetweenNamedExports',
|
|
112
|
+
import('./rules/sort-named-exports/types').Options,
|
|
113
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
114
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
115
|
+
>
|
|
116
|
+
'sort-object-types': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
117
|
+
| 'unexpectedObjectTypesOrder'
|
|
118
|
+
| 'unexpectedObjectTypesGroupOrder'
|
|
119
|
+
| 'extraSpacingBetweenObjectTypeMembers'
|
|
120
|
+
| 'missedSpacingBetweenObjectTypeMembers',
|
|
121
|
+
import('./rules/sort-object-types/types').Options,
|
|
122
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
123
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
124
|
+
>
|
|
125
|
+
'sort-union-types': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
126
|
+
| 'unexpectedUnionTypesOrder'
|
|
127
|
+
| 'unexpectedUnionTypesGroupOrder'
|
|
128
|
+
| 'extraSpacingBetweenUnionTypes'
|
|
129
|
+
| 'missedSpacingBetweenUnionTypes',
|
|
130
|
+
import('./rules/sort-union-types/types').Options,
|
|
131
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
132
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
133
|
+
>
|
|
134
|
+
'sort-switch-case': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
135
|
+
'unexpectedSwitchCaseOrder',
|
|
136
|
+
[
|
|
137
|
+
Partial<
|
|
138
|
+
import('./types/common-options').CommonOptions<
|
|
139
|
+
import('./types/common-options').TypeOption
|
|
140
|
+
>
|
|
141
|
+
>,
|
|
142
|
+
],
|
|
143
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
144
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
145
|
+
>
|
|
146
|
+
'sort-decorators': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
147
|
+
| 'unexpectedDecoratorsOrder'
|
|
148
|
+
| 'unexpectedDecoratorsGroupOrder'
|
|
149
|
+
| 'extraSpacingBetweenDecorators'
|
|
150
|
+
| 'missedSpacingBetweenDecorators',
|
|
151
|
+
import('./rules/sort-decorators/types').Options,
|
|
152
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
153
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
154
|
+
>
|
|
155
|
+
'sort-interfaces': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
156
|
+
| 'unexpectedInterfacePropertiesOrder'
|
|
157
|
+
| 'unexpectedInterfacePropertiesGroupOrder'
|
|
158
|
+
| 'extraSpacingBetweenInterfaceMembers'
|
|
159
|
+
| 'missedSpacingBetweenInterfaceMembers',
|
|
160
|
+
import('./rules/sort-object-types/types').Options,
|
|
161
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
162
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
163
|
+
>
|
|
164
|
+
'sort-jsx-props': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
165
|
+
| 'unexpectedJSXPropsOrder'
|
|
166
|
+
| 'unexpectedJSXPropsGroupOrder'
|
|
167
|
+
| 'extraSpacingBetweenJSXPropsMembers'
|
|
168
|
+
| 'missedSpacingBetweenJSXPropsMembers',
|
|
169
|
+
import('./rules/sort-jsx-props/types').Options,
|
|
170
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
171
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
172
|
+
>
|
|
173
|
+
'sort-modules': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
174
|
+
| 'unexpectedModulesOrder'
|
|
175
|
+
| 'unexpectedModulesGroupOrder'
|
|
176
|
+
| 'extraSpacingBetweenModulesMembers'
|
|
177
|
+
| 'missedSpacingBetweenModulesMembers'
|
|
178
|
+
| 'unexpectedModulesDependencyOrder',
|
|
179
|
+
import('./rules/sort-modules/types').SortModulesOptions,
|
|
180
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
181
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
182
|
+
>
|
|
183
|
+
'sort-classes': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
184
|
+
| 'unexpectedClassesOrder'
|
|
185
|
+
| 'unexpectedClassesGroupOrder'
|
|
186
|
+
| 'extraSpacingBetweenClassMembers'
|
|
187
|
+
| 'missedSpacingBetweenClassMembers'
|
|
188
|
+
| 'unexpectedClassesDependencyOrder',
|
|
189
|
+
import('./rules/sort-classes/types').SortClassesOptions,
|
|
190
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
191
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
192
|
+
>
|
|
193
|
+
'sort-imports': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
194
|
+
import('./rules/sort-imports').MessageId,
|
|
195
|
+
import('./rules/sort-imports/types').Options,
|
|
196
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
197
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
198
|
+
>
|
|
199
|
+
'sort-exports': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
200
|
+
| 'unexpectedExportsOrder'
|
|
201
|
+
| 'unexpectedExportsGroupOrder'
|
|
202
|
+
| 'extraSpacingBetweenExports'
|
|
203
|
+
| 'missedSpacingBetweenExports'
|
|
204
|
+
| 'missedCommentAboveExport',
|
|
205
|
+
import('./rules/sort-exports/types').Options,
|
|
206
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
207
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
208
|
+
>
|
|
209
|
+
'sort-objects': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
210
|
+
import('./rules/sort-objects/types').MessageId,
|
|
211
|
+
import('./rules/sort-objects/types').Options,
|
|
212
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
213
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
214
|
+
>
|
|
215
|
+
'sort-enums': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
216
|
+
| 'unexpectedEnumsOrder'
|
|
217
|
+
| 'unexpectedEnumsGroupOrder'
|
|
218
|
+
| 'extraSpacingBetweenEnumsMembers'
|
|
219
|
+
| 'missedSpacingBetweenEnumsMembers'
|
|
220
|
+
| 'unexpectedEnumsDependencyOrder',
|
|
221
|
+
import('./rules/sort-enums/types').Options,
|
|
222
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
223
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
224
|
+
>
|
|
225
|
+
'sort-sets': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
226
|
+
| 'unexpectedSetsOrder'
|
|
227
|
+
| 'unexpectedSetsGroupOrder'
|
|
228
|
+
| 'extraSpacingBetweenSetsMembers'
|
|
229
|
+
| 'missedSpacingBetweenSetsMembers',
|
|
230
|
+
import('./rules/sort-array-includes/types').Options,
|
|
231
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
232
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
233
|
+
>
|
|
234
|
+
'sort-maps': import('@typescript-eslint/utils/ts-eslint').RuleModule<
|
|
235
|
+
| 'unexpectedMapElementsOrder'
|
|
236
|
+
| 'unexpectedMapElementsGroupOrder'
|
|
237
|
+
| 'extraSpacingBetweenMapElementsMembers'
|
|
238
|
+
| 'missedSpacingBetweenMapElementsMembers',
|
|
239
|
+
import('./rules/sort-maps/types').Options,
|
|
240
|
+
import('./utils/create-eslint-rule').ESLintPluginDocumentation,
|
|
241
|
+
import('@typescript-eslint/utils/ts-eslint').RuleListener
|
|
242
|
+
>
|
|
243
|
+
}
|
|
244
|
+
export declare let configs: PluginConfig['configs']
|
|
245
|
+
declare const _default: PluginConfig
|
|
246
|
+
export default _default
|
package/dist/index.js
CHANGED
|
@@ -1,106 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { name, version } from './package.json.js'
|
|
2
|
+
import sortVariableDeclarations from './rules/sort-variable-declarations.js'
|
|
3
|
+
import sortIntersectionTypes from './rules/sort-intersection-types.js'
|
|
4
|
+
import sortImportAttributes from './rules/sort-import-attributes.js'
|
|
5
|
+
import sortExportAttributes from './rules/sort-export-attributes.js'
|
|
6
|
+
import sortHeritageClauses from './rules/sort-heritage-clauses.js'
|
|
7
|
+
import sortArrayIncludes from './rules/sort-array-includes.js'
|
|
8
|
+
import sortNamedImports from './rules/sort-named-imports.js'
|
|
9
|
+
import sortNamedExports from './rules/sort-named-exports.js'
|
|
10
|
+
import sortObjectTypes from './rules/sort-object-types.js'
|
|
11
|
+
import sortSwitchCase from './rules/sort-switch-case.js'
|
|
12
|
+
import sortUnionTypes from './rules/sort-union-types.js'
|
|
13
|
+
import sortInterfaces from './rules/sort-interfaces.js'
|
|
14
|
+
import sortDecorators from './rules/sort-decorators.js'
|
|
15
|
+
import sortJsxProps from './rules/sort-jsx-props.js'
|
|
16
|
+
import sortClasses from './rules/sort-classes.js'
|
|
17
|
+
import sortImports from './rules/sort-imports.js'
|
|
18
|
+
import sortExports from './rules/sort-exports.js'
|
|
19
|
+
import sortObjects from './rules/sort-objects.js'
|
|
20
|
+
import sortModules from './rules/sort-modules.js'
|
|
21
|
+
import sortEnums from './rules/sort-enums.js'
|
|
22
|
+
import sortMaps from './rules/sort-maps.js'
|
|
23
|
+
import sortSets from './rules/sort-sets.js'
|
|
23
24
|
let pluginName = 'perfectionist'
|
|
25
|
+
let rules = {
|
|
26
|
+
'sort-variable-declarations': sortVariableDeclarations,
|
|
27
|
+
'sort-intersection-types': sortIntersectionTypes,
|
|
28
|
+
'sort-import-attributes': sortImportAttributes,
|
|
29
|
+
'sort-export-attributes': sortExportAttributes,
|
|
30
|
+
'sort-heritage-clauses': sortHeritageClauses,
|
|
31
|
+
'sort-array-includes': sortArrayIncludes,
|
|
32
|
+
'sort-named-imports': sortNamedImports,
|
|
33
|
+
'sort-named-exports': sortNamedExports,
|
|
34
|
+
'sort-object-types': sortObjectTypes,
|
|
35
|
+
'sort-union-types': sortUnionTypes,
|
|
36
|
+
'sort-switch-case': sortSwitchCase,
|
|
37
|
+
'sort-decorators': sortDecorators,
|
|
38
|
+
'sort-interfaces': sortInterfaces,
|
|
39
|
+
'sort-jsx-props': sortJsxProps,
|
|
40
|
+
'sort-modules': sortModules,
|
|
41
|
+
'sort-classes': sortClasses,
|
|
42
|
+
'sort-imports': sortImports,
|
|
43
|
+
'sort-exports': sortExports,
|
|
44
|
+
'sort-objects': sortObjects,
|
|
45
|
+
'sort-enums': sortEnums,
|
|
46
|
+
'sort-sets': sortSets,
|
|
47
|
+
'sort-maps': sortMaps,
|
|
48
|
+
}
|
|
24
49
|
let plugin = {
|
|
25
|
-
rules: {
|
|
26
|
-
'sort-variable-declarations': sortVariableDeclarations,
|
|
27
|
-
'sort-intersection-types': sortIntersectionTypes,
|
|
28
|
-
'sort-heritage-clauses': sortHeritageClauses,
|
|
29
|
-
'sort-array-includes': sortArrayIncludes.default,
|
|
30
|
-
'sort-named-imports': sortNamedImports,
|
|
31
|
-
'sort-named-exports': sortNamedExports,
|
|
32
|
-
'sort-object-types': sortObjectTypes.default,
|
|
33
|
-
'sort-union-types': sortUnionTypes.default,
|
|
34
|
-
'sort-switch-case': sortSwitchCase,
|
|
35
|
-
'sort-decorators': sortDecorators,
|
|
36
|
-
'sort-interfaces': sortInterfaces,
|
|
37
|
-
'sort-jsx-props': sortJsxProps,
|
|
38
|
-
'sort-modules': sortModules,
|
|
39
|
-
'sort-classes': sortClasses,
|
|
40
|
-
'sort-imports': sortImports,
|
|
41
|
-
'sort-exports': sortExports,
|
|
42
|
-
'sort-objects': sortObjects,
|
|
43
|
-
'sort-enums': sortEnums,
|
|
44
|
-
'sort-sets': sortSets,
|
|
45
|
-
'sort-maps': sortMaps,
|
|
46
|
-
},
|
|
47
50
|
meta: {
|
|
48
|
-
version
|
|
49
|
-
name
|
|
51
|
+
version,
|
|
52
|
+
name,
|
|
50
53
|
},
|
|
54
|
+
rules,
|
|
51
55
|
}
|
|
52
|
-
|
|
53
|
-
Object.fromEntries(
|
|
56
|
+
function getRules(options) {
|
|
57
|
+
return Object.fromEntries(
|
|
54
58
|
Object.keys(plugin.rules).map(ruleName => [
|
|
55
59
|
`${pluginName}/${ruleName}`,
|
|
56
60
|
['error', options],
|
|
57
61
|
]),
|
|
58
62
|
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
}
|
|
64
|
+
function createConfig(options) {
|
|
65
|
+
return {
|
|
66
|
+
plugins: {
|
|
67
|
+
[pluginName]: plugin,
|
|
68
|
+
},
|
|
69
|
+
rules: getRules(options),
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function createLegacyConfig(options) {
|
|
73
|
+
return {
|
|
74
|
+
rules: getRules(options),
|
|
75
|
+
plugins: [pluginName],
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
let configs = {
|
|
79
|
+
'recommended-alphabetical-legacy': createLegacyConfig({
|
|
80
|
+
type: 'alphabetical',
|
|
81
|
+
order: 'asc',
|
|
82
|
+
}),
|
|
83
|
+
'recommended-line-length-legacy': createLegacyConfig({
|
|
84
|
+
type: 'line-length',
|
|
85
|
+
order: 'desc',
|
|
86
|
+
}),
|
|
87
|
+
'recommended-natural-legacy': createLegacyConfig({
|
|
88
|
+
type: 'natural',
|
|
89
|
+
order: 'asc',
|
|
90
|
+
}),
|
|
91
|
+
'recommended-custom-legacy': createLegacyConfig({
|
|
92
|
+
type: 'custom',
|
|
93
|
+
order: 'asc',
|
|
94
|
+
}),
|
|
95
|
+
'recommended-alphabetical': createConfig({
|
|
96
|
+
type: 'alphabetical',
|
|
97
|
+
order: 'asc',
|
|
98
|
+
}),
|
|
99
|
+
'recommended-line-length': createConfig({
|
|
100
|
+
type: 'line-length',
|
|
101
|
+
order: 'desc',
|
|
102
|
+
}),
|
|
103
|
+
'recommended-natural': createConfig({
|
|
104
|
+
type: 'natural',
|
|
105
|
+
order: 'asc',
|
|
106
|
+
}),
|
|
107
|
+
'recommended-custom': createConfig({
|
|
108
|
+
type: 'custom',
|
|
109
|
+
order: 'asc',
|
|
110
|
+
}),
|
|
111
|
+
}
|
|
69
112
|
const index = {
|
|
70
113
|
...plugin,
|
|
71
|
-
configs
|
|
72
|
-
'recommended-alphabetical-legacy': createLegacyConfig({
|
|
73
|
-
type: 'alphabetical',
|
|
74
|
-
order: 'asc',
|
|
75
|
-
}),
|
|
76
|
-
'recommended-line-length-legacy': createLegacyConfig({
|
|
77
|
-
type: 'line-length',
|
|
78
|
-
order: 'desc',
|
|
79
|
-
}),
|
|
80
|
-
'recommended-natural-legacy': createLegacyConfig({
|
|
81
|
-
type: 'natural',
|
|
82
|
-
order: 'asc',
|
|
83
|
-
}),
|
|
84
|
-
'recommended-custom-legacy': createLegacyConfig({
|
|
85
|
-
type: 'custom',
|
|
86
|
-
order: 'asc',
|
|
87
|
-
}),
|
|
88
|
-
'recommended-alphabetical': createConfig({
|
|
89
|
-
type: 'alphabetical',
|
|
90
|
-
order: 'asc',
|
|
91
|
-
}),
|
|
92
|
-
'recommended-line-length': createConfig({
|
|
93
|
-
type: 'line-length',
|
|
94
|
-
order: 'desc',
|
|
95
|
-
}),
|
|
96
|
-
'recommended-natural': createConfig({
|
|
97
|
-
type: 'natural',
|
|
98
|
-
order: 'asc',
|
|
99
|
-
}),
|
|
100
|
-
'recommended-custom': createConfig({
|
|
101
|
-
type: 'custom',
|
|
102
|
-
order: 'asc',
|
|
103
|
-
}),
|
|
104
|
-
},
|
|
114
|
+
configs,
|
|
105
115
|
}
|
|
106
|
-
|
|
116
|
+
export { configs, index as default, rules }
|
package/dist/package.json.js
CHANGED