From 191848fdca22f268d866ae61016f052069f3609e Mon Sep 17 00:00:00 2001 From: Alex <8125011+alex-kinokon@users.noreply.github.com> Date: Sun, 11 Aug 2024 17:32:54 -0400 Subject: [PATCH] Update --- dist/index.d.ts | 9 +- dist/package.json | 17 +-- package.json | 20 +-- pnpm-lock.yaml | 134 ++++++++++++------ scripts/build-local-rules.ts | 4 +- scripts/build.ts | 2 +- src/commits.json | 6 +- src/{rules => custom}/index.ts | 0 .../no-empty-object-literal.ts | 0 src/{rules => custom}/no-import-dot.ts | 0 .../restrict-template-expressions.ts | 0 src/index.ts | 13 +- src/presets/eslint.ts | 9 -- src/presets/stylistic.ts | 19 +++ src/redirect.ts | 2 +- 15 files changed, 151 insertions(+), 84 deletions(-) rename src/{rules => custom}/index.ts (100%) rename src/{rules => custom}/no-empty-object-literal.ts (100%) rename src/{rules => custom}/no-import-dot.ts (100%) rename src/{rules => custom}/restrict-template-expressions.ts (100%) create mode 100644 src/presets/stylistic.ts diff --git a/dist/index.d.ts b/dist/index.d.ts index a316661..fcdc11d 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -16,15 +16,15 @@ export interface MiddlewareFunctions { addSettings(settings: Partial): void; } export type Middleware = (config: MiddlewareConfig, helpers: MiddlewareFunctions) => void; -export declare const error = "error"; -export declare const warn = "warn"; -export declare const off = "off"; export declare const graphql: Middleware; export declare const jsdoc: Middleware; export declare const storybook: Middleware; export declare const react: Middleware; export declare const reactRefresh: Middleware; export declare const tailwind: Middleware; +export declare const error = "error"; +export declare const warn = "warn"; +export declare const off = "off"; export type RuleLevel = "error" | "warn" | "off" | 0 | 1 | 2; export type RuleEntry = RuleLevel | [ RuleLevel, @@ -90,6 +90,9 @@ export type InputConfig = Omit & { * * Non bundled: * 1. [`graphql`](https://the-guild.dev/graphql/eslint/rules) + * + * @param of Configuration options. + * @returns ESLint configuration object. */ export declare function extendConfig(of?: InputConfig & { middlewares?: Middleware[]; diff --git a/dist/package.json b/dist/package.json index ac8f269..37e43de 100644 --- a/dist/package.json +++ b/dist/package.json @@ -1,6 +1,6 @@ { "name": "@aet/eslint-rules", - "version": "1.0.1-beta.22", + "version": "1.0.1-beta.25", "license": "UNLICENSED", "bin": { "eslint-install": "install.js", @@ -13,15 +13,16 @@ "dependencies": { "@antfu/install-pkg": "^0.3.3", "@nolyfill/is-core-module": "^1.0.39", - "@aet/eslint-define-config": "^0.1.0-beta.17", + "@aet/eslint-define-config": "^0.1.0-beta.21", "@eslint-community/eslint-utils": "^4.4.0", "@tanstack/eslint-plugin-query": "^5.51.15", "@types/eslint": "^9.6.0", - "@typescript-eslint/eslint-plugin": "^8.0.1", - "@typescript-eslint/parser": "^8.0.1", - "@typescript-eslint/type-utils": "^8.0.1", - "@typescript-eslint/utils": "^8.0.1", - "@eslint-react/eslint-plugin": "1.7.1", + "@typescript-eslint/eslint-plugin": "^7.18.0", + "@typescript-eslint/parser": "^7.18.0", + "@typescript-eslint/type-utils": "^7.18.0", + "@typescript-eslint/utils": "^7.18.0", + "@eslint-react/eslint-plugin": "1.10.0", + "@stylistic/eslint-plugin": "^2.6.2", "aria-query": "^5.3.0", "axe-core": "^4.10.0", "axobject-query": "4.1.0", @@ -35,7 +36,7 @@ "eslint-module-utils": "^2.8.1", "eslint-plugin-es-x": "^8.0.0", "eslint-plugin-import-x": "^3.1.0", - "eslint-plugin-jsdoc": "^50.0.0", + "eslint-plugin-jsdoc": "^50.0.1", "eslint-plugin-react-refresh": "^0.4.9", "eslint-plugin-unicorn": "^55.0.0", "esprima": "^4.0.1", diff --git a/package.json b/package.json index 05907a3..1b4529a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "private": true, "devDependencies": { - "@aet/eslint-define-config": "^0.1.0-beta.17", + "@aet/eslint-define-config": "^0.1.0-beta.21", "@antfu/install-pkg": "^0.3.3", "@babel/core": "^7.25.2", "@babel/plugin-transform-flow-strip-types": "^7.25.2", @@ -21,12 +21,12 @@ "@types/estree": "^1.0.5", "@types/estree-jsx": "^1.0.5", "@types/lodash": "^4.17.7", - "@types/node": "^22.1.0", - "@typescript-eslint/eslint-plugin": "^8.0.0", - "@typescript-eslint/type-utils": "^8.0.0", - "@typescript-eslint/types": "^8.0.0", - "@typescript-eslint/typescript-estree": "^8.0.0", - "@typescript-eslint/utils": "^8.0.0", + "@types/node": "^22.2.0", + "@typescript-eslint/eslint-plugin": "^8.0.1", + "@typescript-eslint/type-utils": "^8.0.1", + "@typescript-eslint/types": "^8.0.1", + "@typescript-eslint/typescript-estree": "^8.0.1", + "@typescript-eslint/utils": "^8.0.1", "babel-plugin-macros": "^3.1.0", "dts-bundle-generator": "9.4.0", "esbuild": "0.23.0", @@ -34,7 +34,7 @@ "eslint": "8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import-x": "^3.1.0", - "eslint-plugin-jsdoc": "^48.11.0", + "eslint-plugin-jsdoc": "^50.0.1", "eslint-plugin-unicorn": "^55.0.0", "esprima": "^4.0.1", "esquery": "^1.6.0", @@ -47,8 +47,8 @@ "picocolors": "^1.0.1", "prettier": "^3.3.3", "prop-types": "^15.8.1", - "terser": "^5.31.3", - "type-fest": "^4.23.0", + "terser": "^5.31.5", + "type-fest": "^4.24.0", "typescript": "^5.5.4" }, "prettier": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 49e56b9..49f1b96 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,8 +28,8 @@ importers: .: devDependencies: '@aet/eslint-define-config': - specifier: ^0.1.0-beta.17 - version: 0.1.0-beta.17 + specifier: ^0.1.0-beta.18 + version: 0.1.0-beta.18 '@antfu/install-pkg': specifier: ^0.3.3 version: 0.3.3 @@ -67,20 +67,20 @@ importers: specifier: ^4.17.7 version: 4.17.7 '@types/node': - specifier: ^22.1.0 - version: 22.1.0 + specifier: ^22.2.0 + version: 22.2.0 '@typescript-eslint/eslint-plugin': - specifier: ^8.0.0 - version: 8.0.0(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4) + specifier: ^8.0.1 + version: 8.0.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/type-utils': - specifier: ^8.0.0 - version: 8.0.0(eslint@8.57.0)(typescript@5.5.4) + specifier: ^8.0.1 + version: 8.0.1(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/types': - specifier: ^8.0.0 - version: 8.0.0 + specifier: ^8.0.1 + version: 8.0.1 '@typescript-eslint/typescript-estree': - specifier: ^8.0.0 - version: 8.0.0(patch_hash=zlal42evfhopemboiioznx3k3i)(typescript@5.5.4) + specifier: ^8.0.1 + version: 8.0.1(typescript@5.5.4) '@typescript-eslint/utils': specifier: 8.0.0 version: 8.0.0(eslint@8.57.0)(typescript@5.5.4) @@ -106,8 +106,8 @@ importers: specifier: ^3.1.0 version: 3.1.0(eslint@8.57.0)(typescript@5.5.4) eslint-plugin-jsdoc: - specifier: ^48.11.0 - version: 48.11.0(eslint@8.57.0) + specifier: ^50.0.1 + version: 50.0.1(eslint@8.57.0) eslint-plugin-unicorn: specifier: ^55.0.0 version: 55.0.0(eslint@8.57.0) @@ -145,19 +145,19 @@ importers: specifier: ^15.8.1 version: 15.8.1 terser: - specifier: ^5.31.3 - version: 5.31.3 + specifier: ^5.31.5 + version: 5.31.5 type-fest: - specifier: ^4.23.0 - version: 4.23.0 + specifier: ^4.24.0 + version: 4.24.0 typescript: specifier: ^5.5.4 version: 5.5.4 packages: - '@aet/eslint-define-config@0.1.0-beta.17': - resolution: {integrity: sha512-gwQUwwmneD+dqbZpEcR9sws0Xbd1zpTSbGUswsFtJS4B7iVqUhE7ovf3NlSw8igo6aKrncMKe9o5969C1p2u5A==} + '@aet/eslint-define-config@0.1.0-beta.18': + resolution: {integrity: sha512-s5BWjeE78j8cNvIfjztTGsvRM03Asx9wG62Ibf1lkUt/ZMGcw2GBTMgzOoURb9HXdxnTbaz7MmGK0ZxzVXTYDQ==} engines: {node: '>=18.0.0', npm: '>=9.0.0'} '@ampproject/remapping@2.3.0': @@ -1015,8 +1015,8 @@ packages: '@types/lodash@4.17.7': resolution: {integrity: sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==} - '@types/node@22.1.0': - resolution: {integrity: sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==} + '@types/node@22.2.0': + resolution: {integrity: sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==} '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} @@ -1024,8 +1024,8 @@ packages: '@types/parse-json@4.0.2': resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} - '@typescript-eslint/eslint-plugin@8.0.0': - resolution: {integrity: sha512-STIZdwEQRXAHvNUS6ILDf5z3u95Gc8jzywunxSNqX00OooIemaaNIA0vEgynJlycL5AjabYLLrIyHd4iazyvtg==} + '@typescript-eslint/eslint-plugin@8.0.1': + resolution: {integrity: sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 @@ -1049,8 +1049,12 @@ packages: resolution: {integrity: sha512-V0aa9Csx/ZWWv2IPgTfY7T4agYwJyILESu/PVqFtTFz9RIS823mAze+NbnBI8xiwdX3iqeQbcTYlvB04G9wyQw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.0.0': - resolution: {integrity: sha512-mJAFP2mZLTBwAn5WI4PMakpywfWFH5nQZezUQdSKV23Pqo6o9iShQg1hP2+0hJJXP2LnZkWPphdIq4juYYwCeg==} + '@typescript-eslint/scope-manager@8.0.1': + resolution: {integrity: sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/type-utils@8.0.1': + resolution: {integrity: sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -1062,6 +1066,10 @@ packages: resolution: {integrity: sha512-wgdSGs9BTMWQ7ooeHtu5quddKKs5Z5dS+fHLbrQI+ID0XWJLODGMHRfhwImiHoeO2S5Wir2yXuadJN6/l4JRxw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/types@8.0.1': + resolution: {integrity: sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/typescript-estree@8.0.0': resolution: {integrity: sha512-5b97WpKMX+Y43YKi4zVcCVLtK5F98dFls3Oxui8LbnmRsseKenbbDinmvxrWegKDMmlkIq/XHuyy0UGLtpCDKg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1071,6 +1079,15 @@ packages: typescript: optional: true + '@typescript-eslint/typescript-estree@8.0.1': + resolution: {integrity: sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + '@typescript-eslint/utils@8.0.0': resolution: {integrity: sha512-k/oS/A/3QeGLRvOWCg6/9rATJL5rec7/5s1YmdS0ZU6LHveJyGFwBvLhSRBv6i9xaj7etmosp+l+ViN1I9Aj/Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1081,6 +1098,10 @@ packages: resolution: {integrity: sha512-oN0K4nkHuOyF3PVMyETbpP5zp6wfyOvm7tWhTMfoqxSSsPmJIh6JNASuZDlODE8eE+0EB9uar+6+vxr9DBTYOA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/visitor-keys@8.0.1': + resolution: {integrity: sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -1325,8 +1346,8 @@ packages: peerDependencies: eslint: ^8.56.0 || ^9.0.0-0 - eslint-plugin-jsdoc@48.11.0: - resolution: {integrity: sha512-d12JHJDPNo7IFwTOAItCeJY1hcqoIxE0lHA8infQByLilQ9xkqrRa6laWCnsuCrf+8rUnvxXY1XuTbibRBNylA==} + eslint-plugin-jsdoc@50.0.1: + resolution: {integrity: sha512-UayhAysIk1Du8InV27WMbV4AMSJSu60+bekmeuGK2OUy4QJSFPr1srYT6AInykGkmMdRuHfDX6Q0tJEr8BtDtg==} engines: {node: '>=18'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 @@ -1976,8 +1997,8 @@ packages: resolution: {integrity: sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==} engines: {node: ^14.18.0 || >=16.0.0} - terser@5.31.3: - resolution: {integrity: sha512-pAfYn3NIZLyZpa83ZKigvj6Rn9c/vd5KfYGX7cN1mnzqgDcxWvrU5ZtAfIKhEXz9nRecw4z3LXkjaq96/qZqAA==} + terser@5.31.5: + resolution: {integrity: sha512-YPmas0L0rE1UyLL/llTWA0SiDOqIcAQYLeUj7cJYzXHlRTAnMSg9pPe4VJ5PlKvTrPQsdVFuiRiwyeNlYgwh2Q==} engines: {node: '>=10'} hasBin: true @@ -2028,8 +2049,8 @@ packages: resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} engines: {node: '>=8'} - type-fest@4.23.0: - resolution: {integrity: sha512-ZiBujro2ohr5+Z/hZWHESLz3g08BBdrdLMieYFULJO+tWc437sn8kQsWLJoZErY8alNhxre9K4p3GURAG11n+w==} + type-fest@4.24.0: + resolution: {integrity: sha512-spAaHzc6qre0TlZQQ2aA/nGMe+2Z/wyGk5Z+Ru2VUfdNwT6kWO6TjevOlpebsATEG1EIQ2sOiDszud3lO5mt/Q==} engines: {node: '>=16'} typescript@5.5.4: @@ -2122,7 +2143,7 @@ packages: snapshots: - '@aet/eslint-define-config@0.1.0-beta.17': {} + '@aet/eslint-define-config@0.1.0-beta.18': {} '@ampproject/remapping@2.3.0': dependencies: @@ -3113,7 +3134,7 @@ snapshots: '@types/lodash@4.17.7': {} - '@types/node@22.1.0': + '@types/node@22.2.0': dependencies: undici-types: 6.13.0 @@ -3121,14 +3142,14 @@ snapshots: '@types/parse-json@4.0.2': {} - '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 '@typescript-eslint/parser': 8.0.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/scope-manager': 8.0.0 - '@typescript-eslint/type-utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.0.1 + '@typescript-eslint/type-utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.0.0 + '@typescript-eslint/visitor-keys': 8.0.1 eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -3157,9 +3178,14 @@ snapshots: '@typescript-eslint/types': 8.0.0 '@typescript-eslint/visitor-keys': 8.0.0 - '@typescript-eslint/type-utils@8.0.0(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/scope-manager@8.0.1': dependencies: - '@typescript-eslint/typescript-estree': 8.0.0(patch_hash=zlal42evfhopemboiioznx3k3i)(typescript@5.5.4) + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/visitor-keys': 8.0.1 + + '@typescript-eslint/type-utils@8.0.1(eslint@8.57.0)(typescript@5.5.4)': + dependencies: + '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) '@typescript-eslint/utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.5.4) @@ -3171,6 +3197,8 @@ snapshots: '@typescript-eslint/types@8.0.0': {} + '@typescript-eslint/types@8.0.1': {} + '@typescript-eslint/typescript-estree@8.0.0(patch_hash=zlal42evfhopemboiioznx3k3i)(typescript@5.5.4)': dependencies: '@typescript-eslint/types': 8.0.0 @@ -3186,6 +3214,21 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/typescript-estree@8.0.1(typescript@5.5.4)': + dependencies: + '@typescript-eslint/types': 8.0.1 + '@typescript-eslint/visitor-keys': 8.0.1 + debug: 4.3.6 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@5.5.4) + optionalDependencies: + typescript: 5.5.4 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/utils@8.0.0(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) @@ -3202,6 +3245,11 @@ snapshots: '@typescript-eslint/types': 8.0.0 eslint-visitor-keys: 3.4.3 + '@typescript-eslint/visitor-keys@8.0.1': + dependencies: + '@typescript-eslint/types': 8.0.1 + eslint-visitor-keys: 3.4.3 + '@ungap/structured-clone@1.2.0': {} '@yarnpkg/lockfile@1.1.0': {} @@ -3461,7 +3509,7 @@ snapshots: - supports-color - typescript - eslint-plugin-jsdoc@48.11.0(eslint@8.57.0): + eslint-plugin-jsdoc@50.0.1(eslint@8.57.0): dependencies: '@es-joy/jsdoccomment': 0.46.0 are-docs-informative: 0.0.2 @@ -4120,7 +4168,7 @@ snapshots: '@pkgr/core': 0.1.1 tslib: 2.6.3 - terser@5.31.3: + terser@5.31.5: dependencies: '@jridgewell/source-map': 0.3.6 acorn: 8.12.1 @@ -4159,7 +4207,7 @@ snapshots: type-fest@0.8.1: {} - type-fest@4.23.0: {} + type-fest@4.24.0: {} typescript@5.5.4: {} diff --git a/scripts/build-local-rules.ts b/scripts/build-local-rules.ts index 84b95d1..e71753f 100755 --- a/scripts/build-local-rules.ts +++ b/scripts/build-local-rules.ts @@ -3,7 +3,7 @@ import { promises as fs } from 'node:fs'; import { camelCase } from 'lodash'; export async function buildLocalRules() { - const files = (await fs.readdir('./src/rules')) + const files = (await fs.readdir('./src/custom')) .filter(file => file.endsWith('.ts')) .filter(file => file !== 'index.ts') .map(file => file.slice(0, -3)); @@ -22,7 +22,7 @@ export const rules: Record< }; `.trim(); - await fs.writeFile('./src/rules/index.ts', entryFile + '\n'); + await fs.writeFile('./src/custom/index.ts', entryFile + '\n'); } if (require.main === module) { diff --git a/scripts/build.ts b/scripts/build.ts index ba8e3f4..82cc333 100755 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -168,7 +168,7 @@ async function main() { bundle('./packages/eslint-plugin-react-hooks/index.ts'), bundle('./packages/eslint-plugin-n/lib/index.js', './dist/eslint-plugin-n/index.js'), bundle('./packages/eslint-import-resolver-typescript/src/index.ts'), - bundle('./src/rules/index.ts', './dist/eslint-plugin-rules/index.js'), + bundle('./src/custom/index.ts', './dist/eslint-plugin-custom/index.js'), bundle('./src/local/index.ts', './dist/eslint-plugin-local/index.js'), bundle('./src/index.ts', './dist/index.js', unminify), bundle('./src/types.ts', './dist/types.js', unminify), diff --git a/src/commits.json b/src/commits.json index aff2ea7..b6414f2 100644 --- a/src/commits.json +++ b/src/commits.json @@ -18,10 +18,10 @@ "subject": "[readme] fix typo in shareable config section in readme" }, "eslint-plugin-n": { - "hash": "6744257b43560181412a76eadeb7de564b886ad4", - "date": "2024-07-26T11:46:54+01:00", + "hash": "e5e758ea0cd238220127ae7bcbd967f1d8920f28", + "date": "2024-08-06T04:22:42+12:00", "committer": "GitHub", - "subject": "chore(master): release 17.10.1 (#319)" + "subject": "docs(process-exit-as-throw): update wording (#323)" }, "eslint-plugin-react": { "hash": "983b88dd3cb5e07919517d3fde4085f60883ded7", diff --git a/src/rules/index.ts b/src/custom/index.ts similarity index 100% rename from src/rules/index.ts rename to src/custom/index.ts diff --git a/src/rules/no-empty-object-literal.ts b/src/custom/no-empty-object-literal.ts similarity index 100% rename from src/rules/no-empty-object-literal.ts rename to src/custom/no-empty-object-literal.ts diff --git a/src/rules/no-import-dot.ts b/src/custom/no-import-dot.ts similarity index 100% rename from src/rules/no-import-dot.ts rename to src/custom/no-import-dot.ts diff --git a/src/rules/restrict-template-expressions.ts b/src/custom/restrict-template-expressions.ts similarity index 100% rename from src/rules/restrict-template-expressions.ts rename to src/custom/restrict-template-expressions.ts diff --git a/src/index.ts b/src/index.ts index b64819e..67d2023 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,8 +10,9 @@ import { importTypeScript } from './presets/typescript'; import { unicorn } from './presets/unicorn'; import { eslintRules } from './presets/eslint'; import { custom } from './presets/custom'; -import { error, warn, off } from './constants'; +import { off } from './constants'; import { checkEnv } from './env'; +import { stylistic } from './presets/stylistic'; export { graphql } from './presets/graphql'; export { jsdoc } from './presets/jsdoc'; @@ -19,7 +20,7 @@ export { storybook } from './presets/misc'; export { react, reactRefresh } from './presets/react'; export { tailwind } from './presets/tailwind'; -export { error, warn, off }; +export { error, warn, off } from './constants'; declare global { interface Array { @@ -103,6 +104,9 @@ export type InputConfig = Omit & { * * Non bundled: * 1. [`graphql`](https://the-guild.dev/graphql/eslint/rules) + * + * @param of Configuration options. + * @returns ESLint configuration object. */ export function extendConfig( of: InputConfig & { @@ -124,8 +128,8 @@ export function extendConfig( ...rest } = of; - let plugins: Plugin[] = [..._plugins]; - let extend: Extends[] = ensureArray(_extends); + const plugins: Plugin[] = [..._plugins]; + const extend: Extends[] = ensureArray(_extends); if (customRuleFiles != null) { plugins.push('local'); @@ -135,6 +139,7 @@ export function extendConfig( importTypeScript, unicorn, custom, + stylistic, ...(auto ? checkEnv() : []), ..._middlewares, ]); diff --git a/src/presets/eslint.ts b/src/presets/eslint.ts index d24f976..1d71d8f 100644 --- a/src/presets/eslint.ts +++ b/src/presets/eslint.ts @@ -43,15 +43,6 @@ export const eslintRules: Partial = { 'prefer-spread': warn, 'quote-props': [error, 'as-needed'], 'sort-imports': [warn, { ignoreDeclarationSort: true }], - 'spaced-comment': [ - error, - 'always', - { - markers: ['/', '#', '@'], - // allow /*@__PURE__*/ - block: { exceptions: ['@'] }, - }, - ], complexity: [warn, { max: 100 }], curly: [error, 'multi-line', 'consistent'], eqeqeq: [error, 'smart'], diff --git a/src/presets/stylistic.ts b/src/presets/stylistic.ts new file mode 100644 index 0000000..f9fb186 --- /dev/null +++ b/src/presets/stylistic.ts @@ -0,0 +1,19 @@ +import { error } from '../constants'; +import { defineMiddleware } from '../middleware'; +import type { StylisticRulesObject } from '@aet/eslint-define-config/src/rules/stylistic'; + +const stylisticRules: Partial = { + 'stylistic/spaced-comment': [ + error, + 'always', + { + markers: ['/', '#', '@'], + // allow /*@__PURE__*/ + block: { exceptions: ['@'] }, + }, + ], +}; + +export const stylistic = defineMiddleware((_, { addRules }) => { + addRules(stylisticRules); +}); diff --git a/src/redirect.ts b/src/redirect.ts index 644ffd2..e456e70 100644 --- a/src/redirect.ts +++ b/src/redirect.ts @@ -8,7 +8,7 @@ const alias = new Set([ 'eslint-plugin-local', 'eslint-plugin-n', 'eslint-plugin-react-hooks', - 'eslint-plugin-rules', + 'eslint-plugin-custom', ]); type CDR = T extends [any, ...infer R] ? R : [];