@jimmy.codes/eslint-config 1.1.0 → 1.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 CHANGED
@@ -12,6 +12,8 @@ _This is an evolution of [eslint-config-jimmy-guzman](https://github.com/jimmy-g
12
12
 
13
13
  ## 🛠️ Usage
14
14
 
15
+ _For a better experience, make sure to use [@jimmy.codes/prettier-config](https://github.com/jimmy-guzman/prettier-config) as well_
16
+
15
17
  ### 🔨 Getting Started
16
18
 
17
19
  First install the package, by running the following:
@@ -43,7 +45,6 @@ And if you're using [VS Code](https://code.visualstudio.com), make sure to enabl
43
45
  This package contains rules that can be enabled or disabled as follows:
44
46
 
45
47
  ```js
46
- // eslint.config.mjs
47
48
  import jimmyDotCodes from "@jimmy.codes/eslint-config";
48
49
 
49
50
  export default jimmyDotCodes({
@@ -70,7 +71,6 @@ export default jimmyDotCodes({
70
71
  You can also change the project location which can be helpful for monorepos:
71
72
 
72
73
  ```js
73
- // eslint.config.mjs
74
74
  import jimmyDotCodes from "@jimmy.codes/eslint-config";
75
75
 
76
76
  export default jimmyDotCodes({
@@ -82,10 +82,9 @@ export default jimmyDotCodes({
82
82
 
83
83
  #### Testing
84
84
 
85
- By default [vitest](https://vitest.dev) is used as the testing framework but you can override and add some utilities:
85
+ By default [vitest](https://vitest.dev) is used as the testing framework but you can override and add additional rules for utilities:
86
86
 
87
87
  ```js
88
- // eslint.config.mjs
89
88
  import jimmyDotCodes from "@jimmy.codes/eslint-config";
90
89
 
91
90
  export default jimmyDotCodes({
@@ -96,12 +95,25 @@ export default jimmyDotCodes({
96
95
  });
97
96
  ```
98
97
 
98
+ #### React
99
+
100
+ You can add additional rules for utilities:
101
+
102
+ ```js
103
+ import jimmyDotCodes from "@jimmy.codes/eslint-config";
104
+
105
+ export default jimmyDotCodes({
106
+ react: {
107
+ utilities: ["@tanstack/query"],
108
+ },
109
+ });
110
+ ```
111
+
99
112
  #### Overrides
100
113
 
101
114
  You can also extend or override the configuration:
102
115
 
103
116
  ```js
104
- // eslint.config.mjs
105
117
  import jimmyDotCodes from "@jimmy.codes/eslint-config";
106
118
 
107
119
  export default jimmyDotCodes({
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var j=require("eslint-config-prettier"),s=require("eslint-plugin-import-x"),y=require("eslint-plugin-node-import"),g=require("eslint-plugin-simple-import-sort"),i=require("eslint-plugin-jsx-a11y"),x=require("eslint-plugin-react"),h=require("eslint-plugin-react-hooks"),b=require("eslint-plugin-react-refresh"),v=require("globals"),a=require("eslint-plugin-jest"),k=require("eslint-plugin-jest-dom"),p=require("eslint-plugin-testing-library"),n=require("typescript-eslint"),q=require("@eslint/js");function f(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}var _=f(b),l=f(k);const O={...s.configs.recommended.rules,"import-x/namespace":"off","import-x/newline-after-import":"error","import-x/first":"error","import-x/no-absolute-path":"error","import-x/no-useless-path-segments":"error","import-x/no-empty-named-blocks":"error","import-x/no-self-import":"error","simple-import-sort/imports":"error","simple-import-sort/exports":"error","node-import/prefer-node-protocol":"error"},w={name:"jimmy.codes/imports/typescript",settings:{...s.configs.typescript.settings,"import-x/resolver":{...s.configs.typescript.settings["import-x/resolver"],typescript:!0}},rules:s.configs.typescript.rules},C=({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":s,"simple-import-sort":g,"node-import":y},rules:O},...e?[w]:[]],o="?([cm])[jt]s?(x)",E=["**/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","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs"],L="**/*.?([cm])js",m="**/*.?([cm])jsx",S="**/*.?([cm])tsx",u=[`**/__tests__/**/*.${o}`,`**/*.spec.${o}`,`**/*.test.${o}`,`**/*.bench.${o}`,`**/*.benchmark.${o}`],d=[`**/e2e/**/*.spec.${o}`,`**/e2e/**/*.test.${o}`],T={...i.configs.recommended.rules,"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react/display-name":"error","react/jsx-key":"error","react/jsx-no-comment-textnodes":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-target-blank":"error","react/jsx-no-undef":"error","react/jsx-uses-vars":"error","react/no-children-prop":"error","react/no-danger-with-children":"error","react/no-deprecated":"error","react/no-direct-mutation-state":"error","react/no-find-dom-node":"error","react/no-is-mounted":"error","react/no-render-return-value":"error","react/no-string-refs":"error","react/no-unescaped-entities":"error","react/no-unknown-property":"error","react/no-unsafe":"off","react/prop-types":"error","react/require-render-return":"error","react/react-in-jsx-scope":"off","react/jsx-uses-react":"off","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"react/self-closing-comp":"error","react/jsx-curly-brace-presence":"error","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/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"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","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":"off","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/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"},G=()=>[{name:"jimmy.codes/react",files:[m,S],plugins:{react:x,"react-hooks":h,"jsx-a11y":{rules:i.rules},"react-refresh":_},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...v.browser}},settings:{react:{version:"detect"}},rules:T}],R={...a.configs["flat/recommended"].rules,...a.configs["flat/style"].rules,"jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"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"},B=()=>[{name:"jimmy.codes/testing/testing-library",files:u,plugins:{"testing-library":p,"jest-dom":l},rules:{...p.configs.react.rules,...l.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:d,rules:{"testing-library/prefer-screen-queries":"off"}}],D=({framework:e="vitest",utilities:r})=>[{name:"jimmy.codes/testing",files:u,...a.configs["flat/recommended"],rules:{...R,...e==="vitest"&&{"jest/no-deprecated-functions":"off"}}},{name:"jimmy.codes/testing/disabled",files:d,rules:{"jest/require-hook":"off"}},...r?.includes("testing-library")?B():[]],$=e=>n.config(...n.configs.strictTypeChecked,{name:"jimmy.codes/typescript",extends:[...n.configs.strictTypeChecked,...n.configs.stylisticTypeChecked],languageOptions:{parserOptions:{project:e.project,tsconfigRootDir:process.cwd()}},rules:{"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"inline-type-imports"}],"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!0}],"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}]}},{files:[L,m],...n.configs.disableTypeChecked}),I={...q.configs.recommended.rules,curly:"error","arrow-body-style":["error","always"],"object-shorthand":"error","prefer-arrow-callback":"error"},N=e=>typeof e=="object"?e:{project:"./tsconfig.json"},P=e=>typeof e=="object"?e:{framework:"vitest"},X=({typescript:e=!1,react:r=!1,testing:t=!1,overrides:c=[]}={})=>[{name:"jimmy.codes/base",rules:I},...C({typescript:e}),...e?$(N(e)):[],...r?G():[],...t?D(P(t)):[],{name:"jimmy.codes/disabled",...j},{ignores:E},...c];module.exports=X;
1
+ "use strict";var x=require("eslint-config-prettier"),l=require("globals"),s=require("eslint-plugin-import-x"),h=require("eslint-plugin-node-import"),b=require("eslint-plugin-simple-import-sort"),v=require("@tanstack/eslint-plugin-query"),m=require("eslint-plugin-jsx-a11y"),k=require("eslint-plugin-react"),q=require("eslint-plugin-react-hooks"),O=require("eslint-plugin-react-refresh"),n=require("eslint-plugin-jest"),_=require("eslint-plugin-jest-dom"),u=require("eslint-plugin-testing-library"),a=require("typescript-eslint"),w=require("@eslint/js");function p(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}var C=p(v),E=p(O),d=p(_);const L={...s.configs.recommended.rules,"import-x/namespace":"off","import-x/newline-after-import":"error","import-x/first":"error","import-x/no-absolute-path":"error","import-x/no-useless-path-segments":"error","import-x/no-empty-named-blocks":"error","import-x/no-self-import":"error","simple-import-sort/imports":"error","simple-import-sort/exports":"error","node-import/prefer-node-protocol":"error"},S={name:"jimmy.codes/imports/typescript",settings:{...s.configs.typescript.settings,"import-x/resolver":{...s.configs.typescript.settings["import-x/resolver"],typescript:!0}},rules:s.configs.typescript.rules},T=({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":s,"simple-import-sort":b,"node-import":h},settings:{"import-x/parsers":{espree:[".js",".cjs",".mjs",".jsx"]}},languageOptions:{parserOptions:{ecmaVersion:"latest",sourceType:"module"}},rules:L},...e?[S]:[]],o="?([cm])[jt]s?(x)",G=["**/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","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs"],R="**/*.?([cm])js",f="**/*.?([cm])jsx",j="**/*.?([cm])tsx",i=[`**/__tests__/**/*.${o}`,`**/*.spec.${o}`,`**/*.test.${o}`,`**/*.bench.${o}`,`**/*.benchmark.${o}`],y=[`**/e2e/**/*.spec.${o}`,`**/e2e/**/*.test.${o}`],B="**/*.cjs",D=["vi.mock"],I={...m.configs.recommended.rules,"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react/display-name":"error","react/jsx-key":"error","react/jsx-no-comment-textnodes":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-target-blank":"error","react/jsx-no-undef":"error","react/jsx-uses-vars":"error","react/no-children-prop":"error","react/no-danger-with-children":"error","react/no-deprecated":"error","react/no-direct-mutation-state":"error","react/no-find-dom-node":"error","react/no-is-mounted":"error","react/no-render-return-value":"error","react/no-string-refs":"error","react/no-unescaped-entities":"error","react/no-unknown-property":"error","react/no-unsafe":"off","react/prop-types":"error","react/require-render-return":"error","react/react-in-jsx-scope":"off","react/jsx-uses-react":"off","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"react/self-closing-comp":"error","react/jsx-curly-brace-presence":"error","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/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"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-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":"off","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/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"},$=({utilities:e=[]}={})=>[{name:"jimmy.codes/react",files:[f,j],plugins:{react:k,"react-hooks":q,"jsx-a11y":{rules:m.rules},"react-refresh":E},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...l.browser}},settings:{react:{version:"detect"}},rules:I},...e.includes("@tanstack/query")?[{name:"jimmy.codes/react/query",files:[f,j],plugins:{"@tanstack/query":C},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]:[]],g={...n.configs["flat/recommended"].rules,...n.configs["flat/style"].rules,"jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"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"},N=()=>[{name:"jimmy.codes/testing/testing-library",files:i,plugins:{"testing-library":u,"jest-dom":d},rules:{...u.configs.react.rules,...d.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:y,rules:{"testing-library/prefer-screen-queries":"off"}}],P=({framework:e="vitest",utilities:r}={})=>[{name:"jimmy.codes/testing",files:i,...n.configs["flat/recommended"]},...e==="vitest"?[{name:"jimmy.codes/testing/vitest",files:i,...n.configs["flat/recommended"],rules:{...g,"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:D}]}}]:[{name:"jimmy.codes/testing/jest",files:i,...n.configs["flat/recommended"],rules:g}],{name:"jimmy.codes/testing/disabled",files:y,rules:{"jest/require-hook":"off"}},...r?.includes("testing-library")?N():[]],X=e=>a.config(...a.configs.strictTypeChecked,{name:"jimmy.codes/typescript",extends:[...a.configs.strictTypeChecked,...a.configs.stylisticTypeChecked],languageOptions:{parserOptions:{project:e.project,tsconfigRootDir:process.cwd()}},rules:{"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"inline-type-imports"}],"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!0}],"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}]}},{files:[R,f],...a.configs.disableTypeChecked}),A={...w.configs.recommended.rules,curly:"error","arrow-body-style":["error","always"],"object-shorthand":"error","prefer-arrow-callback":"error"},F=e=>typeof e=="object"?e:{project:"./tsconfig.json"},J=e=>typeof e=="object"?e:{framework:"vitest"},V=e=>typeof e=="object"?e:{utilities:[]},z=({typescript:e=!1,react:r=!1,testing:t=!1,overrides:c=[]}={})=>[{name:"jimmy.codes/base",rules:A},...T({typescript:e}),...e?X(F(e)):[],...r?$(V(r)):[],...t?P(J(t)):[],{name:"jimmy.codes/disabled",...x},{name:"jimmy.codes/commonjs",files:[B],languageOptions:{globals:l.commonjs}},{ignores:G},...c];module.exports=z;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as eslint_plugin_jest_dom from 'eslint-plugin-jest-dom';
2
2
  import * as eslint_plugin_testing_library from 'eslint-plugin-testing-library';
3
+ import * as _tanstack_eslint_plugin_query from '@tanstack/eslint-plugin-query';
3
4
  import * as eslint_plugin_react_refresh from 'eslint-plugin-react-refresh';
4
5
  import * as eslint_plugin_react_hooks from 'eslint-plugin-react-hooks';
5
6
  import * as eslint from 'eslint';
@@ -17,6 +18,7 @@ interface TypescriptOptions {
17
18
  }
18
19
  type TestingFrameworks = "vitest" | "jest";
19
20
  type TestingUtilities = "testing-library";
21
+ type ReactUtilities = "@tanstack/query";
20
22
  interface TestingOptions {
21
23
  /**
22
24
  * Which testing framework are you using?
@@ -29,6 +31,13 @@ interface TestingOptions {
29
31
  */
30
32
  utilities?: TestingUtilities[];
31
33
  }
34
+ interface ReactOptions {
35
+ /**
36
+ * Enable additional rules for utilities such as:
37
+ * - [React Query](https://tanstack.com/query/latest/docs/framework/react/overview)
38
+ */
39
+ utilities?: ReactUtilities[];
40
+ }
32
41
  type FlatConfigItem = Omit<Linter.FlatConfig, "plugins"> & {
33
42
  name?: string;
34
43
  plugins?: Record<string, unknown>;
@@ -44,7 +53,7 @@ interface Options {
44
53
  * Are React rules are enabled?
45
54
  * @default false
46
55
  */
47
- react?: boolean;
56
+ react?: boolean | ReactOptions;
48
57
  /**
49
58
  * Are Jest rules are enabled?
50
59
  * @default false
@@ -299,6 +308,17 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
299
308
  "simple-import-sort": eslint.ESLint.Plugin;
300
309
  "node-import": eslint.ESLint.Plugin;
301
310
  };
311
+ settings: {
312
+ "import-x/parsers": {
313
+ espree: string[];
314
+ };
315
+ };
316
+ languageOptions: {
317
+ parserOptions: {
318
+ ecmaVersion: string;
319
+ sourceType: string;
320
+ };
321
+ };
302
322
  rules: {
303
323
  "import-x/namespace": "off";
304
324
  "import-x/newline-after-import": "error";
@@ -328,6 +348,7 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
328
348
  rules: Record<string, eslint.Rule.RuleModule | ((context: eslint.Rule.RuleContext) => eslint.Rule.RuleListener)> | undefined;
329
349
  };
330
350
  "react-refresh": typeof eslint_plugin_react_refresh;
351
+ "@tanstack/query"?: undefined;
331
352
  };
332
353
  languageOptions: {
333
354
  parserOptions: {
@@ -1477,7 +1498,9 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1477
1498
  "react/jsx-no-script-url": "error";
1478
1499
  "react/jsx-no-useless-fragment": "error";
1479
1500
  "react/jsx-one-expression-per-line": "off";
1480
- "react/jsx-pascal-case": "error";
1501
+ "react/jsx-pascal-case": ["error", {
1502
+ allowNamespace: boolean;
1503
+ }];
1481
1504
  "react/jsx-props-no-spreading": "off";
1482
1505
  "react/jsx-sort-default-props": "off";
1483
1506
  "react/jsx-sort-props": "off";
@@ -1515,6 +1538,23 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1515
1538
  "react/style-prop-object": "error";
1516
1539
  "react/void-dom-elements-no-children": "error";
1517
1540
  };
1541
+ } | {
1542
+ name: string;
1543
+ files: string[];
1544
+ plugins: {
1545
+ "@tanstack/query": typeof _tanstack_eslint_plugin_query;
1546
+ react?: undefined;
1547
+ "react-hooks"?: undefined;
1548
+ "jsx-a11y"?: undefined;
1549
+ "react-refresh"?: undefined;
1550
+ };
1551
+ rules: {
1552
+ "@tanstack/query/exhaustive-deps": string;
1553
+ "@tanstack/query/no-rest-destructuring": string;
1554
+ "@tanstack/query/stable-query-client": string;
1555
+ };
1556
+ languageOptions?: undefined;
1557
+ settings?: undefined;
1518
1558
  } | {
1519
1559
  name: string;
1520
1560
  files: string[];
@@ -1533,6 +1573,67 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1533
1573
  "testing-library/prefer-screen-queries": string;
1534
1574
  };
1535
1575
  plugins?: undefined;
1576
+ } | {
1577
+ plugins: string[];
1578
+ rules: eslint.Linter.RulesRecord;
1579
+ languageOptions: {
1580
+ ecmaVersion?: "latest" | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | undefined;
1581
+ sourceType?: "module" | "script" | "commonjs" | undefined;
1582
+ globals?: eslint.ESLint.Globals | undefined;
1583
+ parser?: eslint.Linter.FlatConfigParserModule | undefined;
1584
+ parserOptions?: eslint.Linter.ParserOptions | undefined;
1585
+ } | undefined;
1586
+ name: string;
1587
+ files: string[];
1588
+ } | {
1589
+ rules: {
1590
+ "jest/no-deprecated-functions": string;
1591
+ "jest/require-hook": (string | {
1592
+ allowedFunctionCalls: string[];
1593
+ })[];
1594
+ "jest/no-alias-methods": "error";
1595
+ "jest/no-commented-out-tests": "error";
1596
+ "jest/consistent-test-it": ["error", {
1597
+ fn: string;
1598
+ withinDescribe: string;
1599
+ }];
1600
+ "jest/no-conditional-in-test": "error";
1601
+ "jest/no-confusing-set-timeout": "error";
1602
+ "jest/no-duplicate-hooks": "error";
1603
+ "jest/no-hooks": "off";
1604
+ "jest/no-large-snapshots": "off";
1605
+ "jest/no-restricted-jest-methods": "off";
1606
+ "jest/no-restricted-matchers": "off";
1607
+ "jest/no-test-return-statement": "error";
1608
+ "jest/no-untyped-mock-factory": "off";
1609
+ "jest/prefer-called-with": "error";
1610
+ "jest/prefer-comparison-matcher": "error";
1611
+ "jest/prefer-each": "error";
1612
+ "jest/prefer-equality-matcher": "error";
1613
+ "jest/prefer-expect-assertions": "off";
1614
+ "jest/prefer-expect-resolves": "error";
1615
+ "jest/prefer-hooks-in-order": "error";
1616
+ "jest/prefer-hooks-on-top": "error";
1617
+ "jest/prefer-lowercase-title": "off";
1618
+ "jest/prefer-mock-promise-shorthand": "error";
1619
+ "jest/prefer-snapshot-hint": "error";
1620
+ "jest/prefer-spy-on": "off";
1621
+ "jest/prefer-strict-equal": "error";
1622
+ "jest/prefer-todo": "warn";
1623
+ "jest/require-to-throw-message": "error";
1624
+ "jest/require-top-level-describe": "off";
1625
+ "jest/unbound-method": "off";
1626
+ };
1627
+ plugins: string[];
1628
+ languageOptions: {
1629
+ ecmaVersion?: "latest" | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | undefined;
1630
+ sourceType?: "module" | "script" | "commonjs" | undefined;
1631
+ globals?: eslint.ESLint.Globals | undefined;
1632
+ parser?: eslint.Linter.FlatConfigParserModule | undefined;
1633
+ parserOptions?: eslint.Linter.ParserOptions | undefined;
1634
+ } | undefined;
1635
+ name: string;
1636
+ files: string[];
1536
1637
  } | {
1537
1638
  name: string;
1538
1639
  files: string[];
@@ -1547,9 +1648,25 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1547
1648
  "object-shorthand": "error";
1548
1649
  "prefer-arrow-callback": "error";
1549
1650
  };
1651
+ files?: undefined;
1652
+ languageOptions?: undefined;
1550
1653
  } | {
1551
1654
  rules: eslint.Linter.RulesRecord;
1552
1655
  name: string;
1656
+ files?: undefined;
1657
+ languageOptions?: undefined;
1658
+ } | {
1659
+ name: string;
1660
+ files: string[];
1661
+ languageOptions: {
1662
+ globals: {
1663
+ readonly exports: true;
1664
+ readonly global: false;
1665
+ readonly module: false;
1666
+ readonly require: false;
1667
+ };
1668
+ };
1669
+ rules?: undefined;
1553
1670
  })[];
1554
1671
 
1555
1672
  export { jimmyDotCodes as default };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as eslint_plugin_jest_dom from 'eslint-plugin-jest-dom';
2
2
  import * as eslint_plugin_testing_library from 'eslint-plugin-testing-library';
3
+ import * as _tanstack_eslint_plugin_query from '@tanstack/eslint-plugin-query';
3
4
  import * as eslint_plugin_react_refresh from 'eslint-plugin-react-refresh';
4
5
  import * as eslint_plugin_react_hooks from 'eslint-plugin-react-hooks';
5
6
  import * as eslint from 'eslint';
@@ -17,6 +18,7 @@ interface TypescriptOptions {
17
18
  }
18
19
  type TestingFrameworks = "vitest" | "jest";
19
20
  type TestingUtilities = "testing-library";
21
+ type ReactUtilities = "@tanstack/query";
20
22
  interface TestingOptions {
21
23
  /**
22
24
  * Which testing framework are you using?
@@ -29,6 +31,13 @@ interface TestingOptions {
29
31
  */
30
32
  utilities?: TestingUtilities[];
31
33
  }
34
+ interface ReactOptions {
35
+ /**
36
+ * Enable additional rules for utilities such as:
37
+ * - [React Query](https://tanstack.com/query/latest/docs/framework/react/overview)
38
+ */
39
+ utilities?: ReactUtilities[];
40
+ }
32
41
  type FlatConfigItem = Omit<Linter.FlatConfig, "plugins"> & {
33
42
  name?: string;
34
43
  plugins?: Record<string, unknown>;
@@ -44,7 +53,7 @@ interface Options {
44
53
  * Are React rules are enabled?
45
54
  * @default false
46
55
  */
47
- react?: boolean;
56
+ react?: boolean | ReactOptions;
48
57
  /**
49
58
  * Are Jest rules are enabled?
50
59
  * @default false
@@ -299,6 +308,17 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
299
308
  "simple-import-sort": eslint.ESLint.Plugin;
300
309
  "node-import": eslint.ESLint.Plugin;
301
310
  };
311
+ settings: {
312
+ "import-x/parsers": {
313
+ espree: string[];
314
+ };
315
+ };
316
+ languageOptions: {
317
+ parserOptions: {
318
+ ecmaVersion: string;
319
+ sourceType: string;
320
+ };
321
+ };
302
322
  rules: {
303
323
  "import-x/namespace": "off";
304
324
  "import-x/newline-after-import": "error";
@@ -328,6 +348,7 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
328
348
  rules: Record<string, eslint.Rule.RuleModule | ((context: eslint.Rule.RuleContext) => eslint.Rule.RuleListener)> | undefined;
329
349
  };
330
350
  "react-refresh": typeof eslint_plugin_react_refresh;
351
+ "@tanstack/query"?: undefined;
331
352
  };
332
353
  languageOptions: {
333
354
  parserOptions: {
@@ -1477,7 +1498,9 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1477
1498
  "react/jsx-no-script-url": "error";
1478
1499
  "react/jsx-no-useless-fragment": "error";
1479
1500
  "react/jsx-one-expression-per-line": "off";
1480
- "react/jsx-pascal-case": "error";
1501
+ "react/jsx-pascal-case": ["error", {
1502
+ allowNamespace: boolean;
1503
+ }];
1481
1504
  "react/jsx-props-no-spreading": "off";
1482
1505
  "react/jsx-sort-default-props": "off";
1483
1506
  "react/jsx-sort-props": "off";
@@ -1515,6 +1538,23 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1515
1538
  "react/style-prop-object": "error";
1516
1539
  "react/void-dom-elements-no-children": "error";
1517
1540
  };
1541
+ } | {
1542
+ name: string;
1543
+ files: string[];
1544
+ plugins: {
1545
+ "@tanstack/query": typeof _tanstack_eslint_plugin_query;
1546
+ react?: undefined;
1547
+ "react-hooks"?: undefined;
1548
+ "jsx-a11y"?: undefined;
1549
+ "react-refresh"?: undefined;
1550
+ };
1551
+ rules: {
1552
+ "@tanstack/query/exhaustive-deps": string;
1553
+ "@tanstack/query/no-rest-destructuring": string;
1554
+ "@tanstack/query/stable-query-client": string;
1555
+ };
1556
+ languageOptions?: undefined;
1557
+ settings?: undefined;
1518
1558
  } | {
1519
1559
  name: string;
1520
1560
  files: string[];
@@ -1533,6 +1573,67 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1533
1573
  "testing-library/prefer-screen-queries": string;
1534
1574
  };
1535
1575
  plugins?: undefined;
1576
+ } | {
1577
+ plugins: string[];
1578
+ rules: eslint.Linter.RulesRecord;
1579
+ languageOptions: {
1580
+ ecmaVersion?: "latest" | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | undefined;
1581
+ sourceType?: "module" | "script" | "commonjs" | undefined;
1582
+ globals?: eslint.ESLint.Globals | undefined;
1583
+ parser?: eslint.Linter.FlatConfigParserModule | undefined;
1584
+ parserOptions?: eslint.Linter.ParserOptions | undefined;
1585
+ } | undefined;
1586
+ name: string;
1587
+ files: string[];
1588
+ } | {
1589
+ rules: {
1590
+ "jest/no-deprecated-functions": string;
1591
+ "jest/require-hook": (string | {
1592
+ allowedFunctionCalls: string[];
1593
+ })[];
1594
+ "jest/no-alias-methods": "error";
1595
+ "jest/no-commented-out-tests": "error";
1596
+ "jest/consistent-test-it": ["error", {
1597
+ fn: string;
1598
+ withinDescribe: string;
1599
+ }];
1600
+ "jest/no-conditional-in-test": "error";
1601
+ "jest/no-confusing-set-timeout": "error";
1602
+ "jest/no-duplicate-hooks": "error";
1603
+ "jest/no-hooks": "off";
1604
+ "jest/no-large-snapshots": "off";
1605
+ "jest/no-restricted-jest-methods": "off";
1606
+ "jest/no-restricted-matchers": "off";
1607
+ "jest/no-test-return-statement": "error";
1608
+ "jest/no-untyped-mock-factory": "off";
1609
+ "jest/prefer-called-with": "error";
1610
+ "jest/prefer-comparison-matcher": "error";
1611
+ "jest/prefer-each": "error";
1612
+ "jest/prefer-equality-matcher": "error";
1613
+ "jest/prefer-expect-assertions": "off";
1614
+ "jest/prefer-expect-resolves": "error";
1615
+ "jest/prefer-hooks-in-order": "error";
1616
+ "jest/prefer-hooks-on-top": "error";
1617
+ "jest/prefer-lowercase-title": "off";
1618
+ "jest/prefer-mock-promise-shorthand": "error";
1619
+ "jest/prefer-snapshot-hint": "error";
1620
+ "jest/prefer-spy-on": "off";
1621
+ "jest/prefer-strict-equal": "error";
1622
+ "jest/prefer-todo": "warn";
1623
+ "jest/require-to-throw-message": "error";
1624
+ "jest/require-top-level-describe": "off";
1625
+ "jest/unbound-method": "off";
1626
+ };
1627
+ plugins: string[];
1628
+ languageOptions: {
1629
+ ecmaVersion?: "latest" | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | undefined;
1630
+ sourceType?: "module" | "script" | "commonjs" | undefined;
1631
+ globals?: eslint.ESLint.Globals | undefined;
1632
+ parser?: eslint.Linter.FlatConfigParserModule | undefined;
1633
+ parserOptions?: eslint.Linter.ParserOptions | undefined;
1634
+ } | undefined;
1635
+ name: string;
1636
+ files: string[];
1536
1637
  } | {
1537
1638
  name: string;
1538
1639
  files: string[];
@@ -1547,9 +1648,25 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1547
1648
  "object-shorthand": "error";
1548
1649
  "prefer-arrow-callback": "error";
1549
1650
  };
1651
+ files?: undefined;
1652
+ languageOptions?: undefined;
1550
1653
  } | {
1551
1654
  rules: eslint.Linter.RulesRecord;
1552
1655
  name: string;
1656
+ files?: undefined;
1657
+ languageOptions?: undefined;
1658
+ } | {
1659
+ name: string;
1660
+ files: string[];
1661
+ languageOptions: {
1662
+ globals: {
1663
+ readonly exports: true;
1664
+ readonly global: false;
1665
+ readonly module: false;
1666
+ readonly require: false;
1667
+ };
1668
+ };
1669
+ rules?: undefined;
1553
1670
  })[];
1554
1671
 
1555
1672
  export { jimmyDotCodes as default };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import u from"eslint-config-prettier";import t from"eslint-plugin-import-x";import j from"eslint-plugin-node-import";import y from"eslint-plugin-simple-import-sort";import a from"eslint-plugin-jsx-a11y";import g from"eslint-plugin-react";import x from"eslint-plugin-react-hooks";import*as h from"eslint-plugin-react-refresh";import b from"globals";import n from"eslint-plugin-jest";import*as i from"eslint-plugin-jest-dom";import p from"eslint-plugin-testing-library";import{config as k,configs as o}from"typescript-eslint";import v from"@eslint/js";const w={...t.configs.recommended.rules,"import-x/namespace":"off","import-x/newline-after-import":"error","import-x/first":"error","import-x/no-absolute-path":"error","import-x/no-useless-path-segments":"error","import-x/no-empty-named-blocks":"error","import-x/no-self-import":"error","simple-import-sort/imports":"error","simple-import-sort/exports":"error","node-import/prefer-node-protocol":"error"},_={name:"jimmy.codes/imports/typescript",settings:{...t.configs.typescript.settings,"import-x/resolver":{...t.configs.typescript.settings["import-x/resolver"],typescript:!0}},rules:t.configs.typescript.rules},C=({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":t,"simple-import-sort":y,"node-import":j},rules:w},...e?[_]:[]],r="?([cm])[jt]s?(x)",O=["**/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","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs"],q="**/*.?([cm])js",f="**/*.?([cm])jsx",L="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${r}`,`**/*.spec.${r}`,`**/*.test.${r}`,`**/*.bench.${r}`,`**/*.benchmark.${r}`],l=[`**/e2e/**/*.spec.${r}`,`**/e2e/**/*.test.${r}`],S={...a.configs.recommended.rules,"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react/display-name":"error","react/jsx-key":"error","react/jsx-no-comment-textnodes":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-target-blank":"error","react/jsx-no-undef":"error","react/jsx-uses-vars":"error","react/no-children-prop":"error","react/no-danger-with-children":"error","react/no-deprecated":"error","react/no-direct-mutation-state":"error","react/no-find-dom-node":"error","react/no-is-mounted":"error","react/no-render-return-value":"error","react/no-string-refs":"error","react/no-unescaped-entities":"error","react/no-unknown-property":"error","react/no-unsafe":"off","react/prop-types":"error","react/require-render-return":"error","react/react-in-jsx-scope":"off","react/jsx-uses-react":"off","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"react/self-closing-comp":"error","react/jsx-curly-brace-presence":"error","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/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"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","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":"off","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/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"},T=()=>[{name:"jimmy.codes/react",files:[f,L],plugins:{react:g,"react-hooks":x,"jsx-a11y":{rules:a.rules},"react-refresh":h},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...b.browser}},settings:{react:{version:"detect"}},rules:S}],E={...n.configs["flat/recommended"].rules,...n.configs["flat/style"].rules,"jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"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"},G=()=>[{name:"jimmy.codes/testing/testing-library",files:m,plugins:{"testing-library":p,"jest-dom":i},rules:{...p.configs.react.rules,...i.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:l,rules:{"testing-library/prefer-screen-queries":"off"}}],R=({framework:e="vitest",utilities:s})=>[{name:"jimmy.codes/testing",files:m,...n.configs["flat/recommended"],rules:{...E,...e==="vitest"&&{"jest/no-deprecated-functions":"off"}}},{name:"jimmy.codes/testing/disabled",files:l,rules:{"jest/require-hook":"off"}},...s?.includes("testing-library")?G():[]],B=e=>k(...o.strictTypeChecked,{name:"jimmy.codes/typescript",extends:[...o.strictTypeChecked,...o.stylisticTypeChecked],languageOptions:{parserOptions:{project:e.project,tsconfigRootDir:process.cwd()}},rules:{"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"inline-type-imports"}],"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!0}],"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}]}},{files:[q,f],...o.disableTypeChecked}),$={...v.configs.recommended.rules,curly:"error","arrow-body-style":["error","always"],"object-shorthand":"error","prefer-arrow-callback":"error"},I=e=>typeof e=="object"?e:{project:"./tsconfig.json"},D=e=>typeof e=="object"?e:{framework:"vitest"},X=({typescript:e=!1,react:s=!1,testing:c=!1,overrides:d=[]}={})=>[{name:"jimmy.codes/base",rules:$},...C({typescript:e}),...e?B(I(e)):[],...s?T():[],...c?R(D(c)):[],{name:"jimmy.codes/disabled",...u},{ignores:O},...d];export{X as default};
1
+ import g from"eslint-config-prettier";import p from"globals";import t from"eslint-plugin-import-x";import x from"eslint-plugin-node-import";import h from"eslint-plugin-simple-import-sort";import*as b from"@tanstack/eslint-plugin-query";import f from"eslint-plugin-jsx-a11y";import k from"eslint-plugin-react";import v from"eslint-plugin-react-hooks";import*as w from"eslint-plugin-react-refresh";import o from"eslint-plugin-jest";import*as m from"eslint-plugin-jest-dom";import l from"eslint-plugin-testing-library";import{config as O,configs as n}from"typescript-eslint";import _ from"@eslint/js";const q={...t.configs.recommended.rules,"import-x/namespace":"off","import-x/newline-after-import":"error","import-x/first":"error","import-x/no-absolute-path":"error","import-x/no-useless-path-segments":"error","import-x/no-empty-named-blocks":"error","import-x/no-self-import":"error","simple-import-sort/imports":"error","simple-import-sort/exports":"error","node-import/prefer-node-protocol":"error"},C={name:"jimmy.codes/imports/typescript",settings:{...t.configs.typescript.settings,"import-x/resolver":{...t.configs.typescript.settings["import-x/resolver"],typescript:!0}},rules:t.configs.typescript.rules},L=({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":t,"simple-import-sort":h,"node-import":x},settings:{"import-x/parsers":{espree:[".js",".cjs",".mjs",".jsx"]}},languageOptions:{parserOptions:{ecmaVersion:"latest",sourceType:"module"}},rules:q},...e?[C]:[]],r="?([cm])[jt]s?(x)",S=["**/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","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs"],T="**/*.?([cm])js",a="**/*.?([cm])jsx",d="**/*.?([cm])tsx",c=[`**/__tests__/**/*.${r}`,`**/*.spec.${r}`,`**/*.test.${r}`,`**/*.bench.${r}`,`**/*.benchmark.${r}`],u=[`**/e2e/**/*.spec.${r}`,`**/e2e/**/*.test.${r}`],E="**/*.cjs",G=["vi.mock"],R={...f.configs.recommended.rules,"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react/display-name":"error","react/jsx-key":"error","react/jsx-no-comment-textnodes":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-target-blank":"error","react/jsx-no-undef":"error","react/jsx-uses-vars":"error","react/no-children-prop":"error","react/no-danger-with-children":"error","react/no-deprecated":"error","react/no-direct-mutation-state":"error","react/no-find-dom-node":"error","react/no-is-mounted":"error","react/no-render-return-value":"error","react/no-string-refs":"error","react/no-unescaped-entities":"error","react/no-unknown-property":"error","react/no-unsafe":"off","react/prop-types":"error","react/require-render-return":"error","react/react-in-jsx-scope":"off","react/jsx-uses-react":"off","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"react/self-closing-comp":"error","react/jsx-curly-brace-presence":"error","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/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"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-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":"off","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/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"},B=({utilities:e=[]}={})=>[{name:"jimmy.codes/react",files:[a,d],plugins:{react:k,"react-hooks":v,"jsx-a11y":{rules:f.rules},"react-refresh":w},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...p.browser}},settings:{react:{version:"detect"}},rules:R},...e.includes("@tanstack/query")?[{name:"jimmy.codes/react/query",files:[a,d],plugins:{"@tanstack/query":b},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]:[]],j={...o.configs["flat/recommended"].rules,...o.configs["flat/style"].rules,"jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"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"},I=()=>[{name:"jimmy.codes/testing/testing-library",files:c,plugins:{"testing-library":l,"jest-dom":m},rules:{...l.configs.react.rules,...m.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:u,rules:{"testing-library/prefer-screen-queries":"off"}}],$=({framework:e="vitest",utilities:s}={})=>[{name:"jimmy.codes/testing",files:c,...o.configs["flat/recommended"]},...e==="vitest"?[{name:"jimmy.codes/testing/vitest",files:c,...o.configs["flat/recommended"],rules:{...j,"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:G}]}}]:[{name:"jimmy.codes/testing/jest",files:c,...o.configs["flat/recommended"],rules:j}],{name:"jimmy.codes/testing/disabled",files:u,rules:{"jest/require-hook":"off"}},...s?.includes("testing-library")?I():[]],D=e=>O(...n.strictTypeChecked,{name:"jimmy.codes/typescript",extends:[...n.strictTypeChecked,...n.stylisticTypeChecked],languageOptions:{parserOptions:{project:e.project,tsconfigRootDir:process.cwd()}},rules:{"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"inline-type-imports"}],"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!0}],"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}]}},{files:[T,a],...n.disableTypeChecked}),N={..._.configs.recommended.rules,curly:"error","arrow-body-style":["error","always"],"object-shorthand":"error","prefer-arrow-callback":"error"},X=e=>typeof e=="object"?e:{project:"./tsconfig.json"},A=e=>typeof e=="object"?e:{framework:"vitest"},F=e=>typeof e=="object"?e:{utilities:[]},J=({typescript:e=!1,react:s=!1,testing:i=!1,overrides:y=[]}={})=>[{name:"jimmy.codes/base",rules:N},...L({typescript:e}),...e?D(X(e)):[],...s?B(F(s)):[],...i?$(A(i)):[],{name:"jimmy.codes/disabled",...g},{name:"jimmy.codes/commonjs",files:[E],languageOptions:{globals:p.commonjs}},{ignores:S},...y];export{J as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimmy.codes/eslint-config",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "another opinionated eslint config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -32,6 +32,7 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@eslint/js": "^8.57.0",
35
+ "@tanstack/eslint-plugin-query": "^5.28.11",
35
36
  "@typescript-eslint/utils": "^7.6.0",
36
37
  "eslint-config-prettier": "^9.1.0",
37
38
  "eslint-import-resolver-typescript": "^3.6.1",