eslint-plugin-perfectionist 4.15.1 → 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 -202
- package/dist/index.d.ts +209 -9
- package/dist/index.js +86 -81
- 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 +99 -134
- package/dist/rules/sort-classes/get-overload-signature-groups.d.ts +10 -0
- package/dist/rules/sort-classes/get-overload-signature-groups.js +3 -5
- 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 +104 -105
- 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 +128 -105
- 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 +105 -148
- 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 +141 -120
- 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 +113 -62
- 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 +9 -13
- 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 +3 -17
- 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 +8 -12
- 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 +1 -3
- 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 +11 -39
- 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 +9 -10
- package/dist/rules/sort-imports.d.ts +22 -0
- package/dist/rules/sort-imports.js +215 -383
- 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 +115 -131
- 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 +80 -79
- 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 +103 -101
- 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 +95 -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 +95 -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 +10 -7
- 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 +225 -301
- 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 +186 -316
- package/dist/rules/sort-sets.d.ts +17 -0
- package/dist/rules/sort-sets.js +26 -17
- package/dist/rules/sort-switch-case.d.ts +10 -0
- package/dist/rules/sort-switch-case.js +65 -73
- 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 +82 -83
- 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 +89 -81
- 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 +5 -9
- 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 +53 -4
- 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 +9 -24
- 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 +1 -3
- 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 +1 -3
- 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 +1 -3
- package/dist/utils/does-custom-group-match.d.ts +119 -0
- package/dist/utils/does-custom-group-match.js +5 -7
- 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 +3 -5
- package/dist/utils/get-array-combinations.d.ts +11 -0
- package/dist/utils/get-array-combinations.js +1 -3
- package/dist/utils/get-comment-above-that-should-exist.d.ts +77 -0
- package/dist/utils/get-comment-above-that-should-exist.js +14 -16
- package/dist/utils/get-comments-before.d.ts +24 -0
- package/dist/utils/get-comments-before.js +1 -3
- package/dist/utils/get-decorator-name.d.ts +36 -0
- package/dist/utils/get-decorator-name.js +1 -3
- package/dist/utils/get-enum-members.d.ts +25 -0
- package/dist/utils/get-enum-members.js +5 -4
- package/dist/utils/get-eslint-disabled-lines.d.ts +44 -0
- package/dist/utils/get-eslint-disabled-lines.js +8 -11
- package/dist/utils/get-eslint-disabled-rules.d.ts +48 -0
- package/dist/utils/get-eslint-disabled-rules.js +2 -4
- package/dist/utils/get-group-index.d.ts +38 -0
- package/dist/utils/get-group-index.js +23 -9
- package/dist/utils/get-lines-between.d.ts +38 -0
- package/dist/utils/get-lines-between.js +1 -3
- package/dist/utils/get-newlines-between-errors.d.ts +102 -0
- package/dist/utils/get-newlines-between-errors.js +5 -11
- package/dist/utils/get-newlines-between-option.d.ts +37 -0
- package/dist/utils/get-newlines-between-option.js +83 -97
- package/dist/utils/get-node-decorators.d.ts +33 -0
- package/dist/utils/get-node-decorators.js +5 -4
- package/dist/utils/get-node-range.d.ts +79 -0
- package/dist/utils/get-node-range.js +11 -15
- package/dist/utils/get-options-with-clean-groups.d.ts +55 -0
- package/dist/utils/get-options-with-clean-groups.js +1 -3
- package/dist/utils/get-settings.d.ts +54 -0
- package/dist/utils/get-settings.js +1 -4
- 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 +1 -3
- package/dist/utils/is-node-dependent-on-other-node.d.ts +42 -0
- package/dist/utils/is-node-dependent-on-other-node.js +1 -3
- package/dist/utils/is-node-eslint-disabled.d.ts +29 -0
- package/dist/utils/is-node-eslint-disabled.js +1 -3
- package/dist/utils/is-node-function-type.d.ts +48 -0
- package/dist/utils/is-node-function-type.js +1 -3
- 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 +7 -19
- package/dist/utils/is-sortable.d.ts +7 -0
- package/dist/utils/is-sortable.js +1 -3
- 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 +21 -26
- package/dist/utils/make-comment-after-fixes.d.ts +46 -0
- package/dist/utils/make-comment-after-fixes.js +3 -5
- package/dist/utils/make-fixes.d.ts +93 -0
- package/dist/utils/make-fixes.js +10 -12
- package/dist/utils/make-newlines-between-fixes.d.ts +74 -0
- package/dist/utils/make-newlines-between-fixes.js +15 -24
- package/dist/utils/make-order-fixes.d.ts +70 -0
- package/dist/utils/make-order-fixes.js +4 -6
- package/dist/utils/make-single-node-comment-after-fixes.d.ts +46 -0
- package/dist/utils/make-single-node-comment-after-fixes.js +1 -3
- package/dist/utils/matches.d.ts +41 -0
- package/dist/utils/matches.js +1 -3
- package/dist/utils/pairwise.d.ts +32 -0
- package/dist/utils/pairwise.js +1 -3
- package/dist/utils/range-to-diff.d.ts +34 -0
- package/dist/utils/range-to-diff.js +1 -3
- package/dist/utils/report-all-errors.d.ts +181 -0
- package/dist/utils/report-all-errors.js +25 -34
- package/dist/utils/report-errors.d.ts +101 -0
- package/dist/utils/report-errors.js +13 -13
- 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 +7 -9
- package/dist/utils/sort-nodes-by-dependencies.d.ts +99 -0
- package/dist/utils/sort-nodes-by-dependencies.js +5 -13
- package/dist/utils/sort-nodes-by-groups.d.ts +103 -0
- package/dist/utils/sort-nodes-by-groups.js +21 -17
- package/dist/utils/sort-nodes.d.ts +47 -0
- package/dist/utils/sort-nodes.js +13 -15
- package/dist/utils/unreachable-case-error.d.ts +40 -0
- package/dist/utils/unreachable-case-error.js +1 -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} +13 -24
- package/dist/utils/validate-newlines-and-partition-configuration.d.ts +92 -0
- package/dist/utils/validate-newlines-and-partition-configuration.js +3 -6
- package/dist/utils/validate-no-duplicated-groups.d.ts +13 -0
- package/dist/utils/validate-no-duplicated-groups.js +7 -16
- package/dist/utils/validate-objects-inside-groups.d.ts +55 -0
- package/dist/utils/validate-objects-inside-groups.js +9 -11
- package/package.json +4 -5
- 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 -6
- package/dist/rules/sort-object-types/get-custom-groups-compare-options.js +0 -41
- package/dist/rules/sort-objects/get-first-node-parent-with-type.js +0 -16
- package/dist/utils/common-json-schemas.js +0 -316
- package/dist/utils/compare.js +0 -163
- package/dist/utils/get-custom-groups-compare-options.js +0 -46
- package/dist/utils/get-matching-context-options.js +0 -15
- package/dist/utils/is-comment-above-option.js +0 -6
package/dist/alphabet.d.ts
CHANGED
|
@@ -1,203 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Manages a customizable alphabet for sorting operations.
|
|
3
|
-
*
|
|
4
|
-
* Provides methods to generate, modify, and sort alphabets based on various
|
|
5
|
-
* criteria including Unicode ranges, case prioritization, and locale-specific
|
|
6
|
-
* ordering. Used by the 'custom' sort type to define character precedence.
|
|
7
|
-
*
|
|
8
|
-
* The class supports:
|
|
9
|
-
*
|
|
10
|
-
* - Generating alphabets from strings or Unicode ranges
|
|
11
|
-
* - Case prioritization and manipulation
|
|
12
|
-
* - Character positioning and removal
|
|
13
|
-
* - Multiple sorting strategies (natural, locale, char code).
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* // Create a custom alphabet with specific character order
|
|
17
|
-
* const alphabet = Alphabet.generateFrom('aAbBcC')
|
|
18
|
-
* .prioritizeCase('uppercase')
|
|
19
|
-
* .getCharacters()
|
|
20
|
-
* // Returns: 'AaBbCc'
|
|
21
|
-
*/
|
|
22
|
-
export declare class Alphabet {
|
|
23
|
-
private characters
|
|
24
|
-
private constructor()
|
|
25
|
-
/**
|
|
26
|
-
* Generates an alphabet from the given characters.
|
|
27
|
-
*
|
|
28
|
-
* @param values - The characters to generate the alphabet from.
|
|
29
|
-
* @returns - The wrapped alphabet.
|
|
30
|
-
*/
|
|
31
|
-
static generateFrom(values: string[] | string): Alphabet
|
|
32
|
-
/**
|
|
33
|
-
* Generates an alphabet containing relevant characters from the Unicode
|
|
34
|
-
* standard. Contains the Unicode planes 0 and 1.
|
|
35
|
-
*
|
|
36
|
-
* @returns - The generated alphabet.
|
|
37
|
-
*/
|
|
38
|
-
static generateRecommendedAlphabet(): Alphabet
|
|
39
|
-
/**
|
|
40
|
-
* Generates an alphabet containing all characters from the Unicode standard
|
|
41
|
-
* except for irrelevant Unicode planes. Contains the Unicode planes 0, 1, 2
|
|
42
|
-
* and 3.
|
|
43
|
-
*
|
|
44
|
-
* @returns - The generated alphabet.
|
|
45
|
-
*/
|
|
46
|
-
static generateCompleteAlphabet(): Alphabet
|
|
47
|
-
private static getCharactersWithCase
|
|
48
|
-
/**
|
|
49
|
-
* Generates an alphabet containing relevant characters from the Unicode
|
|
50
|
-
* standard.
|
|
51
|
-
*
|
|
52
|
-
* @param maxCodePoint - The maximum code point to generate the alphabet to.
|
|
53
|
-
* @returns - The generated alphabet.
|
|
54
|
-
*/
|
|
55
|
-
private static generateAlphabetToRange
|
|
56
|
-
/**
|
|
57
|
-
* For each character with a lower and upper case, permutes the two cases so
|
|
58
|
-
* that the alphabet is ordered by the case priority entered.
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* Alphabet.generateFrom('aAbBcdCD').prioritizeCase('uppercase') // Returns 'AaBbCDcd'.
|
|
62
|
-
*
|
|
63
|
-
* @param casePriority - The case to prioritize.
|
|
64
|
-
* @returns - The same alphabet instance with the cases prioritized.
|
|
65
|
-
*/
|
|
66
|
-
prioritizeCase(casePriority: 'lowercase' | 'uppercase'): this
|
|
67
|
-
/**
|
|
68
|
-
* Adds specific characters to the end of the alphabet.
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* Alphabet.generateFrom('ab').pushCharacters('cd')
|
|
72
|
-
* // Returns 'abcd'
|
|
73
|
-
*
|
|
74
|
-
* @param values - The characters to push to the alphabet.
|
|
75
|
-
* @returns - The same alphabet instance without the specified characters.
|
|
76
|
-
*/
|
|
77
|
-
pushCharacters(values: string[] | string): this
|
|
78
|
-
/**
|
|
79
|
-
* Permutes characters with cases so that all characters with the entered
|
|
80
|
-
* case are put before the other characters.
|
|
81
|
-
*
|
|
82
|
-
* @param caseToComeFirst - The case to put before the other characters.
|
|
83
|
-
* @returns - The same alphabet instance with all characters with case
|
|
84
|
-
* before all the characters with the other case.
|
|
85
|
-
*/
|
|
86
|
-
placeAllWithCaseBeforeAllWithOtherCase(
|
|
87
|
-
caseToComeFirst: 'uppercase' | 'lowercase',
|
|
88
|
-
): this
|
|
89
|
-
/**
|
|
90
|
-
* Places a specific character right before another character in the
|
|
91
|
-
* alphabet.
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* Alphabet.generateFrom('ab-cd/').placeCharacterBefore({
|
|
95
|
-
* characterBefore: '/',
|
|
96
|
-
* characterAfter: '-',
|
|
97
|
-
* })
|
|
98
|
-
* // Returns 'ab/-cd'
|
|
99
|
-
*
|
|
100
|
-
* @param params - The parameters for the operation.
|
|
101
|
-
* @param params.characterBefore - The character to come before
|
|
102
|
-
* characterAfter.
|
|
103
|
-
* @param params.characterAfter - The target character.
|
|
104
|
-
* @returns - The same alphabet instance with the specific character
|
|
105
|
-
* prioritized.
|
|
106
|
-
*/
|
|
107
|
-
placeCharacterBefore({
|
|
108
|
-
characterBefore,
|
|
109
|
-
characterAfter,
|
|
110
|
-
}: {
|
|
111
|
-
characterBefore: string
|
|
112
|
-
characterAfter: string
|
|
113
|
-
}): this
|
|
114
|
-
/**
|
|
115
|
-
* Places a specific character right after another character in the
|
|
116
|
-
* alphabet.
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* Alphabet.generateFrom('ab-cd/').placeCharacterAfter({
|
|
120
|
-
* characterBefore: '/',
|
|
121
|
-
* characterAfter: '-',
|
|
122
|
-
* })
|
|
123
|
-
* // Returns 'abcd/-'
|
|
124
|
-
*
|
|
125
|
-
* @param params - The parameters for the operation.
|
|
126
|
-
* @param params.characterBefore - The target character.
|
|
127
|
-
* @param params.characterAfter - The character to come after
|
|
128
|
-
* characterBefore.
|
|
129
|
-
* @returns - The same alphabet instance with the specific character
|
|
130
|
-
* prioritized.
|
|
131
|
-
*/
|
|
132
|
-
placeCharacterAfter({
|
|
133
|
-
characterBefore,
|
|
134
|
-
characterAfter,
|
|
135
|
-
}: {
|
|
136
|
-
characterBefore: string
|
|
137
|
-
characterAfter: string
|
|
138
|
-
}): this
|
|
139
|
-
/**
|
|
140
|
-
* Removes specific characters from the alphabet by their range.
|
|
141
|
-
*
|
|
142
|
-
* @param range - The Unicode range to remove characters from.
|
|
143
|
-
* @param range.start - The starting Unicode codepoint.
|
|
144
|
-
* @param range.end - The ending Unicode codepoint.
|
|
145
|
-
* @returns - The same alphabet instance without the characters from the
|
|
146
|
-
* specified range.
|
|
147
|
-
*/
|
|
148
|
-
removeUnicodeRange({ start, end }: { start: number; end: number }): this
|
|
149
|
-
/**
|
|
150
|
-
* Sorts the alphabet by the sorting function provided.
|
|
151
|
-
*
|
|
152
|
-
* @param sortingFunction - The sorting function to use.
|
|
153
|
-
* @returns - The same alphabet instance sorted by the sorting function
|
|
154
|
-
* provided.
|
|
155
|
-
*/
|
|
156
|
-
sortBy(
|
|
157
|
-
sortingFunction: (characterA: string, characterB: string) => number,
|
|
158
|
-
): this
|
|
159
|
-
/**
|
|
160
|
-
* Sorts the alphabet by the natural order of the characters using
|
|
161
|
-
* `natural-orderby`.
|
|
162
|
-
*
|
|
163
|
-
* @param locale - The locale to use for sorting.
|
|
164
|
-
* @returns - The same alphabet instance sorted by the natural order of the
|
|
165
|
-
* characters.
|
|
166
|
-
*/
|
|
167
|
-
sortByNaturalSort(locale?: string): this
|
|
168
|
-
/**
|
|
169
|
-
* Removes specific characters from the alphabet.
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* Alphabet.generateFrom('abcd').removeCharacters('dcc')
|
|
173
|
-
* // Returns 'ab'
|
|
174
|
-
*
|
|
175
|
-
* @param values - The characters to remove from the alphabet.
|
|
176
|
-
* @returns - The same alphabet instance without the specified characters.
|
|
177
|
-
*/
|
|
178
|
-
removeCharacters(values: string[] | string): this
|
|
179
|
-
/**
|
|
180
|
-
* Sorts the alphabet by the character code point.
|
|
181
|
-
*
|
|
182
|
-
* @returns - The same alphabet instance sorted by the character code point.
|
|
183
|
-
*/
|
|
184
|
-
sortByCharCodeAt(): this
|
|
185
|
-
/**
|
|
186
|
-
* Sorts the alphabet by the locale order of the characters.
|
|
187
|
-
*
|
|
188
|
-
* @param locales - The locales to use for sorting.
|
|
189
|
-
* @returns - The same alphabet instance sorted by the locale order of the
|
|
190
|
-
* characters.
|
|
191
|
-
*/
|
|
192
|
-
sortByLocaleCompare(locales?: Intl.LocalesArgument): this
|
|
193
|
-
/**
|
|
194
|
-
* Retrieves the characters from the alphabet.
|
|
195
|
-
*
|
|
196
|
-
* @returns The characters from the alphabet.
|
|
197
|
-
*/
|
|
198
|
-
getCharacters(): string
|
|
199
|
-
private placeCharacterBeforeOrAfter
|
|
200
|
-
private getCharactersWithCase
|
|
201
|
-
}
|
|
202
|
-
|
|
1
|
+
export * from './utils/alphabet'
|
|
203
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,53 +1,57 @@
|
|
|
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
56
|
function getRules(options) {
|
|
53
57
|
return Object.fromEntries(
|
|
@@ -71,41 +75,42 @@ function createLegacyConfig(options) {
|
|
|
71
75
|
plugins: [pluginName],
|
|
72
76
|
}
|
|
73
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
|
+
}
|
|
74
112
|
const index = {
|
|
75
113
|
...plugin,
|
|
76
|
-
configs
|
|
77
|
-
'recommended-alphabetical-legacy': createLegacyConfig({
|
|
78
|
-
type: 'alphabetical',
|
|
79
|
-
order: 'asc',
|
|
80
|
-
}),
|
|
81
|
-
'recommended-line-length-legacy': createLegacyConfig({
|
|
82
|
-
type: 'line-length',
|
|
83
|
-
order: 'desc',
|
|
84
|
-
}),
|
|
85
|
-
'recommended-natural-legacy': createLegacyConfig({
|
|
86
|
-
type: 'natural',
|
|
87
|
-
order: 'asc',
|
|
88
|
-
}),
|
|
89
|
-
'recommended-custom-legacy': createLegacyConfig({
|
|
90
|
-
type: 'custom',
|
|
91
|
-
order: 'asc',
|
|
92
|
-
}),
|
|
93
|
-
'recommended-alphabetical': createConfig({
|
|
94
|
-
type: 'alphabetical',
|
|
95
|
-
order: 'asc',
|
|
96
|
-
}),
|
|
97
|
-
'recommended-line-length': createConfig({
|
|
98
|
-
type: 'line-length',
|
|
99
|
-
order: 'desc',
|
|
100
|
-
}),
|
|
101
|
-
'recommended-natural': createConfig({
|
|
102
|
-
type: 'natural',
|
|
103
|
-
order: 'asc',
|
|
104
|
-
}),
|
|
105
|
-
'recommended-custom': createConfig({
|
|
106
|
-
type: 'custom',
|
|
107
|
-
order: 'asc',
|
|
108
|
-
}),
|
|
109
|
-
},
|
|
114
|
+
configs,
|
|
110
115
|
}
|
|
111
|
-
|
|
116
|
+
export { configs, index as default, rules }
|
package/dist/package.json.js
CHANGED