diff --git a/package.json b/package.json index 5ca104b..5f96247 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "eslint-plugin-jest-dom": "^5.5.0", "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-n": "^17.13.1", - "eslint-plugin-perfectionist": "^3.9.1", + "eslint-plugin-perfectionist": "^4.0.3", "eslint-plugin-react": "^7.37.2", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "0.4.14", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aeffb60..60ea91f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,8 +54,8 @@ importers: specifier: ^17.13.1 version: 17.13.1(eslint@9.15.0(jiti@2.4.0)) eslint-plugin-perfectionist: - specifier: ^3.9.1 - version: 3.9.1(astro-eslint-parser@1.1.0(typescript@5.6.3))(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3) + specifier: ^4.0.3 + version: 4.0.3(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3) eslint-plugin-react: specifier: ^7.37.2 version: 7.37.2(eslint@9.15.0(jiti@2.4.0)) @@ -2466,24 +2466,11 @@ packages: peerDependencies: eslint: '>=8.23.0' - eslint-plugin-perfectionist@3.9.1: - resolution: {integrity: sha512-9WRzf6XaAxF4Oi5t/3TqKP5zUjERhasHmLFHin2Yw6ZAp/EP/EVA2dr3BhQrrHWCm5SzTMZf0FcjDnBkO2xFkA==} + eslint-plugin-perfectionist@4.0.3: + resolution: {integrity: sha512-CyafnreF6boy4lf1XaF72U8NbkwrfjU/mOf1y6doaDMS9zGXhUU1DSk+ZPf/rVwCf1PL1m+rhHqFs+IcB8kDmA==} engines: {node: ^18.0.0 || >=20.0.0} peerDependencies: - astro-eslint-parser: ^1.0.2 eslint: '>=8.0.0' - svelte: '>=3.0.0' - svelte-eslint-parser: ^0.41.1 - vue-eslint-parser: '>=9.0.0' - peerDependenciesMeta: - astro-eslint-parser: - optional: true - svelte: - optional: true - svelte-eslint-parser: - optional: true - vue-eslint-parser: - optional: true eslint-plugin-react-hooks@5.0.0: resolution: {integrity: sha512-hIOwI+5hYGpJEc4uPRmz2ulCjAGD/N13Lukkh8cLV0i2IRk/bdZDYjgLVHj+U9Z704kLIdIO6iueGvxNur0sgw==} @@ -3683,12 +3670,13 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - natural-compare-lite@1.4.0: - resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} - natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + natural-orderby@5.0.0: + resolution: {integrity: sha512-kKHJhxwpR/Okycz4HhQKKlhWe4ASEfPgkSWNmKFHd7+ezuQlxkA5cM3+XkBPvm1gmHen3w53qsYAv+8GwRrBlg==} + engines: {node: '>=18'} + neo-async@2.6.2: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} @@ -7567,15 +7555,12 @@ snapshots: minimatch: 9.0.5 semver: 7.6.3 - eslint-plugin-perfectionist@3.9.1(astro-eslint-parser@1.1.0(typescript@5.6.3))(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3): + eslint-plugin-perfectionist@4.0.3(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3): dependencies: - '@typescript-eslint/types': 8.13.0 + '@typescript-eslint/types': 8.15.0 '@typescript-eslint/utils': 8.15.0(eslint@9.15.0(jiti@2.4.0))(typescript@5.6.3) eslint: 9.15.0(jiti@2.4.0) - minimatch: 9.0.5 - natural-compare-lite: 1.4.0 - optionalDependencies: - astro-eslint-parser: 1.1.0(typescript@5.6.3) + natural-orderby: 5.0.0 transitivePeerDependencies: - supports-color - typescript @@ -9031,10 +9016,10 @@ snapshots: nanoid@3.3.7: {} - natural-compare-lite@1.4.0: {} - natural-compare@1.4.0: {} + natural-orderby@5.0.0: {} + neo-async@2.6.2: {} neotraverse@0.6.18: {} diff --git a/scripts/typegen.ts b/scripts/typegen.ts index fde0cdf..a1f2592 100644 --- a/scripts/typegen.ts +++ b/scripts/typegen.ts @@ -1,7 +1,7 @@ import fs from "node:fs/promises"; -import { builtinRules } from "eslint/use-at-your-own-risk"; import { flatConfigsToRulesDTS } from "eslint-typegen/core"; +import { builtinRules } from "eslint/use-at-your-own-risk"; import jimmyDotCodes from "../src"; diff --git a/src/rules.gen.d.ts b/src/rules.gen.d.ts index ba38643..06a9a21 100644 --- a/src/rules.gen.d.ts +++ b/src/rules.gen.d.ts @@ -3279,17 +3279,16 @@ export interface RuleOptions { * @see https://perfectionist.dev/rules/sort-array-includes */ 'perfectionist/sort-array-includes'?: Linter.RuleEntry - /** - * Enforce sorted Astro attributes. - * @see https://perfectionist.dev/rules/sort-astro-attributes - * @deprecated - */ - 'perfectionist/sort-astro-attributes'?: Linter.RuleEntry /** * Enforce sorted classes. * @see https://perfectionist.dev/rules/sort-classes */ 'perfectionist/sort-classes'?: Linter.RuleEntry + /** + * Enforce sorted decorators. + * @see https://perfectionist.dev/rules/sort-decorators + */ + 'perfectionist/sort-decorators'?: Linter.RuleEntry /** * Enforce sorted TypeScript enums. * @see https://perfectionist.dev/rules/sort-enums @@ -3300,6 +3299,11 @@ export interface RuleOptions { * @see https://perfectionist.dev/rules/sort-exports */ 'perfectionist/sort-exports'?: Linter.RuleEntry + /** + * Enforce sorted heritage clauses. + * @see https://perfectionist.dev/rules/sort-heritage-clauses + */ + 'perfectionist/sort-heritage-clauses'?: Linter.RuleEntry /** * Enforce sorted imports. * @see https://perfectionist.dev/rules/sort-imports @@ -3325,6 +3329,11 @@ export interface RuleOptions { * @see https://perfectionist.dev/rules/sort-maps */ 'perfectionist/sort-maps'?: Linter.RuleEntry + /** + * Enforce sorted modules. + * @see https://perfectionist.dev/rules/sort-modules + */ + 'perfectionist/sort-modules'?: Linter.RuleEntry /** * Enforce sorted named exports. * @see https://perfectionist.dev/rules/sort-named-exports @@ -3350,12 +3359,6 @@ export interface RuleOptions { * @see https://perfectionist.dev/rules/sort-sets */ 'perfectionist/sort-sets'?: Linter.RuleEntry - /** - * Enforce sorted Svelte attributes. - * @see https://perfectionist.dev/rules/sort-svelte-attributes - * @deprecated - */ - 'perfectionist/sort-svelte-attributes'?: Linter.RuleEntry /** * Enforce sorted switch cases. * @see https://perfectionist.dev/rules/sort-switch-case @@ -3371,12 +3374,6 @@ export interface RuleOptions { * @see https://perfectionist.dev/rules/sort-variable-declarations */ 'perfectionist/sort-variable-declarations'?: Linter.RuleEntry - /** - * Enforce sorted Vue attributes. - * @see https://perfectionist.dev/rules/sort-vue-attributes - * @deprecated - */ - 'perfectionist/sort-vue-attributes'?: Linter.RuleEntry /** * Require using arrow functions for callbacks * @see https://eslint.org/docs/latest/rules/prefer-arrow-callback @@ -8401,61 +8398,26 @@ type PaddingLineBetweenStatements = { // ----- perfectionist/sort-array-includes ----- type PerfectionistSortArrayIncludes = []|[{ - type?: ("alphabetical" | "natural" | "line-length") - - order?: ("asc" | "desc") - - matcher?: ("minimatch" | "regex") - - ignoreCase?: boolean - - specialCharacters?: ("remove" | "trim" | "keep") + partitionByComment?: (string[] | boolean | string) groupKind?: ("mixed" | "literals-first" | "spreads-first") - partitionByComment?: (string[] | boolean | string) - partitionByNewLine?: boolean -}] -// ----- perfectionist/sort-astro-attributes ----- -type PerfectionistSortAstroAttributes = []|[{ - type?: ("alphabetical" | "natural" | "line-length") - - order?: ("asc" | "desc") - - matcher?: ("minimatch" | "regex") + specialCharacters?: ("remove" | "trim" | "keep") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) - groups?: (string | string[])[] + order?: ("asc" | "desc") - customGroups?: { - [k: string]: (string | string[]) | undefined - } + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-classes ----- type PerfectionistSortClasses = []|[{ - type?: ("alphabetical" | "natural" | "line-length") - - order?: ("asc" | "desc") - - matcher?: ("minimatch" | "regex") - - ignoreCase?: boolean - - specialCharacters?: ("remove" | "trim" | "keep") - - partitionByComment?: (string[] | boolean | string) - - groups?: (string | string[])[] - customGroups?: ({ - [k: string]: (string | string[]) | undefined - } | ({ groupName?: string @@ -8464,15 +8426,15 @@ type PerfectionistSortClasses = []|[{ order?: ("desc" | "asc") anyOf?: { - selector?: ("accessor-property" | "index-signature" | "constructor" | "static-block" | "get-method" | "set-method" | "function-property" | "property" | "method") - - modifiers?: ("protected" | "private" | "public" | "static" | "abstract" | "override" | "readonly" | "decorated" | "declare" | "optional")[] - - elementNamePattern?: string + modifiers?: ("async" | "protected" | "private" | "public" | "static" | "abstract" | "override" | "readonly" | "decorated" | "declare" | "optional")[] elementValuePattern?: string decoratorNamePattern?: string + + selector?: ("accessor-property" | "index-signature" | "constructor" | "static-block" | "get-method" | "set-method" | "function-property" | "property" | "method") + + elementNamePattern?: string }[] } | { @@ -8482,91 +8444,169 @@ type PerfectionistSortClasses = []|[{ order?: ("desc" | "asc") - selector?: ("accessor-property" | "index-signature" | "constructor" | "static-block" | "get-method" | "set-method" | "function-property" | "property" | "method") - - modifiers?: ("protected" | "private" | "public" | "static" | "abstract" | "override" | "readonly" | "decorated" | "declare" | "optional")[] - - elementNamePattern?: string + modifiers?: ("async" | "protected" | "private" | "public" | "static" | "abstract" | "override" | "readonly" | "decorated" | "declare" | "optional")[] elementValuePattern?: string decoratorNamePattern?: string - })[]) -}] -// ----- perfectionist/sort-enums ----- -type PerfectionistSortEnums = []|[{ + + selector?: ("accessor-property" | "index-signature" | "constructor" | "static-block" | "get-method" | "set-method" | "function-property" | "property" | "method") + + elementNamePattern?: string + })[] - type?: ("alphabetical" | "natural" | "line-length") + ignoreCallbackDependenciesPatterns?: string[] - order?: ("asc" | "desc") + partitionByComment?: (string[] | boolean | string) + + partitionByNewLine?: boolean - matcher?: ("minimatch" | "regex") + specialCharacters?: ("remove" | "trim" | "keep") + + newlinesBetween?: ("ignore" | "always" | "never") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) - sortByValue?: boolean + groups?: (string | string[])[] - forceNumericSort?: boolean + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") +}] +// ----- perfectionist/sort-decorators ----- +type PerfectionistSortDecorators = []|[{ partitionByComment?: (string[] | boolean | string) - partitionByNewLine?: boolean -}] -// ----- perfectionist/sort-exports ----- -type PerfectionistSortExports = []|[{ + sortOnParameters?: boolean - type?: ("alphabetical" | "natural" | "line-length") + sortOnProperties?: boolean - order?: ("asc" | "desc") + sortOnAccessors?: boolean - matcher?: ("minimatch" | "regex") + sortOnMethods?: boolean - ignoreCase?: boolean + sortOnClasses?: boolean specialCharacters?: ("remove" | "trim" | "keep") + customGroups?: { + [k: string]: (string | string[]) | undefined + } + + ignoreCase?: boolean + + locales?: (string | string[]) + + groups?: (string | string[])[] + + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") +}] +// ----- perfectionist/sort-enums ----- +type PerfectionistSortEnums = []|[{ + partitionByComment?: (string[] | boolean | string) + forceNumericSort?: boolean + + sortByValue?: boolean + partitionByNewLine?: boolean - groupKind?: ("mixed" | "values-first" | "types-first") -}] -// ----- perfectionist/sort-imports ----- -type PerfectionistSortImports = []|[_PerfectionistSortImportsSortImports] -type _PerfectionistSortImportsSortImports = (_PerfectionistSortImportsMaxLineLengthRequiresLineLengthType & { + specialCharacters?: ("remove" | "trim" | "keep") - type?: ("alphabetical" | "natural" | "line-length") + ignoreCase?: boolean + + locales?: (string | string[]) order?: ("asc" | "desc") - matcher?: ("minimatch" | "regex") + type?: ("alphabetical" | "natural" | "line-length") +}] +// ----- perfectionist/sort-exports ----- +type PerfectionistSortExports = []|[{ + + partitionByComment?: (string[] | boolean | string) - ignoreCase?: boolean + groupKind?: ("mixed" | "values-first" | "types-first") + + partitionByNewLine?: boolean specialCharacters?: ("remove" | "trim" | "keep") - internalPattern?: string[] + ignoreCase?: boolean - sortSideEffects?: boolean + locales?: (string | string[]) - newlinesBetween?: ("ignore" | "always" | "never") + order?: ("asc" | "desc") - maxLineLength?: number + type?: ("alphabetical" | "natural" | "line-length") +}] +// ----- perfectionist/sort-heritage-clauses ----- +type PerfectionistSortHeritageClauses = []|[{ + + specialCharacters?: ("remove" | "trim" | "keep") + + customGroups?: { + [k: string]: (string | string[]) | undefined + } + + ignoreCase?: boolean + + locales?: (string | string[]) groups?: (string | string[])[] + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") +}] +// ----- perfectionist/sort-imports ----- +type PerfectionistSortImports = []|[_PerfectionistSortImportsSortImports] +type _PerfectionistSortImportsSortImports = (_PerfectionistSortImportsMaxLineLengthRequiresLineLengthType & { + customGroups?: { - type?: { + + value?: { [k: string]: unknown | undefined } - value?: { + + type?: { [k: string]: unknown | undefined } } + partitionByComment?: (string[] | boolean | string) + + internalPattern?: string[] + + maxLineLength?: number + + sortSideEffects?: boolean + environment?: ("node" | "bun") + + tsconfigRootDir?: string + + partitionByNewLine?: boolean + + specialCharacters?: ("remove" | "trim" | "keep") + + newlinesBetween?: ("ignore" | "always" | "never") + + ignoreCase?: boolean + + locales?: (string | string[]) + + groups?: (string | string[])[] + + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") }) type _PerfectionistSortImportsMaxLineLengthRequiresLineLengthType = ({ [k: string]: unknown | undefined @@ -8578,284 +8618,317 @@ interface _PerfectionistSortImports_IsLineLength { // ----- perfectionist/sort-interfaces ----- type PerfectionistSortInterfaces = []|[{ - type?: ("alphabetical" | "natural" | "line-length") + ignorePattern?: string[] - order?: ("asc" | "desc") + partitionByComment?: (string[] | boolean | string) - matcher?: ("minimatch" | "regex") + groupKind?: ("mixed" | "optional-first" | "required-first") - ignoreCase?: boolean + partitionByNewLine?: boolean specialCharacters?: ("remove" | "trim" | "keep") - ignorePattern?: string[] + newlinesBetween?: ("ignore" | "always" | "never") - partitionByComment?: (boolean | string | string[]) + customGroups?: { + [k: string]: (string | string[]) | undefined + } - partitionByNewLine?: boolean + ignoreCase?: boolean - groupKind?: ("mixed" | "optional-first" | "required-first") + locales?: (string | string[]) groups?: (string | string[])[] - customGroups?: { - [k: string]: (string | string[]) | undefined - } + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-intersection-types ----- type PerfectionistSortIntersectionTypes = []|[{ - type?: ("alphabetical" | "natural" | "line-length") + partitionByComment?: (string[] | boolean | string) - order?: ("asc" | "desc") + partitionByNewLine?: boolean - matcher?: ("minimatch" | "regex") + specialCharacters?: ("remove" | "trim" | "keep") + + newlinesBetween?: ("ignore" | "always" | "never") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) groups?: (string | string[])[] - partitionByComment?: (string[] | boolean | string) + order?: ("asc" | "desc") - partitionByNewLine?: boolean + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-jsx-props ----- type PerfectionistSortJsxProps = []|[{ - type?: ("alphabetical" | "natural" | "line-length") + ignorePattern?: string[] - order?: ("asc" | "desc") + specialCharacters?: ("remove" | "trim" | "keep") - matcher?: ("minimatch" | "regex") + customGroups?: { + [k: string]: (string | string[]) | undefined + } ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") - - ignorePattern?: string[] + locales?: (string | string[]) groups?: (string | string[])[] - customGroups?: { - [k: string]: (string | string[]) | undefined - } + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-maps ----- type PerfectionistSortMaps = []|[{ - type?: ("alphabetical" | "natural" | "line-length") + partitionByComment?: (string[] | boolean | string) - order?: ("asc" | "desc") + partitionByNewLine?: boolean - matcher?: ("minimatch" | "regex") + specialCharacters?: ("remove" | "trim" | "keep") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) + + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") +}] +// ----- perfectionist/sort-modules ----- +type PerfectionistSortModules = []|[{ + + customGroups?: ({ + + groupName?: string + + type?: ("alphabetical" | "line-length" | "natural" | "unsorted") + + order?: ("desc" | "asc") + anyOf?: { + + modifiers?: ("async" | "declare" | "decorated" | "default" | "export")[] + + elementValuePattern?: string + + decoratorNamePattern?: string + + selector?: ("enum" | "function" | "interface" | "type" | "class") + + elementNamePattern?: string + }[] + } | { + + groupName?: string + + type?: ("alphabetical" | "line-length" | "natural" | "unsorted") + + order?: ("desc" | "asc") + + modifiers?: ("async" | "declare" | "decorated" | "default" | "export")[] + + elementValuePattern?: string + + decoratorNamePattern?: string + + selector?: ("enum" | "function" | "interface" | "type" | "class") + + elementNamePattern?: string + })[] partitionByComment?: (string[] | boolean | string) partitionByNewLine?: boolean + + specialCharacters?: ("remove" | "trim" | "keep") + + newlinesBetween?: ("ignore" | "always" | "never") + + ignoreCase?: boolean + + locales?: (string | string[]) + + groups?: (string | string[])[] + + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-named-exports ----- type PerfectionistSortNamedExports = []|[{ - type?: ("alphabetical" | "natural" | "line-length") - - order?: ("asc" | "desc") + partitionByComment?: (string[] | boolean | string) - matcher?: ("minimatch" | "regex") + groupKind?: ("mixed" | "values-first" | "types-first") - ignoreCase?: boolean + partitionByNewLine?: boolean specialCharacters?: ("remove" | "trim" | "keep") - groupKind?: ("mixed" | "values-first" | "types-first") + ignoreCase?: boolean - partitionByComment?: (string[] | boolean | string) + locales?: (string | string[]) - partitionByNewLine?: boolean + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-named-imports ----- type PerfectionistSortNamedImports = []|[{ - type?: ("alphabetical" | "natural" | "line-length") + partitionByComment?: (string[] | boolean | string) - order?: ("asc" | "desc") + groupKind?: ("mixed" | "values-first" | "types-first") - matcher?: ("minimatch" | "regex") + ignoreAlias?: boolean - ignoreCase?: boolean + partitionByNewLine?: boolean specialCharacters?: ("remove" | "trim" | "keep") - ignoreAlias?: boolean + ignoreCase?: boolean - groupKind?: ("mixed" | "values-first" | "types-first") + locales?: (string | string[]) - partitionByComment?: (string[] | boolean | string) + order?: ("asc" | "desc") - partitionByNewLine?: boolean + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-object-types ----- type PerfectionistSortObjectTypes = []|[{ - type?: ("alphabetical" | "natural" | "line-length") - - order?: ("asc" | "desc") - - matcher?: ("minimatch" | "regex") - - ignoreCase?: boolean - - specialCharacters?: ("remove" | "trim" | "keep") - partitionByComment?: (string[] | boolean | string) + groupKind?: ("mixed" | "required-first" | "optional-first") + partitionByNewLine?: boolean - groupKind?: ("mixed" | "required-first" | "optional-first") + specialCharacters?: ("remove" | "trim" | "keep") - groups?: (string | string[])[] + newlinesBetween?: ("ignore" | "always" | "never") customGroups?: { [k: string]: (string | string[]) | undefined } -}] -// ----- perfectionist/sort-objects ----- -type PerfectionistSortObjects = []|[{ - type?: ("alphabetical" | "natural" | "line-length") + ignoreCase?: boolean - order?: ("asc" | "desc") + locales?: (string | string[]) - matcher?: ("minimatch" | "regex") + groups?: (string | string[])[] - ignoreCase?: boolean + order?: ("asc" | "desc") - specialCharacters?: ("remove" | "trim" | "keep") + type?: ("alphabetical" | "natural" | "line-length") +}] +// ----- perfectionist/sort-objects ----- +type PerfectionistSortObjects = []|[{ + + ignorePattern?: string[] partitionByComment?: (string[] | boolean | string) - partitionByNewLine?: boolean + destructureOnly?: boolean styledComponents?: boolean - destructureOnly?: boolean + partitionByNewLine?: boolean - ignorePattern?: string[] + specialCharacters?: ("remove" | "trim" | "keep") - groups?: (string | string[])[] + newlinesBetween?: ("ignore" | "always" | "never") customGroups?: { [k: string]: (string | string[]) | undefined } -}] -// ----- perfectionist/sort-sets ----- -type PerfectionistSortSets = []|[{ - - type?: ("alphabetical" | "natural" | "line-length") - - order?: ("asc" | "desc") - - matcher?: ("minimatch" | "regex") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) - groupKind?: ("mixed" | "literals-first" | "spreads-first") + groups?: (string | string[])[] - partitionByComment?: (string[] | boolean | string) + order?: ("asc" | "desc") - partitionByNewLine?: boolean + type?: ("alphabetical" | "natural" | "line-length") }] -// ----- perfectionist/sort-svelte-attributes ----- -type PerfectionistSortSvelteAttributes = []|[{ +// ----- perfectionist/sort-sets ----- +type PerfectionistSortSets = []|[{ - type?: ("alphabetical" | "natural" | "line-length") + partitionByComment?: (string[] | boolean | string) - order?: ("asc" | "desc") + groupKind?: ("mixed" | "literals-first" | "spreads-first") - matcher?: ("minimatch" | "regex") + partitionByNewLine?: boolean + + specialCharacters?: ("remove" | "trim" | "keep") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) - groups?: (string | string[])[] + order?: ("asc" | "desc") - customGroups?: { - [k: string]: (string | string[]) | undefined - } + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-switch-case ----- type PerfectionistSortSwitchCase = []|[{ - type?: ("alphabetical" | "natural" | "line-length") - - order?: ("asc" | "desc") + specialCharacters?: ("remove" | "trim" | "keep") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) + + order?: ("asc" | "desc") + + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-union-types ----- type PerfectionistSortUnionTypes = []|[{ - type?: ("alphabetical" | "natural" | "line-length") + partitionByComment?: (string[] | boolean | string) - order?: ("asc" | "desc") + partitionByNewLine?: boolean - matcher?: ("minimatch" | "regex") + specialCharacters?: ("remove" | "trim" | "keep") + + newlinesBetween?: ("ignore" | "always" | "never") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) groups?: (string | string[])[] - partitionByComment?: (string[] | boolean | string) + order?: ("asc" | "desc") - partitionByNewLine?: boolean + type?: ("alphabetical" | "natural" | "line-length") }] // ----- perfectionist/sort-variable-declarations ----- type PerfectionistSortVariableDeclarations = []|[{ - type?: ("alphabetical" | "natural" | "line-length") - - order?: ("asc" | "desc") - - matcher?: ("minimatch" | "regex") - - ignoreCase?: boolean - - specialCharacters?: ("remove" | "trim" | "keep") - partitionByComment?: (string[] | boolean | string) partitionByNewLine?: boolean -}] -// ----- perfectionist/sort-vue-attributes ----- -type PerfectionistSortVueAttributes = []|[{ - - type?: ("alphabetical" | "natural" | "line-length") - order?: ("asc" | "desc") - - matcher?: ("minimatch" | "regex") + specialCharacters?: ("remove" | "trim" | "keep") ignoreCase?: boolean - specialCharacters?: ("remove" | "trim" | "keep") + locales?: (string | string[]) - groups?: (string | string[])[] + order?: ("asc" | "desc") - customGroups?: { - [k: string]: (string | string[]) | undefined - } + type?: ("alphabetical" | "natural" | "line-length") }] // ----- prefer-arrow-callback ----- type PreferArrowCallback = []|[{ diff --git a/src/rules/__snapshots__/perfectionist.spec.ts.snap b/src/rules/__snapshots__/perfectionist.spec.ts.snap index 06941ea..051a552 100644 --- a/src/rules/__snapshots__/perfectionist.spec.ts.snap +++ b/src/rules/__snapshots__/perfectionist.spec.ts.snap @@ -16,6 +16,13 @@ exports[`should create perfectionist rules 1`] = ` "type": "natural", }, ], + "perfectionist/sort-decorators": [ + "error", + { + "order": "asc", + "type": "natural", + }, + ], "perfectionist/sort-enums": [ "error", { @@ -30,6 +37,13 @@ exports[`should create perfectionist rules 1`] = ` "type": "natural", }, ], + "perfectionist/sort-heritage-clauses": [ + "error", + { + "order": "asc", + "type": "natural", + }, + ], "perfectionist/sort-imports": [ "error", { @@ -60,8 +74,8 @@ exports[`should create perfectionist rules 1`] = ` "unknown", ], "internalPattern": [ - "~/**", - "@/**", + "^~/.*", + "^@/.*", ], "order": "asc", "type": "natural", @@ -95,6 +109,7 @@ exports[`should create perfectionist rules 1`] = ` "type": "natural", }, ], + "perfectionist/sort-modules": "off", "perfectionist/sort-named-exports": [ "error", { diff --git a/src/rules/perfectionist.ts b/src/rules/perfectionist.ts index 17b891d..6de6a8a 100644 --- a/src/rules/perfectionist.ts +++ b/src/rules/perfectionist.ts @@ -22,9 +22,37 @@ export const perfectionistRules = { "style", "unknown", ], - internalPattern: ["~/**", "@/**"], + internalPattern: ["^~/.*", "^@/.*"], order: "asc", type: "natural", }, ], + // "perfectionist/sort-modules": [ + // "error", + // { + // customGroups: [], + // groups: [ + // "declare-enum", + // "enum", + // "export-enum", + // ["declare-interface", "declare-type"], + // ["interface", "type"], + // ["export-interface", "export-type"], + // "declare-class", + // "class", + // "export-class", + // "declare-function", + // "function", + // "export-function", + // ], + // ignoreCase: true, + // newlinesBetween: "ignore", + // order: "asc", + // partitionByComment: false, + // partitionByNewLine: false, + // specialCharacters: "keep", + // type: "natural", + // }, + // ], + "perfectionist/sort-modules": "off", } satisfies Rules; diff --git a/src/rules/react.ts b/src/rules/react.ts index 4ba2f68..6419fe2 100644 --- a/src/rules/react.ts +++ b/src/rules/react.ts @@ -13,6 +13,12 @@ export const reactRules = async () => { ...jsxA11yPlugin.configs.recommended.rules, ...normalizeRuleEntries(reactPlugin.configs.flat?.recommended?.rules), ...normalizeRuleEntries(reactPlugin.configs.flat?.["jsx-runtime"]?.rules), + "react-hooks/exhaustive-deps": "error", + "react-hooks/rules-of-hooks": "error", + "react-refresh/only-export-components": [ + "warn", + { allowConstantExport: true }, + ], "react/boolean-prop-naming": "off", // revisit "react/button-has-type": "error", "react/checked-requires-onchange-or-readonly": "error", @@ -79,11 +85,5 @@ export const reactRules = async () => { "react/static-property-placement": "off", "react/style-prop-object": "error", "react/void-dom-elements-no-children": "error", - "react-hooks/exhaustive-deps": "error", - "react-hooks/rules-of-hooks": "error", - "react-refresh/only-export-components": [ - "warn", - { allowConstantExport: true }, - ], } satisfies Rules; }; diff --git a/src/types.ts b/src/types.ts index 04624ff..2dc7fc1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -37,14 +37,17 @@ export interface ReactOptions { utilities?: ReactUtilities[]; } -export type TypedConfigItem = { +export type TypedConfigItem = Omit< + Linter.Config, + "plugins" +> & { /** * An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files. * * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration) */ plugins?: Record; -} & Omit, "plugins">; +}; export interface Options { /**