UNPKG

@shayanthenerd/eslint-config

Version:

A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style

73 lines (71 loc) 2.06 kB
import { isEnabled } from "../utils/isEnabled.js"; import { defaultOptions } from "../utils/options/defaultOptions.js"; //#region src/rules/perfectionist.ts function getPerfectionistRules(options) { const { env, tsConfig, configs: { stylistic, perfectionist } } = options; const { maxLineLength } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic; const { sortType } = isEnabled(perfectionist) ? perfectionist : defaultOptions.configs.perfectionist; const perfectionistRules = { "perfectionist/sort-maps": "warn", "perfectionist/sort-exports": "warn", "perfectionist/sort-union-types": "warn", "perfectionist/sort-array-includes": "warn", "perfectionist/sort-intersection-types": "warn", "perfectionist/sort-named-imports": ["warn", { groupKind: "types-first" }], "perfectionist/sort-named-exports": ["warn", { groupKind: "types-first" }], "perfectionist/sort-imports": ["warn", { environment: env, tsconfig: tsConfig || void 0, sortSideEffects: true, fallbackSort: { order: "asc", type: "natural" }, partitionByComment: true, specialCharacters: "trim", type: sortType, maxLineLength, customGroups: [{ groupName: "vue-sfc", elementNamePattern: ["\\.(vue|[jt]sx)$"] }, { groupName: "image", elementNamePattern: ["\\.(ico|svg|gif|png|jpe?g|webp|avif|heic)$"] }], groups: [ ["style", "side-effect-style"], { newlinesBetween: 0 }, "side-effect", "image", "vue-sfc", "type-external", { newlinesBetween: 0 }, "type-builtin", { newlinesBetween: 0 }, ["type-tsconfig-path", "type-subpath"], { newlinesBetween: 0 }, [ "type-internal", "type-index", "type-parent", "type-sibling" ], "external", { newlinesBetween: 0 }, "builtin", ["tsconfig-path", "subpath"], { newlinesBetween: 0 }, [ "internal", "index", "parent", "sibling" ], ["import", "unknown"] ] }] }; return perfectionistRules; } //#endregion export { getPerfectionistRules };