eslint-config-gorgon 3.2.5 → 3.3.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/README.md +13 -5
- package/dist/index.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -18,19 +18,25 @@ pnpm i -D eslint-config-gorgon
|
|
|
18
18
|
`.eslint.config.mjs`
|
|
19
19
|
|
|
20
20
|
```js
|
|
21
|
-
import gorgon from
|
|
22
|
-
export default gorgon
|
|
21
|
+
import gorgon from "eslint-config-gorgon";
|
|
22
|
+
export default gorgon;
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### With Options
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
|
-
import { init } from
|
|
29
|
-
export default init({
|
|
28
|
+
import { init } from "eslint-config-gorgon";
|
|
29
|
+
export default init({
|
|
30
|
+
a11y: true,
|
|
31
|
+
react: true,
|
|
32
|
+
tailwind: true,
|
|
33
|
+
prettier: true,
|
|
34
|
+
typescript: true,
|
|
35
|
+
});
|
|
30
36
|
```
|
|
31
37
|
|
|
38
|
+
### VsCode Setting (ESLint 触发 Prettier,推荐给想只用 ESLint 的团队)
|
|
32
39
|
|
|
33
|
-
### VsCode Setting (Optional)
|
|
34
40
|
`./vscode/settings.json`
|
|
35
41
|
|
|
36
42
|
```json
|
|
@@ -51,3 +57,5 @@ export default init({ a11y: true, react: true, tailwind: true, prettier: true, t
|
|
|
51
57
|
"recommendations": ["dbaeumer.vscode-eslint"]
|
|
52
58
|
}
|
|
53
59
|
```
|
|
60
|
+
|
|
61
|
+
> 若你更偏好由 Prettier 扩展直接格式化(而非 ESLint 触发),将 `editor.formatOnSave` 设为 `true`,并把默认格式化器设为 Prettier 扩展;此时可忽略上面的 `codeActionsOnSave` 设置。
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var z=Object.create;var x=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var i=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var A=(r,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of O(e))!D.call(r,t)&&t!==o&&x(r,t,{get:()=>e[t],enumerable:!(n=_(e,t))||n.enumerable});return r};var M=(r,e,o)=>(o=r!=null?z(J(r)):{},A(e||!r||!r.__esModule?x(o,"default",{value:r,enumerable:!0}):o,r));var h=i((Sr,U)=>{U.exports={name:"@eslint/js",version:"9.32.0",description:"ESLint JavaScript language implementation",funding:"https://eslint.org/donate",main:"./src/index.js",types:"./types/index.d.ts",scripts:{"test:types":"tsc -p tests/types/tsconfig.json"},files:["LICENSE","README.md","src","types"],publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/eslint/eslint.git",directory:"packages/js"},homepage:"https://eslint.org",bugs:"https://github.com/eslint/eslint/issues/",keywords:["javascript","eslint-plugin","eslint"],license:"MIT",engines:{node:"^18.18.0 || ^20.9.0 || >=21.1.0"}}});var w=i((jr,b)=>{"use strict";b.exports=Object.freeze({rules:{"accessor-pairs":"error","array-callback-return":"error","arrow-body-style":"error","block-scoped-var":"error",camelcase:"error","capitalized-comments":"error","class-methods-use-this":"error",complexity:"error","consistent-return":"error","consistent-this":"error","constructor-super":"error",curly:"error","default-case":"error","default-case-last":"error","default-param-last":"error","dot-notation":"error",eqeqeq:"error","for-direction":"error","func-name-matching":"error","func-names":"error","func-style":"error","getter-return":"error","grouped-accessor-pairs":"error","guard-for-in":"error","id-denylist":"error","id-length":"error","id-match":"error","init-declarations":"error","logical-assignment-operators":"error","max-classes-per-file":"error","max-depth":"error","max-lines":"error","max-lines-per-function":"error","max-nested-callbacks":"error","max-params":"error","max-statements":"error","new-cap":"error","no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-await-in-loop":"error","no-bitwise":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":"error","no-console":"error","no-const-assign":"error","no-constant-binary-expression":"error","no-constant-condition":"error","no-constructor-return":"error","no-continue":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-div-regex":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-else-if":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-duplicate-imports":"error","no-else-return":"error","no-empty":"error","no-empty-character-class":"error","no-empty-function":"error","no-empty-pattern":"error","no-empty-static-block":"error","no-eq-null":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-extra-label":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implicit-coercion":"error","no-implicit-globals":"error","no-implied-eval":"error","no-import-assign":"error","no-inline-comments":"error","no-inner-declarations":"error","no-invalid-regexp":"error","no-invalid-this":"error","no-irregular-whitespace":"error","no-iterator":"error","no-label-var":"error","no-labels":"error","no-lone-blocks":"error","no-lonely-if":"error","no-loop-func":"error","no-loss-of-precision":"error","no-magic-numbers":"error","no-misleading-character-class":"error","no-multi-assign":"error","no-multi-str":"error","no-negated-condition":"error","no-nested-ternary":"error","no-new":"error","no-new-func":"error","no-new-native-nonconstructor":"error","no-new-wrappers":"error","no-nonoctal-decimal-escape":"error","no-obj-calls":"error","no-object-constructor":"error","no-octal":"error","no-octal-escape":"error","no-param-reassign":"error","no-plusplus":"error","no-promise-executor-return":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":"error","no-regex-spaces":"error","no-restricted-exports":"error","no-restricted-globals":"error","no-restricted-imports":"error","no-restricted-properties":"error","no-restricted-syntax":"error","no-return-assign":"error","no-script-url":"error","no-self-assign":"error","no-self-compare":"error","no-sequences":"error","no-setter-return":"error","no-shadow":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-ternary":"error","no-this-before-super":"error","no-throw-literal":"error","no-unassigned-vars":"error","no-undef":"error","no-undef-init":"error","no-undefined":"error","no-underscore-dangle":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":"error","no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unsafe-optional-chaining":"error","no-unused-expressions":"error","no-unused-labels":"error","no-unused-private-class-members":"error","no-unused-vars":"error","no-use-before-define":"error","no-useless-assignment":"error","no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-concat":"error","no-useless-constructor":"error","no-useless-escape":"error","no-useless-rename":"error","no-useless-return":"error","no-var":"error","no-void":"error","no-warning-comments":"error","no-with":"error","object-shorthand":"error","one-var":"error","operator-assignment":"error","prefer-arrow-callback":"error","prefer-const":"error","prefer-destructuring":"error","prefer-exponentiation-operator":"error","prefer-named-capture-group":"error","prefer-numeric-literals":"error","prefer-object-has-own":"error","prefer-object-spread":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":"error","prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error",radix:"error","require-atomic-updates":"error","require-await":"error","require-unicode-regexp":"error","require-yield":"error","sort-imports":"error","sort-keys":"error","sort-vars":"error",strict:"error","symbol-description":"error","unicode-bom":"error","use-isnan":"error","valid-typeof":"error","vars-on-top":"error",yoda:"error"}})});var j=i((Cr,S)=>{"use strict";S.exports=Object.freeze({rules:Object.freeze({"constructor-super":"error","for-direction":"error","getter-return":"error","no-async-promise-executor":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":"error","no-const-assign":"error","no-constant-binary-expression":"error","no-constant-condition":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-else-if":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":"error","no-empty-character-class":"error","no-empty-pattern":"error","no-empty-static-block":"error","no-ex-assign":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-new-native-nonconstructor":"error","no-nonoctal-decimal-escape":"error","no-obj-calls":"error","no-octal":"error","no-prototype-builtins":"error","no-redeclare":"error","no-regex-spaces":"error","no-self-assign":"error","no-setter-return":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-this-before-super":"error","no-undef":"error","no-unexpected-multiline":"error","no-unreachable":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unsafe-optional-chaining":"error","no-unused-labels":"error","no-unused-private-class-members":"error","no-unused-vars":"error","no-useless-backreference":"error","no-useless-catch":"error","no-useless-escape":"error","no-with":"error","require-yield":"error","use-isnan":"error","valid-typeof":"error"})})});var v=i((vr,C)=>{"use strict";var{name:X,version:B}=h();C.exports={meta:{name:X,version:B},configs:{all:w(),recommended:j()}}});import N from"eslint-plugin-perfectionist";var Q=[N.configs["recommended-natural"],{rules:{curly:["error","multi-line"],"no-console":"warn","no-unused-vars":"warn","perfectionist/sort-enums":"warn"}}],c=Q;var T=M(v(),1);import G from"@typescript-eslint/parser";import{importX as l}from"eslint-plugin-import-x";var K=[T.default.configs.recommended,l.flatConfigs.recommended,l.flatConfigs.typescript,{files:["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],languageOptions:{ecmaVersion:"latest",parser:G,sourceType:"module"},plugins:{"import-x":l},rules:{"import-x/first":"error","import-x/newline-after-import":"error","import-x/no-duplicates":["error",{considerQueryString:!0}],"no-duplicate-imports":"off"}}],p=K;import V from"eslint-plugin-jsx-a11y";var W=[V.flatConfigs.recommended],u=W;import Y from"eslint-config-prettier";var Z=[Y],f=Z;import E from"eslint-plugin-react";import{default as $}from"eslint-plugin-react-hooks";var rr=[E.configs.flat.recommended,$.configs["recommended-latest"],{...E.configs.flat["jsx-runtime"],files:["**/*.ts","**/*.tsx","**/*.jsx","**/*.js"],settings:{react:{version:"detect"}}}],d=rr;import er from"eslint-plugin-sonarjs";var or=[er.configs.recommended],m=or;import nr from"eslint-plugin-tailwindcss";var tr=[{files:["**/*.{js,jsx,ts,tsx,vue,html}"],name:"tailwindcss/recommended",plugins:{tailwindcss:nr},rules:{"tailwindcss/classnames-order":"warn","tailwindcss/no-custom-classname":"off"}}],g=tr;import sr from"typescript-eslint";var ir=[...sr.configs.recommended,{rules:{"@typescript-eslint/array-type":["error",{default:"array-simple"}],"@typescript-eslint/ban-ts-comment":["error",{"ts-check":!1,"ts-expect-error":"allow-with-description","ts-ignore":!1,"ts-nocheck":!1}],"@typescript-eslint/consistent-type-definitions":["error","interface"],"@typescript-eslint/consistent-type-imports":["warn",{fixStyle:"separate-type-imports",prefer:"type-imports"}],"@typescript-eslint/no-confusing-non-null-assertion":"error","@typescript-eslint/no-explicit-any":"warn","@typescript-eslint/no-non-null-assertion":"warn","@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",caughtErrorsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"@typescript-eslint/prefer-as-const":"error"}}],a=ir;import ar from"fast-glob";import k from"fs";import cr from"path";var lr=()=>{let r=cr.join(process.cwd(),"package.json");if(k.existsSync(r)){let e=JSON.parse(k.readFileSync(r,"utf-8")),o=e.dependencies||{},n=e.devDependencies||{};if("react"in o||"react"in n)return!0}try{return ar.sync(["src/**/*.jsx","src/**/*.tsx"],{cwd:process.cwd(),dot:!1,ignore:["**/node_modules/**","dist/**","output/**"]}).length>0}catch{return!1}},L=lr;import y from"fs";import F from"path";var pr=()=>["tailwind.config.js","tailwind.config.cjs","tailwind.config.mjs","tailwind.config.ts","tailwind.config.mts"].some(n=>y.existsSync(F.join(process.cwd(),n)))?!0:["postcss.config.js","postcss.config.cjs","postcss.config.mjs","postcss.config.ts","postcss.config.mts"].some(n=>{let t=F.join(process.cwd(),n);return y.existsSync(t)&&/tailwindcss/.test(y.readFileSync(t,"utf-8"))}),I=pr;import ur from"fast-glob";import fr from"fs";import dr from"path";var mr=dr.join(process.cwd(),"tsconfig.json"),gr=()=>{if(fr.existsSync(mr))return!0;try{return ur.sync(["src/**/*.ts","src/**/*.tsx"],{cwd:process.cwd(),dot:!1,ignore:["**/node_modules/**","dist/**","output/**"]}).length>0}catch{return!1}},q=gr;var P=L(),R=I(),H=q();var yr=[...c,...p,...m],s=(r,e)=>r===void 0?e:r,xr=r=>{let o=[{ignores:[...["**/node_modules/**","dist/**","output/**"],...r?.ignores??[]]},...yr];return s(r?.react,P)&&o.push(...d),s(r?.a11y,!0)&&o.push(...u),s(r?.tailwind,R)&&o.push(...g),s(r?.prettier,!0)&&o.push(...f),s(r?.typescript,H)&&(o=o.map(n=>({...n,files:["**/*.ts","**/*.tsx",...n?.files?.flat(1/0)??[]]})),o.some(n=>a.includes(n))||o.push(...a.map(n=>({...n,files:["**/*.ts","**/*.tsx",...n?.files?.flat(1/0)??[]]}))),o.push({rules:{"no-unused-vars":"off"}})),o},de=xr();export{de as default,xr as init};
|
|
1
|
+
var z=Object.create;var x=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var i=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var A=(r,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of O(e))!D.call(r,t)&&t!==o&&x(r,t,{get:()=>e[t],enumerable:!(n=_(e,t))||n.enumerable});return r};var M=(r,e,o)=>(o=r!=null?z(J(r)):{},A(e||!r||!r.__esModule?x(o,"default",{value:r,enumerable:!0}):o,r));var h=i((jr,U)=>{U.exports={name:"@eslint/js",version:"9.32.0",description:"ESLint JavaScript language implementation",funding:"https://eslint.org/donate",main:"./src/index.js",types:"./types/index.d.ts",scripts:{"test:types":"tsc -p tests/types/tsconfig.json"},files:["LICENSE","README.md","src","types"],publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/eslint/eslint.git",directory:"packages/js"},homepage:"https://eslint.org",bugs:"https://github.com/eslint/eslint/issues/",keywords:["javascript","eslint-plugin","eslint"],license:"MIT",engines:{node:"^18.18.0 || ^20.9.0 || >=21.1.0"}}});var w=i((Cr,b)=>{"use strict";b.exports=Object.freeze({rules:{"accessor-pairs":"error","array-callback-return":"error","arrow-body-style":"error","block-scoped-var":"error",camelcase:"error","capitalized-comments":"error","class-methods-use-this":"error",complexity:"error","consistent-return":"error","consistent-this":"error","constructor-super":"error",curly:"error","default-case":"error","default-case-last":"error","default-param-last":"error","dot-notation":"error",eqeqeq:"error","for-direction":"error","func-name-matching":"error","func-names":"error","func-style":"error","getter-return":"error","grouped-accessor-pairs":"error","guard-for-in":"error","id-denylist":"error","id-length":"error","id-match":"error","init-declarations":"error","logical-assignment-operators":"error","max-classes-per-file":"error","max-depth":"error","max-lines":"error","max-lines-per-function":"error","max-nested-callbacks":"error","max-params":"error","max-statements":"error","new-cap":"error","no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-await-in-loop":"error","no-bitwise":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":"error","no-console":"error","no-const-assign":"error","no-constant-binary-expression":"error","no-constant-condition":"error","no-constructor-return":"error","no-continue":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-div-regex":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-else-if":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-duplicate-imports":"error","no-else-return":"error","no-empty":"error","no-empty-character-class":"error","no-empty-function":"error","no-empty-pattern":"error","no-empty-static-block":"error","no-eq-null":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-extra-label":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implicit-coercion":"error","no-implicit-globals":"error","no-implied-eval":"error","no-import-assign":"error","no-inline-comments":"error","no-inner-declarations":"error","no-invalid-regexp":"error","no-invalid-this":"error","no-irregular-whitespace":"error","no-iterator":"error","no-label-var":"error","no-labels":"error","no-lone-blocks":"error","no-lonely-if":"error","no-loop-func":"error","no-loss-of-precision":"error","no-magic-numbers":"error","no-misleading-character-class":"error","no-multi-assign":"error","no-multi-str":"error","no-negated-condition":"error","no-nested-ternary":"error","no-new":"error","no-new-func":"error","no-new-native-nonconstructor":"error","no-new-wrappers":"error","no-nonoctal-decimal-escape":"error","no-obj-calls":"error","no-object-constructor":"error","no-octal":"error","no-octal-escape":"error","no-param-reassign":"error","no-plusplus":"error","no-promise-executor-return":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":"error","no-regex-spaces":"error","no-restricted-exports":"error","no-restricted-globals":"error","no-restricted-imports":"error","no-restricted-properties":"error","no-restricted-syntax":"error","no-return-assign":"error","no-script-url":"error","no-self-assign":"error","no-self-compare":"error","no-sequences":"error","no-setter-return":"error","no-shadow":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-ternary":"error","no-this-before-super":"error","no-throw-literal":"error","no-unassigned-vars":"error","no-undef":"error","no-undef-init":"error","no-undefined":"error","no-underscore-dangle":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":"error","no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unsafe-optional-chaining":"error","no-unused-expressions":"error","no-unused-labels":"error","no-unused-private-class-members":"error","no-unused-vars":"error","no-use-before-define":"error","no-useless-assignment":"error","no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-concat":"error","no-useless-constructor":"error","no-useless-escape":"error","no-useless-rename":"error","no-useless-return":"error","no-var":"error","no-void":"error","no-warning-comments":"error","no-with":"error","object-shorthand":"error","one-var":"error","operator-assignment":"error","prefer-arrow-callback":"error","prefer-const":"error","prefer-destructuring":"error","prefer-exponentiation-operator":"error","prefer-named-capture-group":"error","prefer-numeric-literals":"error","prefer-object-has-own":"error","prefer-object-spread":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":"error","prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error",radix:"error","require-atomic-updates":"error","require-await":"error","require-unicode-regexp":"error","require-yield":"error","sort-imports":"error","sort-keys":"error","sort-vars":"error",strict:"error","symbol-description":"error","unicode-bom":"error","use-isnan":"error","valid-typeof":"error","vars-on-top":"error",yoda:"error"}})});var j=i((vr,S)=>{"use strict";S.exports=Object.freeze({rules:Object.freeze({"constructor-super":"error","for-direction":"error","getter-return":"error","no-async-promise-executor":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":"error","no-const-assign":"error","no-constant-binary-expression":"error","no-constant-condition":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-else-if":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":"error","no-empty-character-class":"error","no-empty-pattern":"error","no-empty-static-block":"error","no-ex-assign":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-new-native-nonconstructor":"error","no-nonoctal-decimal-escape":"error","no-obj-calls":"error","no-octal":"error","no-prototype-builtins":"error","no-redeclare":"error","no-regex-spaces":"error","no-self-assign":"error","no-setter-return":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-this-before-super":"error","no-undef":"error","no-unexpected-multiline":"error","no-unreachable":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unsafe-optional-chaining":"error","no-unused-labels":"error","no-unused-private-class-members":"error","no-unused-vars":"error","no-useless-backreference":"error","no-useless-catch":"error","no-useless-escape":"error","no-with":"error","require-yield":"error","use-isnan":"error","valid-typeof":"error"})})});var v=i((Tr,C)=>{"use strict";var{name:X,version:B}=h();C.exports={meta:{name:X,version:B},configs:{all:w(),recommended:j()}}});import N from"eslint-plugin-perfectionist";var Q=[N.configs["recommended-natural"],{rules:{curly:["error","multi-line"],"no-console":"warn","no-unused-vars":"warn","perfectionist/sort-enums":"warn"}}],c=Q;var T=M(v(),1);import G from"@typescript-eslint/parser";import{importX as l}from"eslint-plugin-import-x";var K=[T.default.configs.recommended,l.flatConfigs.recommended,l.flatConfigs.typescript,{files:["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],languageOptions:{ecmaVersion:"latest",parser:G,sourceType:"module"},plugins:{"import-x":l},rules:{"import-x/first":"error","import-x/newline-after-import":"error","import-x/no-duplicates":["error",{considerQueryString:!0}],"no-duplicate-imports":"off"}}],p=K;import V from"eslint-plugin-jsx-a11y";var W=[V.flatConfigs.recommended],u=W;import Y from"eslint-config-prettier";import Z from"eslint-plugin-prettier";var $=[Y,{plugins:{prettier:Z},rules:{"prettier/prettier":"warn"}}],f=$;import E from"eslint-plugin-react";import{default as rr}from"eslint-plugin-react-hooks";var er=[E.configs.flat.recommended,rr.configs["recommended-latest"],{...E.configs.flat["jsx-runtime"],files:["**/*.ts","**/*.tsx","**/*.jsx","**/*.js"],settings:{react:{version:"detect"}}}],m=er;import or from"eslint-plugin-sonarjs";var nr=[or.configs.recommended],d=nr;import tr from"eslint-plugin-tailwindcss";var sr=[{files:["**/*.{js,jsx,ts,tsx,vue,html}"],name:"tailwindcss/recommended",plugins:{tailwindcss:tr},rules:{"tailwindcss/classnames-order":"warn","tailwindcss/no-custom-classname":"off"}}],g=sr;import ir from"typescript-eslint";var ar=[...ir.configs.recommended,{rules:{"@typescript-eslint/array-type":["error",{default:"array-simple"}],"@typescript-eslint/ban-ts-comment":["error",{"ts-check":!1,"ts-expect-error":"allow-with-description","ts-ignore":!1,"ts-nocheck":!1}],"@typescript-eslint/consistent-type-definitions":["error","interface"],"@typescript-eslint/consistent-type-imports":["warn",{fixStyle:"separate-type-imports",prefer:"type-imports"}],"@typescript-eslint/no-confusing-non-null-assertion":"error","@typescript-eslint/no-explicit-any":"warn","@typescript-eslint/no-non-null-assertion":"warn","@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",caughtErrorsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"@typescript-eslint/prefer-as-const":"error"}}],a=ar;import cr from"fast-glob";import k from"fs";import lr from"path";var pr=()=>{let r=lr.join(process.cwd(),"package.json");if(k.existsSync(r)){let e=JSON.parse(k.readFileSync(r,"utf-8")),o=e.dependencies||{},n=e.devDependencies||{};if("react"in o||"react"in n)return!0}try{return cr.sync(["src/**/*.jsx","src/**/*.tsx"],{cwd:process.cwd(),dot:!1,ignore:["**/node_modules/**","dist/**","output/**"]}).length>0}catch{return!1}},L=pr;import y from"fs";import F from"path";var ur=()=>["tailwind.config.js","tailwind.config.cjs","tailwind.config.mjs","tailwind.config.ts","tailwind.config.mts"].some(n=>y.existsSync(F.join(process.cwd(),n)))?!0:["postcss.config.js","postcss.config.cjs","postcss.config.mjs","postcss.config.ts","postcss.config.mts"].some(n=>{let t=F.join(process.cwd(),n);return y.existsSync(t)&&/tailwindcss/.test(y.readFileSync(t,"utf-8"))}),I=ur;import fr from"fast-glob";import mr from"fs";import dr from"path";var gr=dr.join(process.cwd(),"tsconfig.json"),yr=()=>{if(mr.existsSync(gr))return!0;try{return fr.sync(["src/**/*.ts","src/**/*.tsx"],{cwd:process.cwd(),dot:!1,ignore:["**/node_modules/**","dist/**","output/**"]}).length>0}catch{return!1}},q=yr;var P=L(),R=I(),H=q();var xr=[...c,...p,...d],s=(r,e)=>r===void 0?e:r,hr=r=>{let o=[{ignores:[...["**/node_modules/**","dist/**","output/**"],...r?.ignores??[]]},...xr];return s(r?.react,P)&&o.push(...m),s(r?.a11y,!0)&&o.push(...u),s(r?.tailwind,R)&&o.push(...g),s(r?.prettier,!0)&&o.push(...f),s(r?.typescript,H)&&(o=o.map(n=>({...n,files:["**/*.ts","**/*.tsx",...n?.files?.flat(1/0)??[]]})),o.some(n=>a.includes(n))||o.push(...a.map(n=>({...n,files:["**/*.ts","**/*.tsx",...n?.files?.flat(1/0)??[]]}))),o.push({rules:{"no-unused-vars":"off"}})),o},ge=hr();export{ge as default,hr as init};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-gorgon",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@types/node": "^24.2.0",
|
|
35
35
|
"@typescript-eslint/utils": "^8.39.0",
|
|
36
36
|
"eslint": "^9.32.0",
|
|
37
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
37
38
|
"husky": "^9.1.7",
|
|
38
39
|
"tsup": "^8.5.0",
|
|
39
40
|
"typescript": "^5.9.2",
|