@jimmy.codes/eslint-config 3.19.0 → 3.20.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 CHANGED
@@ -21,131 +21,51 @@ First install the package, by running the following:
21
21
  pnpm add -D @jimmy.codes/eslint-config
22
22
  ```
23
23
 
24
- Then if you want a simple configuration:
24
+ Then all you need to in your `eslint.config.js` is:
25
25
 
26
- ```js
27
- // eslint.config.mjs
28
- import jimmyDotCodes from "@jimmy.codes/eslint-config";
26
+ ```mjs
27
+ import eslintConfig from "@jimmy.codes/eslint-config";
29
28
 
30
- export default jimmyDotCodes();
29
+ export default eslintConfig();
31
30
  ```
32
31
 
33
- Or if you want to use [TypeScript configuration files](https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files), you can do the following:
34
-
35
- Add `--flag unstable_ts_config` to your eslint script, for example:
36
-
37
- ```json
38
- {
39
- "scripts": {
40
- "lint": "eslint --flag unstable_ts_config ."
41
- }
42
- }
43
- ```
44
-
45
- And add the following to your `.vscode/settings.json`:
46
-
47
- ```json
48
- "eslint.options": {
49
- "flags": ["unstable_ts_config"]
50
- }
51
- ```
32
+ Which will enable rules based on your project dependencies.
52
33
 
53
34
  ### 🔧 Configuration
54
35
 
55
- > [!NOTE]
56
- > By default all rules are enabled based on the project's dependencies.
57
-
58
36
  This package contains rules that can be enabled or disabled as follows:
59
37
 
60
- ```js
61
- import jimmyDotCodes from "@jimmy.codes/eslint-config";
62
-
63
- export default jimmyDotCodes({
64
- /**
65
- * Are TypeScript rules enabled?
66
- * @default false
67
- */
68
- typescript: true,
69
- /**
70
- * Are React rules enabled?
71
- * @default false
72
- */
73
- react: true,
74
- /**
75
- * Are Astro rules enabled?
76
- * @default false
77
- */
78
- astro: true,
79
- /**
80
- * Are testing rules enabled?
81
- * @default false
82
- */
83
- testing: true,
38
+ ```ts
39
+ import eslintConfig from "@jimmy.codes/eslint-config";
40
+
41
+ export default eslintConfig({
42
+ astro: false,
43
+ jest: false,
44
+ playwright: false,
45
+ react: false,
46
+ tanstackQuery: false,
47
+ testingLibrary: false,
48
+ typescript: false,
49
+ vitest: false,
84
50
  });
85
51
  ```
86
52
 
87
53
  Or you can turn off auto detection to disable rules based on a project's dependencies:
88
54
 
89
- ```js
90
- import jimmyDotCodes from "@jimmy.codes/eslint-config";
91
-
92
- export default jimmyDotCodes({ autoDetect: false });
93
- ```
94
-
95
- #### TypeScript
96
-
97
- You can also change the project location which can be helpful for monorepos:
98
-
99
- > [!WARNING]
100
- > This is [not recommended nor needed since the introduction of `projectService`](https://typescript-eslint.io/getting-started/typed-linting#can-i-customize-the-tsconfig-used-for-typed-linting) which this config uses by default.
101
-
102
- ```js
103
- import jimmyDotCodes from "@jimmy.codes/eslint-config";
104
-
105
- export default jimmyDotCodes({
106
- typescript: {
107
- project: ["./tsconfig.eslint.json", "./packages/*/tsconfig.json"],
108
- },
109
- });
110
- ```
111
-
112
- #### Testing
113
-
114
- By default [vitest](https://vitest.dev) is used as the testing framework but you can override and add additional rules for utilities:
115
-
116
- ```js
117
- import jimmyDotCodes from "@jimmy.codes/eslint-config";
118
-
119
- export default jimmyDotCodes({
120
- testing: {
121
- framework: "jest",
122
- utilities: ["testing-library"],
123
- },
124
- });
125
- ```
126
-
127
- #### React
128
-
129
- You can add additional rules for utilities:
130
-
131
- ```js
132
- import jimmyDotCodes from "@jimmy.codes/eslint-config";
55
+ ```ts
56
+ import eslintConfig from "@jimmy.codes/eslint-config";
133
57
 
134
- export default jimmyDotCodes({
135
- react: {
136
- utilities: ["@tanstack/query"],
137
- },
138
- });
58
+ export default eslintConfig({ autoDetect: false });
139
59
  ```
140
60
 
141
61
  #### Extending the Configuration
142
62
 
143
63
  You can also extend the configuration:
144
64
 
145
- ```js
146
- import jimmyDotCodes from "@jimmy.codes/eslint-config";
65
+ ```ts
66
+ import eslintConfig from "@jimmy.codes/eslint-config";
147
67
 
148
- export default jimmyDotCodes(
68
+ export default eslintConfig(
149
69
  {
150
70
  configs: [
151
71
  {
@@ -164,16 +84,42 @@ export default jimmyDotCodes(
164
84
  );
165
85
  ```
166
86
 
87
+ #### Ignores
88
+
167
89
  You can also extend what is ignored:
168
90
 
169
91
  ```ts
170
- import jimmyDotCodes from "@jimmy.codes/eslint-config";
92
+ import eslintConfig from "@jimmy.codes/eslint-config";
171
93
 
172
- export default jimmyDotCodes({
94
+ export default eslintConfig({
173
95
  ignores: ["**/*.mjs"],
174
96
  });
175
97
  ```
176
98
 
99
+ ### Typescript Configuration Files
100
+
101
+ If you want to use [TypeScript configuration files](https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files), you can do the following:
102
+
103
+ Add `--flag unstable_ts_config` to your eslint script, for example:
104
+
105
+ ```json
106
+ {
107
+ "scripts": {
108
+ "lint": "eslint --flag unstable_ts_config ."
109
+ }
110
+ }
111
+ ```
112
+
113
+ And add the following to your `.vscode/settings.json`:
114
+
115
+ ```json
116
+ {
117
+ "eslint.options": {
118
+ "flags": ["unstable_ts_config"]
119
+ }
120
+ }
121
+ ```
122
+
177
123
  ## ❤️ Credits
178
124
 
179
125
  - [@antfu/eslint-config](https://github.com/antfu/eslint-config) by [Anthony Fu](https://antfu.me)
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var z=Object.create;var d=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var t=(e,r)=>d(e,"name",{value:r,configurable:!0});var H=(e,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of V(r))!D.call(e,a)&&a!==s&&d(e,a,{get:()=>r[a],enumerable:!(n=Q(r,a))||n.enumerable});return e};var o=(e,r,s)=>(s=e!=null?z(X(e)):{},H(r||!e||!e.__esModule?d(s,"default",{value:e,enumerable:!0}):s,e));var g=require("globals"),f=require("typescript-eslint"),k=require("@eslint-community/eslint-plugin-eslint-comments/configs"),u=require("eslint-plugin-import-x"),P=require("eslint-plugin-n"),U=require("@eslint/js"),O=require("eslint-plugin-perfectionist"),W=require("eslint-config-prettier"),Y=require("eslint-plugin-regexp"),l=require("local-pkg"),E=require("eslint-plugin-unicorn");function M(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(s){if(s!=="default"){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:t(function(){return e[s]},"get")})}}),r.default=e,Object.freeze(r)}t(M,"_interopNamespaceDefault");var q=M(Y);const c="?([cm])[jt]s?(x)",K=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/storybook-static","**/.eslint-config-inspector","**/playwright-report","**/.astro","**/.vinxi","**/app.config.timestamp_*.js","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs","**/*.gen.*","!.storybook"],Z="**/*.?([cm])js",y="**/*.?([cm])jsx",_="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${c}`,`**/*.spec.${c}`,`**/*.test.${c}`,`**/*.bench.${c}`,`**/*.benchmark.${c}`],C=[`**/e2e/**/*.spec.${c}`,`**/e2e/**/*.test.${c}`],j=[...C,`**/cypress/**/*.spec.${c}`,`**/cypress/**/*.test.${c}`],ee="**/*.cjs",re="**/*.astro",te=["vi.mock","describe","expect","it"],se=["@testing-library/react"],i=t(async e=>{const r=await e;return r.default??r},"interopDefault"),oe=t(async()=>{const e=[re],[r,s,n]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),i(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...g.node,Astro:!1,Fragment:!1},parser:s,parserOptions:{extraFileExtensions:[".astro"],parser:f.parser},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:r,"jsx-a11y":n},processor:"astro/client-side-ts",rules:{...n.configs.recommended.rules,"astro/missing-client-only-directive-value":"error","astro/no-conflict-set-directives":"error","astro/no-deprecated-astro-canonicalurl":"error","astro/no-deprecated-astro-fetchcontent":"error","astro/no-deprecated-astro-resolve":"error","astro/no-deprecated-getentrybyslug":"error","astro/no-exports-from-components":"off","astro/no-unused-define-vars-in-style":"error","astro/valid-compile":"error"}},{files:e,languageOptions:{parserOptions:f.configs.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:f.configs.disableTypeChecked.rules},{name:"jimmy.codes/astro/imports",settings:{"import-x/core-modules":["astro:content"]}}]},"astroConfig"),ne=t(()=>[{files:[ee],languageOptions:{globals:g.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),ie={...k.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},ae=t(()=>[{...k.recommended,name:"jimmy.codes/eslint-comments",rules:ie}],"eslintCommentsConfig"),ce=t(e=>[{ignores:[...K,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),le={...u.configs.recommended.rules,"import-x/consistent-type-specifier-style":["error","prefer-top-level"],"import-x/extensions":["error","never",{checkTypedImports:!0,svg:"always"}],"import-x/first":"error","import-x/namespace":"off","import-x/newline-after-import":"error","import-x/no-absolute-path":"error","import-x/no-duplicates":"error","import-x/no-empty-named-blocks":"error","import-x/no-named-as-default":"error","import-x/no-named-as-default-member":"error","import-x/no-self-import":"error","import-x/no-unresolved":["error",{ignore:[String.raw`\.svg$`]}],"import-x/no-useless-path-segments":"error"},pe={name:"jimmy.codes/imports/typescript",rules:u.configs.typescript.rules,settings:{...u.configs.typescript.settings,"import-x/resolver":{...u.configs.typescript.settings["import-x/resolver"],typescript:!0}}},fe=t(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":u,n:P},rules:le},...e?[pe]:[]],"importsConfig"),ue={...U.configs.recommended.rules,"array-callback-return":["error",{allowImplicit:!0}],"arrow-body-style":["error","always"],curly:["error","all"],"no-console":"warn","no-self-compare":"error","no-template-curly-in-string":"error","no-unmodified-loop-condition":"error","no-unreachable-loop":"error","no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"no-useless-rename":"error","object-shorthand":"error","prefer-arrow-callback":"error"},me=t(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:ue}],"javascriptConfig"),de={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},ge=t(()=>[{name:"jimmy.codes/node",plugins:{n:P},rules:de}],"nodeConfig"),ye={...O.configs["recommended-natural"].rules,"perfectionist/sort-imports":["error",{customGroups:{type:{},value:{}},environment:"node",groups:["side-effect-style","builtin","type","external","internal-type","internal",["parent-type","sibling-type","index-type"],["parent","sibling","index"],"object","style","unknown"],internalPattern:["^~/.*","^@/.*"],order:"asc",type:"natural"}],"perfectionist/sort-modules":"off"},je=t(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:O},rules:ye}],"perfectionistConfig"),he=t(async()=>({...(await i(import("eslint-plugin-playwright"))).configs["flat/recommended"].rules,"playwright/expect-expect":"error","playwright/max-nested-describe":"error","playwright/no-conditional-expect":"error","playwright/no-conditional-in-test":"error","playwright/no-element-handle":"error","playwright/no-eval":"error","playwright/no-force-option":"error","playwright/no-nested-step":"error","playwright/no-page-pause":"error","playwright/no-skipped-test":"error","playwright/no-useless-await":"error","playwright/no-useless-not":"error","playwright/no-wait-for-selector":"error","playwright/no-wait-for-timeout":"error"}),"playwrightRules"),xe=t(async()=>[{...(await i(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:C,name:"jimmy.codes/playwright",rules:await he()}],"playwrightConfig"),be=t(()=>[{name:"jimmy.codes/prettier",...W}],"prettierConfig"),we=t(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),T=t((e={})=>Object.fromEntries(Object.entries(e).map(([r,s])=>[r,typeof s=="number"?we(s):s])),"normalizeRuleEntries"),ve=t(async()=>{const[e,r]=await Promise.all([i(import("eslint-plugin-react")),i(import("eslint-plugin-jsx-a11y"))]);return{...r.configs.recommended.rules,...T(e.configs.flat?.recommended?.rules),...T(e.configs.flat?.["jsx-runtime"]?.rules),"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"react/boolean-prop-naming":"off","react/button-has-type":"error","react/checked-requires-onchange-or-readonly":"error","react/default-props-match-prop-types":"error","react/destructuring-assignment":"off","react/forbid-component-props":"off","react/forbid-dom-props":"off","react/forbid-elements":"off","react/forbid-foreign-prop-types":"off","react/forbid-prop-types":"off","react/forward-ref-uses-ref":"error","react/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"react/jsx-curly-brace-presence":"error","react/jsx-filename-extension":"off","react/jsx-fragments":["error","syntax"],"react/jsx-handler-names":"off","react/jsx-max-depth":"off","react/jsx-no-bind":"off","react/jsx-no-constructed-context-values":"error","react/jsx-no-leaked-render":"error","react/jsx-no-literals":"off","react/jsx-no-script-url":"error","react/jsx-no-useless-fragment":"error","react/jsx-one-expression-per-line":"off","react/jsx-pascal-case":["error",{allowNamespace:!0}],"react/jsx-props-no-spread-multi":"off","react/jsx-props-no-spreading":"off","react/jsx-sort-default-props":"off","react/jsx-sort-props":"off","react/no-access-state-in-setstate":"error","react/no-adjacent-inline-elements":"off","react/no-array-index-key":"off","react/no-arrow-function-lifecycle":"error","react/no-danger":"off","react/no-did-mount-set-state":"error","react/no-did-update-set-state":"error","react/no-invalid-html-attribute":"error","react/no-multi-comp":"off","react/no-namespace":"error","react/no-object-type-as-default-prop":"error","react/no-redundant-should-component-update":"error","react/no-set-state":"off","react/no-this-in-sfc":"error","react/no-typos":"error","react/no-unstable-nested-components":"error","react/no-unused-class-component-methods":"error","react/no-unused-prop-types":"error","react/no-unused-state":"error","react/no-will-update-set-state":"error","react/prefer-es6-class":"off","react/prefer-exact-props":"off","react/prefer-read-only-props":"off","react/prefer-stateless-function":"off","react/require-default-props":"off","react/require-optimization":"off","react/self-closing-comp":"error","react/sort-comp":"off","react/sort-default-props":"off","react/sort-prop-types":"off","react/state-in-constructor":"off","react/static-property-placement":"off","react/style-prop-object":"error","react/void-dom-elements-no-children":"error"}},"reactRules"),ke=t(async()=>{const[e,r,s,n]=await Promise.all([i(import("eslint-plugin-react")),i(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),import("eslint-plugin-react-refresh")]);return[{files:[y,_],languageOptions:{globals:{...g.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":r,react:e,"react-hooks":s,"react-refresh":n},rules:await ve(),settings:{react:{version:"detect"}}}]},"reactConfig"),Pe={...q.configs["flat/recommended"].rules,"regexp/confusing-quantifier":"error","regexp/no-empty-alternative":"error","regexp/no-lazy-ends":"error","regexp/no-potentially-useless-backreference":"error","regexp/no-useless-flag":"error","regexp/optimal-lookaround-quantifier":"error"},Oe=t(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:q},rules:Pe}],"regexpConfig"),Ee=t(async()=>{const e=await i(import("@tanstack/eslint-plugin-query"));return[{files:[y,_],name:"jimmy.codes/react/query",plugins:{"@tanstack/query":e},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]},"tanstackQuery"),R=t(async()=>{const e=await i(import("eslint-plugin-jest"));return{...e.configs["flat/recommended"].rules,...e.configs["flat/style"].rules,"jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"jest/expect-expect":"error","jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/no-conditional-in-test":"error","jest/no-confusing-set-timeout":"error","jest/no-duplicate-hooks":"error","jest/no-hooks":"off","jest/no-large-snapshots":"off","jest/no-restricted-jest-methods":"off","jest/no-restricted-matchers":"off","jest/no-test-return-statement":"error","jest/no-untyped-mock-factory":"off","jest/prefer-called-with":"error","jest/prefer-comparison-matcher":"error","jest/prefer-each":"error","jest/prefer-equality-matcher":"error","jest/prefer-expect-assertions":"off","jest/prefer-expect-resolves":"error","jest/prefer-hooks-in-order":"error","jest/prefer-hooks-on-top":"error","jest/prefer-lowercase-title":"off","jest/prefer-mock-promise-shorthand":"error","jest/prefer-snapshot-hint":"error","jest/prefer-spy-on":"off","jest/prefer-strict-equal":"error","jest/prefer-todo":"warn","jest/require-hook":"error","jest/require-to-throw-message":"error","jest/require-top-level-describe":"off","jest/unbound-method":"off"}},"jestRules"),qe=t(async()=>({...await R(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:te}]}),"vitestRules"),_e=t(()=>l.isPackageExists("typescript"),"hasTypescript"),Ce=t(()=>l.isPackageExists("react"),"hasReact"),L=t(()=>l.isPackageExists("vitest"),"hasVitest"),S=t(()=>l.isPackageExists("jest"),"hasJest"),Te=t(()=>L()||S(),"hasTesting"),Re=t(()=>se.some(e=>l.isPackageExists(e)),"hasTestingLibrary"),Le=t(()=>l.isPackageExists("@tanstack/react-query"),"hasReactQuery"),Se=t(()=>l.isPackageExists("astro"),"hasAstro"),Ge=t(()=>l.isPackageExists("@playwright/test"),"hasPlaywright"),Ae=t(async({framework:e="vitest"}={},r=!0)=>{const s=r?L():e==="vitest",n=e==="jest"||r&&S(),a=[];if(s){const p=await i(import("eslint-plugin-jest"));a.push({files:m,ignores:j,...p.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await qe()})}if(n){const p=await i(import("eslint-plugin-jest"));a.push({files:m,ignores:j,...p.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await R()})}return a},"testingConfig"),Ie=t(async()=>{const[e,r]=await Promise.all([import("eslint-plugin-jest-dom"),i(import("eslint-plugin-testing-library"))]);return{...r.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),Be=t(async()=>{const[e,r]=await Promise.all([import("eslint-plugin-jest-dom"),i(import("eslint-plugin-testing-library"))]);return[{files:m,ignores:j,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":r},rules:await Ie()}]},"testingLibrary"),Ne={"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!1}],"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"separate-type-imports"}],"@typescript-eslint/no-deprecated":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}],"@typescript-eslint/no-unused-vars":["error",{args:"all",argsIgnorePattern:"^_",caughtErrors:"all",caughtErrorsIgnorePattern:"^_",destructuredArrayIgnorePattern:"^_",ignoreRestSiblings:!0,varsIgnorePattern:"^_"}],"@typescript-eslint/no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}],"no-use-before-define":"off"},$e=t(e=>[...f.configs.strictTypeChecked,...f.configs.stylisticTypeChecked.filter(r=>r.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{...e?.project?{project:e.project}:{projectService:!0},tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Ne},{files:[Z,y],...f.configs.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),Fe={...E.configs["flat/recommended"].rules,"unicorn/filename-case":"off","unicorn/import-style":"off","unicorn/no-abusive-eslint-disable":"off","unicorn/no-anonymous-default-export":"off","unicorn/no-array-callback-reference":"off","unicorn/no-array-reduce":"off","unicorn/no-null":"off","unicorn/no-process-exit":"off","unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-node-protocol":"off","unicorn/prevent-abbreviations":"off"},Je=t(()=>[{...E.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:Fe}],"unicornConfig"),ze=t(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),Qe=t(e=>typeof e=="object"?e:{framework:"vitest"},"getTestingOptions"),Ve=t(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),Xe=t(({utilities:e=[]},r)=>e.includes("@tanstack/query")||r&&Le(),"shouldEnableTanstackQuery"),De=t(({utilities:e=[]},r)=>e.includes("testing-library")||r&&Re(),"shouldEnableTestingLibrary"),He=t(async({astro:e=!1,autoDetect:r=!0,configs:s=[],ignores:n=[],playwright:a=!1,react:p=!1,testing:h=!1,typescript:x=!1}={},...G)=>{const A=Ve(p),b=Qe(h),w=ze(x),v=x||!!w||r&&_e(),I=p||r&&Ce(),B=h||r&&Te(),N=e||r&&Se(),$=Xe(A,r),F=De(b,r),J=a||r&&Ge();return[me(),je(),ge(),Je(),ae(),Oe(),fe({typescript:v}),v?$e(w):[],I?await ke():[],$?await Ee():[],N?await oe():[],B?await Ae(b,r):[],F?await Be():[],J?await xe():[],be(),ne(),ce(n),s,G].flat()},"jimmyDotCodes");module.exports=He;
1
+ "use strict";var H=Object.create;var d=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var t=(e,r)=>d(e,"name",{value:r,configurable:!0});var M=(e,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of W(r))!D.call(e,a)&&a!==s&&d(e,a,{get:()=>r[a],enumerable:!(n=U(r,a))||n.enumerable});return e};var o=(e,r,s)=>(s=e!=null?H(Y(e)):{},M(r||!e||!e.__esModule?d(s,"default",{value:e,enumerable:!0}):s,e));var g=require("globals"),p=require("typescript-eslint"),O=require("@eslint-community/eslint-plugin-eslint-comments/configs"),u=require("eslint-plugin-import-x"),E=require("eslint-plugin-n"),K=require("@eslint/js"),C=require("eslint-plugin-perfectionist"),Z=require("eslint-config-prettier"),ee=require("eslint-plugin-regexp"),l=require("local-pkg"),q=require("eslint-plugin-unicorn");function re(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(s){if(s!=="default"){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:t(function(){return e[s]},"get")})}}),r.default=e,Object.freeze(r)}t(re,"_interopNamespaceDefault");var _=re(ee);const c="?([cm])[jt]s?(x)",te=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/storybook-static","**/.eslint-config-inspector","**/playwright-report","**/.astro","**/.vinxi","**/app.config.timestamp_*.js","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs","**/*.gen.*","!.storybook"],se="**/*.?([cm])js",y="**/*.?([cm])jsx",T="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${c}`,`**/*.spec.${c}`,`**/*.test.${c}`,`**/*.bench.${c}`,`**/*.benchmark.${c}`],R=[`**/e2e/**/*.spec.${c}`,`**/e2e/**/*.test.${c}`],j=[...R,`**/cypress/**/*.spec.${c}`,`**/cypress/**/*.test.${c}`],oe="**/*.cjs",ne="**/*.astro",ie=["vi.mock","describe","expect","it"],ae=["@testing-library/react"],i=t(async e=>{const r=await e;return r.default??r},"interopDefault"),ce=t(async()=>{const e=[ne],[r,s,n]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),i(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...g.node,Astro:!1,Fragment:!1},parser:s,parserOptions:{extraFileExtensions:[".astro"],parser:p.parser},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:r,"jsx-a11y":n},processor:"astro/client-side-ts",rules:{...n.configs.recommended.rules,"astro/missing-client-only-directive-value":"error","astro/no-conflict-set-directives":"error","astro/no-deprecated-astro-canonicalurl":"error","astro/no-deprecated-astro-fetchcontent":"error","astro/no-deprecated-astro-resolve":"error","astro/no-deprecated-getentrybyslug":"error","astro/no-exports-from-components":"off","astro/no-unused-define-vars-in-style":"error","astro/valid-compile":"error"}},{files:e,languageOptions:{parserOptions:p.configs.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:p.configs.disableTypeChecked.rules},{name:"jimmy.codes/astro/imports",settings:{"import-x/core-modules":["astro:content"]}}]},"astroConfig"),le=t(()=>[{files:[oe],languageOptions:{globals:g.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),pe={...O.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},fe=t(()=>[{...O.recommended,name:"jimmy.codes/eslint-comments",rules:pe}],"eslintCommentsConfig"),ue=t(e=>[{ignores:[...te,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),me={...u.configs.recommended.rules,"import-x/consistent-type-specifier-style":["error","prefer-top-level"],"import-x/extensions":["error","never",{checkTypedImports:!0,svg:"always"}],"import-x/first":"error","import-x/namespace":"off","import-x/newline-after-import":"error","import-x/no-absolute-path":"error","import-x/no-duplicates":"error","import-x/no-empty-named-blocks":"error","import-x/no-named-as-default":"error","import-x/no-named-as-default-member":"error","import-x/no-self-import":"error","import-x/no-unresolved":["error",{ignore:[String.raw`\.svg$`]}],"import-x/no-useless-path-segments":"error"},de={name:"jimmy.codes/imports/typescript",rules:u.configs.typescript.rules,settings:{...u.configs.typescript.settings,"import-x/resolver":{...u.configs.typescript.settings["import-x/resolver"],typescript:!0}}},ge=t(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":u,n:E},rules:me},...e?[de]:[]],"importsConfig"),ye={...K.configs.recommended.rules,"array-callback-return":["error",{allowImplicit:!0}],"arrow-body-style":["error","always"],curly:["error","all"],"no-console":"warn","no-self-compare":"error","no-template-curly-in-string":"error","no-unmodified-loop-condition":"error","no-unreachable-loop":"error","no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"no-useless-rename":"error","object-shorthand":"error","prefer-arrow-callback":"error"},je=t(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:ye}],"javascriptConfig"),he={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},xe=t(()=>[{name:"jimmy.codes/node",plugins:{n:E},rules:he}],"nodeConfig"),be={...C.configs["recommended-natural"].rules,"perfectionist/sort-imports":["error",{customGroups:{type:{},value:{}},environment:"node",groups:["side-effect-style","builtin","type","external","internal-type","internal",["parent-type","sibling-type","index-type"],["parent","sibling","index"],"object","style","unknown"],internalPattern:["^~/.*","^@/.*"],order:"asc",type:"natural"}],"perfectionist/sort-modules":"off"},we=t(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:C},rules:be}],"perfectionistConfig"),ve=t(async()=>({...(await i(import("eslint-plugin-playwright"))).configs["flat/recommended"].rules,"playwright/expect-expect":"error","playwright/max-nested-describe":"error","playwright/no-conditional-expect":"error","playwright/no-conditional-in-test":"error","playwright/no-element-handle":"error","playwright/no-eval":"error","playwright/no-force-option":"error","playwright/no-nested-step":"error","playwright/no-page-pause":"error","playwright/no-skipped-test":"error","playwright/no-useless-await":"error","playwright/no-useless-not":"error","playwright/no-wait-for-selector":"error","playwright/no-wait-for-timeout":"error"}),"playwrightRules"),ke=t(async()=>[{...(await i(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:R,name:"jimmy.codes/playwright",rules:await ve()}],"playwrightConfig"),Pe=t(()=>[{name:"jimmy.codes/prettier",...Z}],"prettierConfig"),Oe=t(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),L=t((e={})=>Object.fromEntries(Object.entries(e).map(([r,s])=>[r,typeof s=="number"?Oe(s):s])),"normalizeRuleEntries"),Ee=t(async()=>{const[e,r]=await Promise.all([i(import("eslint-plugin-react")),i(import("eslint-plugin-jsx-a11y"))]);return{...r.configs.recommended.rules,...L(e.configs.flat?.recommended?.rules),...L(e.configs.flat?.["jsx-runtime"]?.rules),"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"react/boolean-prop-naming":"off","react/button-has-type":"error","react/checked-requires-onchange-or-readonly":"error","react/default-props-match-prop-types":"error","react/destructuring-assignment":"off","react/forbid-component-props":"off","react/forbid-dom-props":"off","react/forbid-elements":"off","react/forbid-foreign-prop-types":"off","react/forbid-prop-types":"off","react/forward-ref-uses-ref":"error","react/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"react/jsx-curly-brace-presence":"error","react/jsx-filename-extension":"off","react/jsx-fragments":["error","syntax"],"react/jsx-handler-names":"off","react/jsx-max-depth":"off","react/jsx-no-bind":"off","react/jsx-no-constructed-context-values":"error","react/jsx-no-leaked-render":"error","react/jsx-no-literals":"off","react/jsx-no-script-url":"error","react/jsx-no-useless-fragment":"error","react/jsx-one-expression-per-line":"off","react/jsx-pascal-case":["error",{allowNamespace:!0}],"react/jsx-props-no-spread-multi":"off","react/jsx-props-no-spreading":"off","react/jsx-sort-default-props":"off","react/jsx-sort-props":"off","react/no-access-state-in-setstate":"error","react/no-adjacent-inline-elements":"off","react/no-array-index-key":"off","react/no-arrow-function-lifecycle":"error","react/no-danger":"off","react/no-did-mount-set-state":"error","react/no-did-update-set-state":"error","react/no-invalid-html-attribute":"error","react/no-multi-comp":"off","react/no-namespace":"error","react/no-object-type-as-default-prop":"error","react/no-redundant-should-component-update":"error","react/no-set-state":"off","react/no-this-in-sfc":"error","react/no-typos":"error","react/no-unstable-nested-components":"error","react/no-unused-class-component-methods":"error","react/no-unused-prop-types":"error","react/no-unused-state":"error","react/no-will-update-set-state":"error","react/prefer-es6-class":"off","react/prefer-exact-props":"off","react/prefer-read-only-props":"off","react/prefer-stateless-function":"off","react/require-default-props":"off","react/require-optimization":"off","react/self-closing-comp":"error","react/sort-comp":"off","react/sort-default-props":"off","react/sort-prop-types":"off","react/state-in-constructor":"off","react/static-property-placement":"off","react/style-prop-object":"error","react/void-dom-elements-no-children":"error"}},"reactRules"),Ce=t(async()=>{const[e,r,s,n]=await Promise.all([i(import("eslint-plugin-react")),i(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),import("eslint-plugin-react-refresh")]);return[{files:[y,T],languageOptions:{globals:{...g.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":r,react:e,"react-hooks":s,"react-refresh":n},rules:await Ee(),settings:{react:{version:"detect"}}}]},"reactConfig"),qe={..._.configs["flat/recommended"].rules,"regexp/confusing-quantifier":"error","regexp/no-empty-alternative":"error","regexp/no-lazy-ends":"error","regexp/no-potentially-useless-backreference":"error","regexp/no-useless-flag":"error","regexp/optimal-lookaround-quantifier":"error"},_e=t(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:_},rules:qe}],"regexpConfig"),Te=t(async()=>{const e=await i(import("@tanstack/eslint-plugin-query"));return[{files:[y,T],name:"jimmy.codes/react/query",plugins:{"@tanstack/query":e},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]},"tanstackQueryConfig"),S=t(async()=>{const e=await i(import("eslint-plugin-jest"));return{...e.configs["flat/recommended"].rules,...e.configs["flat/style"].rules,"jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"jest/expect-expect":"error","jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/no-conditional-in-test":"error","jest/no-confusing-set-timeout":"error","jest/no-duplicate-hooks":"error","jest/no-hooks":"off","jest/no-large-snapshots":"off","jest/no-restricted-jest-methods":"off","jest/no-restricted-matchers":"off","jest/no-test-return-statement":"error","jest/no-untyped-mock-factory":"off","jest/prefer-called-with":"error","jest/prefer-comparison-matcher":"error","jest/prefer-each":"error","jest/prefer-equality-matcher":"error","jest/prefer-expect-assertions":"off","jest/prefer-expect-resolves":"error","jest/prefer-hooks-in-order":"error","jest/prefer-hooks-on-top":"error","jest/prefer-lowercase-title":"off","jest/prefer-mock-promise-shorthand":"error","jest/prefer-snapshot-hint":"error","jest/prefer-spy-on":"off","jest/prefer-strict-equal":"error","jest/prefer-todo":"warn","jest/require-hook":"error","jest/require-to-throw-message":"error","jest/require-top-level-describe":"off","jest/unbound-method":"off"}},"jestRules"),Re=t(async()=>({...await S(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:ie}]}),"vitestRules"),Le=t(()=>l.isPackageExists("typescript"),"hasTypescript"),Se=t(()=>l.isPackageExists("react"),"hasReact"),G=t(()=>l.isPackageExists("vitest"),"hasVitest"),A=t(()=>l.isPackageExists("jest"),"hasJest"),Ge=t(()=>G()||A(),"hasTesting"),Ae=t(()=>ae.some(e=>l.isPackageExists(e)),"hasTestingLibrary"),Ie=t(()=>l.isPackageExists("@tanstack/react-query"),"hasReactQuery"),Be=t(()=>l.isPackageExists("astro"),"hasAstro"),Ne=t(()=>l.isPackageExists("@playwright/test"),"hasPlaywright"),$e=t(async({framework:e="vitest"}={},r=!0)=>{const s=r?G():e==="vitest",n=e==="jest"||r&&A(),a=[];if(s){const f=await i(import("eslint-plugin-jest"));a.push({files:m,ignores:j,...f.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await Re()})}if(n){const f=await i(import("eslint-plugin-jest"));a.push({files:m,ignores:j,...f.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await S()})}return a},"testingConfig"),Fe=t(async()=>{const[e,r]=await Promise.all([import("eslint-plugin-jest-dom"),i(import("eslint-plugin-testing-library"))]);return{...r.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),Je=t(async()=>{const[e,r]=await Promise.all([import("eslint-plugin-jest-dom"),i(import("eslint-plugin-testing-library"))]);return[{files:m,ignores:j,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":r},rules:await Fe()}]},"testingLibraryConfig"),ze={"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!1}],"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"separate-type-imports"}],"@typescript-eslint/no-deprecated":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}],"@typescript-eslint/no-unused-vars":["error",{args:"all",argsIgnorePattern:"^_",caughtErrors:"all",caughtErrorsIgnorePattern:"^_",destructuredArrayIgnorePattern:"^_",ignoreRestSiblings:!0,varsIgnorePattern:"^_"}],"@typescript-eslint/no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}],"no-use-before-define":"off"},Qe=t(e=>[...p.configs.strictTypeChecked,...p.configs.stylisticTypeChecked.filter(r=>r.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{...e?.project?{project:e.project}:{projectService:!0},tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:ze},{files:[se,y],...p.configs.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),Ve={...q.configs["flat/recommended"].rules,"unicorn/filename-case":"off","unicorn/import-style":"off","unicorn/no-abusive-eslint-disable":"off","unicorn/no-anonymous-default-export":"off","unicorn/no-array-callback-reference":"off","unicorn/no-array-reduce":"off","unicorn/no-null":"off","unicorn/no-process-exit":"off","unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-node-protocol":"off","unicorn/prevent-abbreviations":"off"},Xe=t(()=>[{...q.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:Ve}],"unicornConfig"),He=t(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),Ue=t((e,r)=>typeof e=="object"?e:{framework:r.vitest?"vitest":r.jest?"jest":"vitest",...r.testingLibrary&&{utilities:["testing-library"]}},"getTestingOptions"),We=t(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),Ye=t(({utilities:e=[]},r,s)=>r||e.includes("@tanstack/query")||s&&Ie(),"shouldEnableTanstackQuery"),De=t(({utilities:e=[]},r)=>e.includes("testing-library")||r&&Ae(),"shouldEnableTestingLibrary"),Me=t(async({astro:e=!1,autoDetect:r=!0,configs:s=[],ignores:n=[],jest:a=!1,playwright:f=!1,react:h=!1,tanstackQuery:I=!1,testing:x=!1,testingLibrary:B=!1,typescript:b=!1,vitest:w=!1}={},...N)=>{const $=We(h),v=Ue(x,{jest:a,testingLibrary:B,vitest:w}),k=He(b),P=b||!!k||r&&Le(),F=h||r&&Se(),J=x||a||w||r&&Ge(),z=e||r&&Be(),Q=Ye($,I,r),V=De(v,r),X=f||r&&Ne();return[je(),we(),xe(),Xe(),fe(),_e(),ge({typescript:P}),P?Qe(k):[],F?await Ce():[],Q?await Te():[],z?await ce():[],J?await $e(v,r):[],V?await Je():[],X?await ke():[],Pe(),le(),ue(n),s,N].flat()},"eslintConfig");module.exports=Me;
package/dist/index.d.cts CHANGED
@@ -10710,6 +10710,9 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
10710
10710
  }]
10711
10711
 
10712
10712
  type Rules = RuleOptions;
10713
+ /**
10714
+ * @deprecated
10715
+ */
10713
10716
  interface TypescriptOptions {
10714
10717
  /**
10715
10718
  * Location of `tsconfig.json` used for [type aware linting](https://typescript-eslint.io/getting-started/typed-linting)
@@ -10720,6 +10723,9 @@ interface TypescriptOptions {
10720
10723
  type TestingFrameworks = "jest" | "vitest";
10721
10724
  type TestingUtilities = "testing-library";
10722
10725
  type ReactUtilities = "@tanstack/query";
10726
+ /**
10727
+ * @deprecated
10728
+ */
10723
10729
  interface TestingOptions {
10724
10730
  /**
10725
10731
  * Which testing framework are you using?
@@ -10732,6 +10738,9 @@ interface TestingOptions {
10732
10738
  */
10733
10739
  utilities?: TestingUtilities[];
10734
10740
  }
10741
+ /**
10742
+ * @deprecated
10743
+ */
10735
10744
  interface ReactOptions {
10736
10745
  /**
10737
10746
  * Enable additional rules for utilities such as:
@@ -10768,6 +10777,11 @@ interface Options {
10768
10777
  * @see [Ignoring files](https://eslint.org/docs/latest/use/configure/ignore)
10769
10778
  */
10770
10779
  ignores?: string[];
10780
+ /**
10781
+ * Are Jest rules enabled?
10782
+ * @default false
10783
+ */
10784
+ jest?: boolean;
10771
10785
  /**
10772
10786
  * Are playwright rules enabled?
10773
10787
  * @default false
@@ -10778,19 +10792,35 @@ interface Options {
10778
10792
  * @default false
10779
10793
  */
10780
10794
  react?: boolean | ReactOptions;
10795
+ /**
10796
+ * Are Tanstack Query rules enabled?
10797
+ * @default false
10798
+ */
10799
+ tanstackQuery?: boolean;
10781
10800
  /**
10782
10801
  * Are testing rules enabled?
10783
10802
  * @default false
10803
+ * @deprecated please use {@link Options.jest}, {@link Options.vitest}, or {@link Options.testingLibrary} instead.
10784
10804
  */
10785
10805
  testing?: boolean | TestingOptions;
10806
+ /**
10807
+ * Are Testing Library rules enabled?
10808
+ * @default false
10809
+ */
10810
+ testingLibrary?: boolean;
10786
10811
  /**
10787
10812
  * Are TypeScript rules enabled?
10788
10813
  * @default false
10789
10814
  */
10790
10815
  typescript?: boolean | TypescriptOptions;
10816
+ /**
10817
+ * Are Vitest rules enabled?
10818
+ * @default false
10819
+ */
10820
+ vitest?: boolean;
10791
10821
  }
10792
10822
 
10793
- declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, playwright, react, testing, typescript, }?: Options, ...moreConfigs: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
10823
+ declare const eslintConfig: ({ astro, autoDetect, configs, ignores, jest, playwright, react, tanstackQuery, testing, testingLibrary, typescript, vitest, }?: Options, ...moreConfigs: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
10794
10824
  files: string[];
10795
10825
  languageOptions: {
10796
10826
  globals: {
@@ -13226,4 +13256,4 @@ declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, playwright,
13226
13256
  settings?: Record<string, unknown>;
13227
13257
  })[]>;
13228
13258
 
13229
- export { type Options, type ReactOptions, type Rules, type TestingOptions, type TypedConfigItem, type TypescriptOptions, jimmyDotCodes as default };
13259
+ export { type Options, type ReactOptions, type Rules, type TestingOptions, type TypedConfigItem, type TypescriptOptions, eslintConfig as default };
package/dist/index.d.mts CHANGED
@@ -10710,6 +10710,9 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
10710
10710
  }]
10711
10711
 
10712
10712
  type Rules = RuleOptions;
10713
+ /**
10714
+ * @deprecated
10715
+ */
10713
10716
  interface TypescriptOptions {
10714
10717
  /**
10715
10718
  * Location of `tsconfig.json` used for [type aware linting](https://typescript-eslint.io/getting-started/typed-linting)
@@ -10720,6 +10723,9 @@ interface TypescriptOptions {
10720
10723
  type TestingFrameworks = "jest" | "vitest";
10721
10724
  type TestingUtilities = "testing-library";
10722
10725
  type ReactUtilities = "@tanstack/query";
10726
+ /**
10727
+ * @deprecated
10728
+ */
10723
10729
  interface TestingOptions {
10724
10730
  /**
10725
10731
  * Which testing framework are you using?
@@ -10732,6 +10738,9 @@ interface TestingOptions {
10732
10738
  */
10733
10739
  utilities?: TestingUtilities[];
10734
10740
  }
10741
+ /**
10742
+ * @deprecated
10743
+ */
10735
10744
  interface ReactOptions {
10736
10745
  /**
10737
10746
  * Enable additional rules for utilities such as:
@@ -10768,6 +10777,11 @@ interface Options {
10768
10777
  * @see [Ignoring files](https://eslint.org/docs/latest/use/configure/ignore)
10769
10778
  */
10770
10779
  ignores?: string[];
10780
+ /**
10781
+ * Are Jest rules enabled?
10782
+ * @default false
10783
+ */
10784
+ jest?: boolean;
10771
10785
  /**
10772
10786
  * Are playwright rules enabled?
10773
10787
  * @default false
@@ -10778,19 +10792,35 @@ interface Options {
10778
10792
  * @default false
10779
10793
  */
10780
10794
  react?: boolean | ReactOptions;
10795
+ /**
10796
+ * Are Tanstack Query rules enabled?
10797
+ * @default false
10798
+ */
10799
+ tanstackQuery?: boolean;
10781
10800
  /**
10782
10801
  * Are testing rules enabled?
10783
10802
  * @default false
10803
+ * @deprecated please use {@link Options.jest}, {@link Options.vitest}, or {@link Options.testingLibrary} instead.
10784
10804
  */
10785
10805
  testing?: boolean | TestingOptions;
10806
+ /**
10807
+ * Are Testing Library rules enabled?
10808
+ * @default false
10809
+ */
10810
+ testingLibrary?: boolean;
10786
10811
  /**
10787
10812
  * Are TypeScript rules enabled?
10788
10813
  * @default false
10789
10814
  */
10790
10815
  typescript?: boolean | TypescriptOptions;
10816
+ /**
10817
+ * Are Vitest rules enabled?
10818
+ * @default false
10819
+ */
10820
+ vitest?: boolean;
10791
10821
  }
10792
10822
 
10793
- declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, playwright, react, testing, typescript, }?: Options, ...moreConfigs: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
10823
+ declare const eslintConfig: ({ astro, autoDetect, configs, ignores, jest, playwright, react, tanstackQuery, testing, testingLibrary, typescript, vitest, }?: Options, ...moreConfigs: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
10794
10824
  files: string[];
10795
10825
  languageOptions: {
10796
10826
  globals: {
@@ -13226,4 +13256,4 @@ declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, playwright,
13226
13256
  settings?: Record<string, unknown>;
13227
13257
  })[]>;
13228
13258
 
13229
- export { type Options, type ReactOptions, type Rules, type TestingOptions, type TypedConfigItem, type TypescriptOptions, jimmyDotCodes as default };
13259
+ export { type Options, type ReactOptions, type Rules, type TestingOptions, type TypedConfigItem, type TypescriptOptions, eslintConfig as default };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var F=Object.defineProperty;var r=(e,t)=>F(e,"name",{value:t,configurable:!0});import u from"globals";import{parser as J,configs as p}from"typescript-eslint";import w from"@eslint-community/eslint-plugin-eslint-comments/configs";import f from"eslint-plugin-import-x";import k from"eslint-plugin-n";import Q from"@eslint/js";import v from"eslint-plugin-perfectionist";import V from"eslint-config-prettier";import*as P from"eslint-plugin-regexp";import{isPackageExists as a}from"local-pkg";import O from"eslint-plugin-unicorn";const n="?([cm])[jt]s?(x)",X=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/storybook-static","**/.eslint-config-inspector","**/playwright-report","**/.astro","**/.vinxi","**/app.config.timestamp_*.js","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs","**/*.gen.*","!.storybook"],z="**/*.?([cm])js",d="**/*.?([cm])jsx",C="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${n}`,`**/*.spec.${n}`,`**/*.test.${n}`,`**/*.bench.${n}`,`**/*.benchmark.${n}`],E=[`**/e2e/**/*.spec.${n}`,`**/e2e/**/*.test.${n}`],g=[...E,`**/cypress/**/*.spec.${n}`,`**/cypress/**/*.test.${n}`],H="**/*.cjs",U="**/*.astro",W=["vi.mock","describe","expect","it"],Y=["@testing-library/react"],o=r(async e=>{const t=await e;return t.default??t},"interopDefault"),M=r(async()=>{const e=[U],[t,s,i]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),o(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...u.node,Astro:!1,Fragment:!1},parser:s,parserOptions:{extraFileExtensions:[".astro"],parser:J},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:t,"jsx-a11y":i},processor:"astro/client-side-ts",rules:{...i.configs.recommended.rules,"astro/missing-client-only-directive-value":"error","astro/no-conflict-set-directives":"error","astro/no-deprecated-astro-canonicalurl":"error","astro/no-deprecated-astro-fetchcontent":"error","astro/no-deprecated-astro-resolve":"error","astro/no-deprecated-getentrybyslug":"error","astro/no-exports-from-components":"off","astro/no-unused-define-vars-in-style":"error","astro/valid-compile":"error"}},{files:e,languageOptions:{parserOptions:p.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:p.disableTypeChecked.rules},{name:"jimmy.codes/astro/imports",settings:{"import-x/core-modules":["astro:content"]}}]},"astroConfig"),D=r(()=>[{files:[H],languageOptions:{globals:u.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),K={...w.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},Z=r(()=>[{...w.recommended,name:"jimmy.codes/eslint-comments",rules:K}],"eslintCommentsConfig"),ee=r(e=>[{ignores:[...X,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),re={...f.configs.recommended.rules,"import-x/consistent-type-specifier-style":["error","prefer-top-level"],"import-x/extensions":["error","never",{checkTypedImports:!0,svg:"always"}],"import-x/first":"error","import-x/namespace":"off","import-x/newline-after-import":"error","import-x/no-absolute-path":"error","import-x/no-duplicates":"error","import-x/no-empty-named-blocks":"error","import-x/no-named-as-default":"error","import-x/no-named-as-default-member":"error","import-x/no-self-import":"error","import-x/no-unresolved":["error",{ignore:[String.raw`\.svg$`]}],"import-x/no-useless-path-segments":"error"},te={name:"jimmy.codes/imports/typescript",rules:f.configs.typescript.rules,settings:{...f.configs.typescript.settings,"import-x/resolver":{...f.configs.typescript.settings["import-x/resolver"],typescript:!0}}},oe=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":f,n:k},rules:re},...e?[te]:[]],"importsConfig"),se={...Q.configs.recommended.rules,"array-callback-return":["error",{allowImplicit:!0}],"arrow-body-style":["error","always"],curly:["error","all"],"no-console":"warn","no-self-compare":"error","no-template-curly-in-string":"error","no-unmodified-loop-condition":"error","no-unreachable-loop":"error","no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"no-useless-rename":"error","object-shorthand":"error","prefer-arrow-callback":"error"},ne=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:se}],"javascriptConfig"),ie={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},ae=r(()=>[{name:"jimmy.codes/node",plugins:{n:k},rules:ie}],"nodeConfig"),ce={...v.configs["recommended-natural"].rules,"perfectionist/sort-imports":["error",{customGroups:{type:{},value:{}},environment:"node",groups:["side-effect-style","builtin","type","external","internal-type","internal",["parent-type","sibling-type","index-type"],["parent","sibling","index"],"object","style","unknown"],internalPattern:["^~/.*","^@/.*"],order:"asc",type:"natural"}],"perfectionist/sort-modules":"off"},le=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:v},rules:ce}],"perfectionistConfig"),pe=r(async()=>({...(await o(import("eslint-plugin-playwright"))).configs["flat/recommended"].rules,"playwright/expect-expect":"error","playwright/max-nested-describe":"error","playwright/no-conditional-expect":"error","playwright/no-conditional-in-test":"error","playwright/no-element-handle":"error","playwright/no-eval":"error","playwright/no-force-option":"error","playwright/no-nested-step":"error","playwright/no-page-pause":"error","playwright/no-skipped-test":"error","playwright/no-useless-await":"error","playwright/no-useless-not":"error","playwright/no-wait-for-selector":"error","playwright/no-wait-for-timeout":"error"}),"playwrightRules"),fe=r(async()=>[{...(await o(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:E,name:"jimmy.codes/playwright",rules:await pe()}],"playwrightConfig"),me=r(()=>[{name:"jimmy.codes/prettier",...V}],"prettierConfig"),ue=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),T=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,s])=>[t,typeof s=="number"?ue(s):s])),"normalizeRuleEntries"),de=r(async()=>{const[e,t]=await Promise.all([o(import("eslint-plugin-react")),o(import("eslint-plugin-jsx-a11y"))]);return{...t.configs.recommended.rules,...T(e.configs.flat?.recommended?.rules),...T(e.configs.flat?.["jsx-runtime"]?.rules),"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"react/boolean-prop-naming":"off","react/button-has-type":"error","react/checked-requires-onchange-or-readonly":"error","react/default-props-match-prop-types":"error","react/destructuring-assignment":"off","react/forbid-component-props":"off","react/forbid-dom-props":"off","react/forbid-elements":"off","react/forbid-foreign-prop-types":"off","react/forbid-prop-types":"off","react/forward-ref-uses-ref":"error","react/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"react/jsx-curly-brace-presence":"error","react/jsx-filename-extension":"off","react/jsx-fragments":["error","syntax"],"react/jsx-handler-names":"off","react/jsx-max-depth":"off","react/jsx-no-bind":"off","react/jsx-no-constructed-context-values":"error","react/jsx-no-leaked-render":"error","react/jsx-no-literals":"off","react/jsx-no-script-url":"error","react/jsx-no-useless-fragment":"error","react/jsx-one-expression-per-line":"off","react/jsx-pascal-case":["error",{allowNamespace:!0}],"react/jsx-props-no-spread-multi":"off","react/jsx-props-no-spreading":"off","react/jsx-sort-default-props":"off","react/jsx-sort-props":"off","react/no-access-state-in-setstate":"error","react/no-adjacent-inline-elements":"off","react/no-array-index-key":"off","react/no-arrow-function-lifecycle":"error","react/no-danger":"off","react/no-did-mount-set-state":"error","react/no-did-update-set-state":"error","react/no-invalid-html-attribute":"error","react/no-multi-comp":"off","react/no-namespace":"error","react/no-object-type-as-default-prop":"error","react/no-redundant-should-component-update":"error","react/no-set-state":"off","react/no-this-in-sfc":"error","react/no-typos":"error","react/no-unstable-nested-components":"error","react/no-unused-class-component-methods":"error","react/no-unused-prop-types":"error","react/no-unused-state":"error","react/no-will-update-set-state":"error","react/prefer-es6-class":"off","react/prefer-exact-props":"off","react/prefer-read-only-props":"off","react/prefer-stateless-function":"off","react/require-default-props":"off","react/require-optimization":"off","react/self-closing-comp":"error","react/sort-comp":"off","react/sort-default-props":"off","react/sort-prop-types":"off","react/state-in-constructor":"off","react/static-property-placement":"off","react/style-prop-object":"error","react/void-dom-elements-no-children":"error"}},"reactRules"),ge=r(async()=>{const[e,t,s,i]=await Promise.all([o(import("eslint-plugin-react")),o(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),import("eslint-plugin-react-refresh")]);return[{files:[d,C],languageOptions:{globals:{...u.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":t,react:e,"react-hooks":s,"react-refresh":i},rules:await de(),settings:{react:{version:"detect"}}}]},"reactConfig"),ye={...P.configs["flat/recommended"].rules,"regexp/confusing-quantifier":"error","regexp/no-empty-alternative":"error","regexp/no-lazy-ends":"error","regexp/no-potentially-useless-backreference":"error","regexp/no-useless-flag":"error","regexp/optimal-lookaround-quantifier":"error"},je=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:P},rules:ye}],"regexpConfig"),he=r(async()=>{const e=await o(import("@tanstack/eslint-plugin-query"));return[{files:[d,C],name:"jimmy.codes/react/query",plugins:{"@tanstack/query":e},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]},"tanstackQuery"),_=r(async()=>{const e=await o(import("eslint-plugin-jest"));return{...e.configs["flat/recommended"].rules,...e.configs["flat/style"].rules,"jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"jest/expect-expect":"error","jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/no-conditional-in-test":"error","jest/no-confusing-set-timeout":"error","jest/no-duplicate-hooks":"error","jest/no-hooks":"off","jest/no-large-snapshots":"off","jest/no-restricted-jest-methods":"off","jest/no-restricted-matchers":"off","jest/no-test-return-statement":"error","jest/no-untyped-mock-factory":"off","jest/prefer-called-with":"error","jest/prefer-comparison-matcher":"error","jest/prefer-each":"error","jest/prefer-equality-matcher":"error","jest/prefer-expect-assertions":"off","jest/prefer-expect-resolves":"error","jest/prefer-hooks-in-order":"error","jest/prefer-hooks-on-top":"error","jest/prefer-lowercase-title":"off","jest/prefer-mock-promise-shorthand":"error","jest/prefer-snapshot-hint":"error","jest/prefer-spy-on":"off","jest/prefer-strict-equal":"error","jest/prefer-todo":"warn","jest/require-hook":"error","jest/require-to-throw-message":"error","jest/require-top-level-describe":"off","jest/unbound-method":"off"}},"jestRules"),xe=r(async()=>({...await _(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:W}]}),"vitestRules"),be=r(()=>a("typescript"),"hasTypescript"),we=r(()=>a("react"),"hasReact"),R=r(()=>a("vitest"),"hasVitest"),L=r(()=>a("jest"),"hasJest"),ke=r(()=>R()||L(),"hasTesting"),ve=r(()=>Y.some(e=>a(e)),"hasTestingLibrary"),Pe=r(()=>a("@tanstack/react-query"),"hasReactQuery"),Oe=r(()=>a("astro"),"hasAstro"),Ce=r(()=>a("@playwright/test"),"hasPlaywright"),Ee=r(async({framework:e="vitest"}={},t=!0)=>{const s=t?R():e==="vitest",i=e==="jest"||t&&L(),l=[];if(s){const c=await o(import("eslint-plugin-jest"));l.push({files:m,ignores:g,...c.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await xe()})}if(i){const c=await o(import("eslint-plugin-jest"));l.push({files:m,ignores:g,...c.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await _()})}return l},"testingConfig"),Te=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),o(import("eslint-plugin-testing-library"))]);return{...t.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),_e=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),o(import("eslint-plugin-testing-library"))]);return[{files:m,ignores:g,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await Te()}]},"testingLibrary"),Re={"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!1}],"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"separate-type-imports"}],"@typescript-eslint/no-deprecated":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}],"@typescript-eslint/no-unused-vars":["error",{args:"all",argsIgnorePattern:"^_",caughtErrors:"all",caughtErrorsIgnorePattern:"^_",destructuredArrayIgnorePattern:"^_",ignoreRestSiblings:!0,varsIgnorePattern:"^_"}],"@typescript-eslint/no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}],"no-use-before-define":"off"},Le=r(e=>[...p.strictTypeChecked,...p.stylisticTypeChecked.filter(t=>t.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{...e?.project?{project:e.project}:{projectService:!0},tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Re},{files:[z,d],...p.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),qe={...O.configs["flat/recommended"].rules,"unicorn/filename-case":"off","unicorn/import-style":"off","unicorn/no-abusive-eslint-disable":"off","unicorn/no-anonymous-default-export":"off","unicorn/no-array-callback-reference":"off","unicorn/no-array-reduce":"off","unicorn/no-null":"off","unicorn/no-process-exit":"off","unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-node-protocol":"off","unicorn/prevent-abbreviations":"off"},Se=r(()=>[{...O.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:qe}],"unicornConfig"),Ge=r(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),Ae=r(e=>typeof e=="object"?e:{framework:"vitest"},"getTestingOptions"),Ie=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),Be=r(({utilities:e=[]},t)=>e.includes("@tanstack/query")||t&&Pe(),"shouldEnableTanstackQuery"),$e=r(({utilities:e=[]},t)=>e.includes("testing-library")||t&&ve(),"shouldEnableTestingLibrary"),Ne=r(async({astro:e=!1,autoDetect:t=!0,configs:s=[],ignores:i=[],playwright:l=!1,react:c=!1,testing:y=!1,typescript:j=!1}={},...q)=>{const S=Ie(c),h=Ae(y),x=Ge(j),b=j||!!x||t&&be(),G=c||t&&we(),A=y||t&&ke(),I=e||t&&Oe(),B=Be(S,t),$=$e(h,t),N=l||t&&Ce();return[ne(),le(),ae(),Se(),Z(),je(),oe({typescript:b}),b?Le(x):[],G?await ge():[],B?await he():[],I?await M():[],A?await Ee(h,t):[],$?await _e():[],N?await fe():[],me(),D(),ee(i),s,q].flat()},"jimmyDotCodes");export{Ne as default};
1
+ var X=Object.defineProperty;var r=(e,t)=>X(e,"name",{value:t,configurable:!0});import u from"globals";import{parser as z,configs as p}from"typescript-eslint";import k from"@eslint-community/eslint-plugin-eslint-comments/configs";import f from"eslint-plugin-import-x";import P from"eslint-plugin-n";import H from"@eslint/js";import O from"eslint-plugin-perfectionist";import U from"eslint-config-prettier";import*as C from"eslint-plugin-regexp";import{isPackageExists as a}from"local-pkg";import E from"eslint-plugin-unicorn";const n="?([cm])[jt]s?(x)",W=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/storybook-static","**/.eslint-config-inspector","**/playwright-report","**/.astro","**/.vinxi","**/app.config.timestamp_*.js","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs","**/*.gen.*","!.storybook"],Y="**/*.?([cm])js",d="**/*.?([cm])jsx",T="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${n}`,`**/*.spec.${n}`,`**/*.test.${n}`,`**/*.bench.${n}`,`**/*.benchmark.${n}`],_=[`**/e2e/**/*.spec.${n}`,`**/e2e/**/*.test.${n}`],g=[..._,`**/cypress/**/*.spec.${n}`,`**/cypress/**/*.test.${n}`],M="**/*.cjs",D="**/*.astro",K=["vi.mock","describe","expect","it"],Z=["@testing-library/react"],s=r(async e=>{const t=await e;return t.default??t},"interopDefault"),ee=r(async()=>{const e=[D],[t,o,i]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),s(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...u.node,Astro:!1,Fragment:!1},parser:o,parserOptions:{extraFileExtensions:[".astro"],parser:z},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:t,"jsx-a11y":i},processor:"astro/client-side-ts",rules:{...i.configs.recommended.rules,"astro/missing-client-only-directive-value":"error","astro/no-conflict-set-directives":"error","astro/no-deprecated-astro-canonicalurl":"error","astro/no-deprecated-astro-fetchcontent":"error","astro/no-deprecated-astro-resolve":"error","astro/no-deprecated-getentrybyslug":"error","astro/no-exports-from-components":"off","astro/no-unused-define-vars-in-style":"error","astro/valid-compile":"error"}},{files:e,languageOptions:{parserOptions:p.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:p.disableTypeChecked.rules},{name:"jimmy.codes/astro/imports",settings:{"import-x/core-modules":["astro:content"]}}]},"astroConfig"),re=r(()=>[{files:[M],languageOptions:{globals:u.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),te={...k.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},oe=r(()=>[{...k.recommended,name:"jimmy.codes/eslint-comments",rules:te}],"eslintCommentsConfig"),se=r(e=>[{ignores:[...W,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),ne={...f.configs.recommended.rules,"import-x/consistent-type-specifier-style":["error","prefer-top-level"],"import-x/extensions":["error","never",{checkTypedImports:!0,svg:"always"}],"import-x/first":"error","import-x/namespace":"off","import-x/newline-after-import":"error","import-x/no-absolute-path":"error","import-x/no-duplicates":"error","import-x/no-empty-named-blocks":"error","import-x/no-named-as-default":"error","import-x/no-named-as-default-member":"error","import-x/no-self-import":"error","import-x/no-unresolved":["error",{ignore:[String.raw`\.svg$`]}],"import-x/no-useless-path-segments":"error"},ie={name:"jimmy.codes/imports/typescript",rules:f.configs.typescript.rules,settings:{...f.configs.typescript.settings,"import-x/resolver":{...f.configs.typescript.settings["import-x/resolver"],typescript:!0}}},ae=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":f,n:P},rules:ne},...e?[ie]:[]],"importsConfig"),ce={...H.configs.recommended.rules,"array-callback-return":["error",{allowImplicit:!0}],"arrow-body-style":["error","always"],curly:["error","all"],"no-console":"warn","no-self-compare":"error","no-template-curly-in-string":"error","no-unmodified-loop-condition":"error","no-unreachable-loop":"error","no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"no-useless-rename":"error","object-shorthand":"error","prefer-arrow-callback":"error"},le=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:ce}],"javascriptConfig"),pe={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},fe=r(()=>[{name:"jimmy.codes/node",plugins:{n:P},rules:pe}],"nodeConfig"),me={...O.configs["recommended-natural"].rules,"perfectionist/sort-imports":["error",{customGroups:{type:{},value:{}},environment:"node",groups:["side-effect-style","builtin","type","external","internal-type","internal",["parent-type","sibling-type","index-type"],["parent","sibling","index"],"object","style","unknown"],internalPattern:["^~/.*","^@/.*"],order:"asc",type:"natural"}],"perfectionist/sort-modules":"off"},ue=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:O},rules:me}],"perfectionistConfig"),de=r(async()=>({...(await s(import("eslint-plugin-playwright"))).configs["flat/recommended"].rules,"playwright/expect-expect":"error","playwright/max-nested-describe":"error","playwright/no-conditional-expect":"error","playwright/no-conditional-in-test":"error","playwright/no-element-handle":"error","playwright/no-eval":"error","playwright/no-force-option":"error","playwright/no-nested-step":"error","playwright/no-page-pause":"error","playwright/no-skipped-test":"error","playwright/no-useless-await":"error","playwright/no-useless-not":"error","playwright/no-wait-for-selector":"error","playwright/no-wait-for-timeout":"error"}),"playwrightRules"),ge=r(async()=>[{...(await s(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:_,name:"jimmy.codes/playwright",rules:await de()}],"playwrightConfig"),ye=r(()=>[{name:"jimmy.codes/prettier",...U}],"prettierConfig"),je=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),R=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,typeof o=="number"?je(o):o])),"normalizeRuleEntries"),he=r(async()=>{const[e,t]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y"))]);return{...t.configs.recommended.rules,...R(e.configs.flat?.recommended?.rules),...R(e.configs.flat?.["jsx-runtime"]?.rules),"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"react/boolean-prop-naming":"off","react/button-has-type":"error","react/checked-requires-onchange-or-readonly":"error","react/default-props-match-prop-types":"error","react/destructuring-assignment":"off","react/forbid-component-props":"off","react/forbid-dom-props":"off","react/forbid-elements":"off","react/forbid-foreign-prop-types":"off","react/forbid-prop-types":"off","react/forward-ref-uses-ref":"error","react/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"react/jsx-curly-brace-presence":"error","react/jsx-filename-extension":"off","react/jsx-fragments":["error","syntax"],"react/jsx-handler-names":"off","react/jsx-max-depth":"off","react/jsx-no-bind":"off","react/jsx-no-constructed-context-values":"error","react/jsx-no-leaked-render":"error","react/jsx-no-literals":"off","react/jsx-no-script-url":"error","react/jsx-no-useless-fragment":"error","react/jsx-one-expression-per-line":"off","react/jsx-pascal-case":["error",{allowNamespace:!0}],"react/jsx-props-no-spread-multi":"off","react/jsx-props-no-spreading":"off","react/jsx-sort-default-props":"off","react/jsx-sort-props":"off","react/no-access-state-in-setstate":"error","react/no-adjacent-inline-elements":"off","react/no-array-index-key":"off","react/no-arrow-function-lifecycle":"error","react/no-danger":"off","react/no-did-mount-set-state":"error","react/no-did-update-set-state":"error","react/no-invalid-html-attribute":"error","react/no-multi-comp":"off","react/no-namespace":"error","react/no-object-type-as-default-prop":"error","react/no-redundant-should-component-update":"error","react/no-set-state":"off","react/no-this-in-sfc":"error","react/no-typos":"error","react/no-unstable-nested-components":"error","react/no-unused-class-component-methods":"error","react/no-unused-prop-types":"error","react/no-unused-state":"error","react/no-will-update-set-state":"error","react/prefer-es6-class":"off","react/prefer-exact-props":"off","react/prefer-read-only-props":"off","react/prefer-stateless-function":"off","react/require-default-props":"off","react/require-optimization":"off","react/self-closing-comp":"error","react/sort-comp":"off","react/sort-default-props":"off","react/sort-prop-types":"off","react/state-in-constructor":"off","react/static-property-placement":"off","react/style-prop-object":"error","react/void-dom-elements-no-children":"error"}},"reactRules"),xe=r(async()=>{const[e,t,o,i]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),import("eslint-plugin-react-refresh")]);return[{files:[d,T],languageOptions:{globals:{...u.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":t,react:e,"react-hooks":o,"react-refresh":i},rules:await he(),settings:{react:{version:"detect"}}}]},"reactConfig"),be={...C.configs["flat/recommended"].rules,"regexp/confusing-quantifier":"error","regexp/no-empty-alternative":"error","regexp/no-lazy-ends":"error","regexp/no-potentially-useless-backreference":"error","regexp/no-useless-flag":"error","regexp/optimal-lookaround-quantifier":"error"},we=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:C},rules:be}],"regexpConfig"),ve=r(async()=>{const e=await s(import("@tanstack/eslint-plugin-query"));return[{files:[d,T],name:"jimmy.codes/react/query",plugins:{"@tanstack/query":e},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]},"tanstackQueryConfig"),L=r(async()=>{const e=await s(import("eslint-plugin-jest"));return{...e.configs["flat/recommended"].rules,...e.configs["flat/style"].rules,"jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"jest/expect-expect":"error","jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/no-conditional-in-test":"error","jest/no-confusing-set-timeout":"error","jest/no-duplicate-hooks":"error","jest/no-hooks":"off","jest/no-large-snapshots":"off","jest/no-restricted-jest-methods":"off","jest/no-restricted-matchers":"off","jest/no-test-return-statement":"error","jest/no-untyped-mock-factory":"off","jest/prefer-called-with":"error","jest/prefer-comparison-matcher":"error","jest/prefer-each":"error","jest/prefer-equality-matcher":"error","jest/prefer-expect-assertions":"off","jest/prefer-expect-resolves":"error","jest/prefer-hooks-in-order":"error","jest/prefer-hooks-on-top":"error","jest/prefer-lowercase-title":"off","jest/prefer-mock-promise-shorthand":"error","jest/prefer-snapshot-hint":"error","jest/prefer-spy-on":"off","jest/prefer-strict-equal":"error","jest/prefer-todo":"warn","jest/require-hook":"error","jest/require-to-throw-message":"error","jest/require-top-level-describe":"off","jest/unbound-method":"off"}},"jestRules"),ke=r(async()=>({...await L(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:K}]}),"vitestRules"),Pe=r(()=>a("typescript"),"hasTypescript"),Oe=r(()=>a("react"),"hasReact"),q=r(()=>a("vitest"),"hasVitest"),S=r(()=>a("jest"),"hasJest"),Ce=r(()=>q()||S(),"hasTesting"),Ee=r(()=>Z.some(e=>a(e)),"hasTestingLibrary"),Te=r(()=>a("@tanstack/react-query"),"hasReactQuery"),_e=r(()=>a("astro"),"hasAstro"),Re=r(()=>a("@playwright/test"),"hasPlaywright"),Le=r(async({framework:e="vitest"}={},t=!0)=>{const o=t?q():e==="vitest",i=e==="jest"||t&&S(),c=[];if(o){const l=await s(import("eslint-plugin-jest"));c.push({files:m,ignores:g,...l.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await ke()})}if(i){const l=await s(import("eslint-plugin-jest"));c.push({files:m,ignores:g,...l.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await L()})}return c},"testingConfig"),qe=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),s(import("eslint-plugin-testing-library"))]);return{...t.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),Se=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),s(import("eslint-plugin-testing-library"))]);return[{files:m,ignores:g,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await qe()}]},"testingLibraryConfig"),Ge={"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!1}],"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"separate-type-imports"}],"@typescript-eslint/no-deprecated":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}],"@typescript-eslint/no-unused-vars":["error",{args:"all",argsIgnorePattern:"^_",caughtErrors:"all",caughtErrorsIgnorePattern:"^_",destructuredArrayIgnorePattern:"^_",ignoreRestSiblings:!0,varsIgnorePattern:"^_"}],"@typescript-eslint/no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}],"no-use-before-define":"off"},Ae=r(e=>[...p.strictTypeChecked,...p.stylisticTypeChecked.filter(t=>t.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{...e?.project?{project:e.project}:{projectService:!0},tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Ge},{files:[Y,d],...p.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),Ie={...E.configs["flat/recommended"].rules,"unicorn/filename-case":"off","unicorn/import-style":"off","unicorn/no-abusive-eslint-disable":"off","unicorn/no-anonymous-default-export":"off","unicorn/no-array-callback-reference":"off","unicorn/no-array-reduce":"off","unicorn/no-null":"off","unicorn/no-process-exit":"off","unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-node-protocol":"off","unicorn/prevent-abbreviations":"off"},Be=r(()=>[{...E.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:Ie}],"unicornConfig"),$e=r(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),Ne=r((e,t)=>typeof e=="object"?e:{framework:t.vitest?"vitest":t.jest?"jest":"vitest",...t.testingLibrary&&{utilities:["testing-library"]}},"getTestingOptions"),Fe=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),Je=r(({utilities:e=[]},t,o)=>t||e.includes("@tanstack/query")||o&&Te(),"shouldEnableTanstackQuery"),Qe=r(({utilities:e=[]},t)=>e.includes("testing-library")||t&&Ee(),"shouldEnableTestingLibrary"),Ve=r(async({astro:e=!1,autoDetect:t=!0,configs:o=[],ignores:i=[],jest:c=!1,playwright:l=!1,react:y=!1,tanstackQuery:G=!1,testing:j=!1,testingLibrary:A=!1,typescript:h=!1,vitest:x=!1}={},...I)=>{const B=Fe(y),b=Ne(j,{jest:c,testingLibrary:A,vitest:x}),w=$e(h),v=h||!!w||t&&Pe(),$=y||t&&Oe(),N=j||c||x||t&&Ce(),F=e||t&&_e(),J=Je(B,G,t),Q=Qe(b,t),V=l||t&&Re();return[le(),ue(),fe(),Be(),oe(),we(),ae({typescript:v}),v?Ae(w):[],$?await xe():[],J?await ve():[],F?await ee():[],N?await Le(b,t):[],Q?await Se():[],V?await ge():[],ye(),re(),se(i),o,I].flat()},"eslintConfig");export{Ve as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimmy.codes/eslint-config",
3
- "version": "3.19.0",
3
+ "version": "3.20.0",
4
4
  "description": "another opinionated eslint config",
5
5
  "keywords": [
6
6
  "eslint",