@jimmy.codes/eslint-config 1.3.0 → 1.5.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
@@ -66,6 +66,14 @@ export default jimmyDotCodes({
66
66
  });
67
67
  ```
68
68
 
69
+ Or you can enable auto detection to enable rules based on a project's dependencies
70
+
71
+ ```js
72
+ import jimmyDotCodes from "@jimmy.codes/eslint-config";
73
+
74
+ export default jimmyDotCodes({ autoDetect: true });
75
+ ```
76
+
69
77
  #### TypeScript
70
78
 
71
79
  You can also change the project location which can be helpful for monorepos:
package/dist/index.cjs CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";var O=require("eslint-config-prettier"),d=require("globals"),a=require("eslint-plugin-import-x"),E=require("eslint-plugin-node-import"),w=require("eslint-plugin-simple-import-sort"),T=require("@tanstack/eslint-plugin-query"),j=require("eslint-plugin-jsx-a11y"),C=require("eslint-plugin-react"),L=require("eslint-plugin-react-hooks"),R=require("eslint-plugin-react-refresh"),c=require("local-pkg"),i=require("eslint-plugin-jest"),S=require("eslint-plugin-jest-dom"),y=require("eslint-plugin-testing-library"),p=require("typescript-eslint"),G=require("@eslint/js");function m(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var P=m(T),I=m(R),g=m(S);const s="?([cm])[jt]s?(x)",B=["**/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"],$="**/*.?([cm])js",u="**/*.?([cm])jsx",x="**/*.?([cm])tsx",l=[`**/__tests__/**/*.${s}`,`**/*.spec.${s}`,`**/*.test.${s}`,`**/*.bench.${s}`,`**/*.benchmark.${s}`],h=[`**/e2e/**/*.spec.${s}`,`**/e2e/**/*.test.${s}`,`**/cypress/**/*.spec.${s}`,`**/cypress/**/*.test.${s}`],N="**/*.cjs",A=["vi.mock"],J=["@testing-library/react"],V=()=>[{name:"jimmy.codes/commonjs",files:[N],languageOptions:{globals:d.commonjs}}],F={...a.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"},Q={name:"jimmy.codes/imports/typescript",settings:{...a.configs.typescript.settings,"import-x/resolver":{...a.configs.typescript.settings["import-x/resolver"],typescript:!0}},rules:a.configs.typescript.rules},X=({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":a,"simple-import-sort":w,"node-import":E},settings:{"import-x/parsers":{espree:[".js",".cjs",".mjs",".jsx"]}},languageOptions:{parserOptions:{ecmaVersion:"latest",sourceType:"module"}},rules:F},...e?[Q]:[]],z=()=>c.isPackageExists("typescript"),D=()=>c.isPackageExists("react"),b=()=>c.isPackageExists("vitest"),k=()=>c.isPackageExists("jest"),H=()=>b()||k(),M=()=>J.some(e=>c.isPackageExists(e)),W=()=>c.isPackageExists("@tanstack/react-query"),Y={...j.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"},U=({utilities:e=[]}={},t=!1)=>{const r=e.includes("@tanstack/query")||t&&W();return[{name:"jimmy.codes/react",files:[u,x],plugins:{react:C,"react-hooks":L,"jsx-a11y":{rules:j.rules},"react-refresh":I},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...d.browser}},settings:{react:{version:"detect"}},rules:Y},...r?[{name:"jimmy.codes/react/query",files:[u,x],plugins:{"@tanstack/query":P},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]:[]]},v={...i.configs["flat/recommended"].rules,...i.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"},K=()=>[{name:"jimmy.codes/testing/testing-library",files:l,plugins:{"testing-library":y,"jest-dom":g},rules:{...y.configs.react.rules,...g.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:h,rules:{"testing-library/prefer-screen-queries":"off"}}],Z=({framework:e="vitest",utilities:t}={},r=!1)=>{const n=r?b():e==="vitest",o=e==="jest"||r&&k(),f=!!t?.includes("testing-library")||r&&M();return[{name:"jimmy.codes/testing",files:l,...i.configs["flat/recommended"]},...n?[{name:"jimmy.codes/testing/vitest",files:l,...i.configs["flat/recommended"],rules:{...v,"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:A}]}}]:[],...o?[{name:"jimmy.codes/testing/jest",files:l,...i.configs["flat/recommended"],rules:v}]:[],{name:"jimmy.codes/testing/disabled",files:h,rules:{"jest/expect-expect":"off","jest/no-deprecated-functions":"off","jest/require-hook":"off"}},...f?K():[]]},ee=e=>p.config(...p.configs.strictTypeChecked,{name:"jimmy.codes/typescript",extends:[...p.configs.strictTypeChecked,...p.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}}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}]}},{files:[$,u],...p.configs.disableTypeChecked}),re={...G.configs.recommended.rules,curly:"error","arrow-body-style":["error","always"],"object-shorthand":"error","prefer-arrow-callback":"error","no-console":"warn"},te=e=>typeof e=="object"?e:{project:"./tsconfig.json"},se=e=>typeof e=="object"?e:{framework:"vitest"},oe=e=>typeof e=="object"?e:{utilities:[]},ne=({typescript:e=!1,react:t=!1,testing:r=!1,overrides:n=[],autoDetect:o=!1}={})=>{const f=e||o&&z(),q=t||o&&D(),_=r||o&&H();return[{name:"jimmy.codes/base",rules:re},...X({typescript:f}),...f?ee(te(e)):[],...q?U(oe(t),o):[],..._?Z(se(r),o):[],{name:"jimmy.codes/disabled",...O},...V(),{ignores:B},...n]};module.exports=ne;
package/dist/index.d.cts CHANGED
@@ -68,9 +68,25 @@ interface Options {
68
68
  * @default []
69
69
  */
70
70
  overrides?: FlatConfigItem[];
71
+ /**
72
+ * Is auto detection enabled?
73
+ * @default false
74
+ */
75
+ autoDetect?: boolean;
71
76
  }
72
77
 
73
- declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Options) => (FlatConfigItem | {
78
+ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, autoDetect, }?: Options) => (FlatConfigItem | {
79
+ name: string;
80
+ files: string[];
81
+ languageOptions: {
82
+ globals: {
83
+ readonly exports: true;
84
+ readonly global: false;
85
+ readonly module: false;
86
+ readonly require: false;
87
+ };
88
+ };
89
+ } | {
74
90
  name: string;
75
91
  settings: {
76
92
  "import-x/resolver": {
@@ -1623,6 +1639,53 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1623
1639
  "jest/require-to-throw-message": "error";
1624
1640
  "jest/require-top-level-describe": "off";
1625
1641
  "jest/unbound-method": "off";
1642
+ "jest/expect-expect"?: undefined;
1643
+ };
1644
+ plugins: string[];
1645
+ languageOptions: {
1646
+ 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;
1647
+ sourceType?: "module" | "script" | "commonjs" | undefined;
1648
+ globals?: eslint.ESLint.Globals | undefined;
1649
+ parser?: eslint.Linter.FlatConfigParserModule | undefined;
1650
+ parserOptions?: eslint.Linter.ParserOptions | undefined;
1651
+ } | undefined;
1652
+ name: string;
1653
+ files: string[];
1654
+ } | {
1655
+ rules: {
1656
+ "jest/no-alias-methods": "error";
1657
+ "jest/no-commented-out-tests": "error";
1658
+ "jest/consistent-test-it": ["error", {
1659
+ fn: string;
1660
+ withinDescribe: string;
1661
+ }];
1662
+ "jest/no-conditional-in-test": "error";
1663
+ "jest/no-confusing-set-timeout": "error";
1664
+ "jest/no-duplicate-hooks": "error";
1665
+ "jest/no-hooks": "off";
1666
+ "jest/no-large-snapshots": "off";
1667
+ "jest/no-restricted-jest-methods": "off";
1668
+ "jest/no-restricted-matchers": "off";
1669
+ "jest/no-test-return-statement": "error";
1670
+ "jest/no-untyped-mock-factory": "off";
1671
+ "jest/prefer-called-with": "error";
1672
+ "jest/prefer-comparison-matcher": "error";
1673
+ "jest/prefer-each": "error";
1674
+ "jest/prefer-equality-matcher": "error";
1675
+ "jest/prefer-expect-assertions": "off";
1676
+ "jest/prefer-expect-resolves": "error";
1677
+ "jest/prefer-hooks-in-order": "error";
1678
+ "jest/prefer-hooks-on-top": "error";
1679
+ "jest/prefer-lowercase-title": "off";
1680
+ "jest/prefer-mock-promise-shorthand": "error";
1681
+ "jest/prefer-snapshot-hint": "error";
1682
+ "jest/prefer-spy-on": "off";
1683
+ "jest/prefer-strict-equal": "error";
1684
+ "jest/prefer-todo": "warn";
1685
+ "jest/require-hook": "error";
1686
+ "jest/require-to-throw-message": "error";
1687
+ "jest/require-top-level-describe": "off";
1688
+ "jest/unbound-method": "off";
1626
1689
  };
1627
1690
  plugins: string[];
1628
1691
  languageOptions: {
@@ -1638,6 +1701,8 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1638
1701
  name: string;
1639
1702
  files: string[];
1640
1703
  rules: {
1704
+ "jest/expect-expect": string;
1705
+ "jest/no-deprecated-functions": string;
1641
1706
  "jest/require-hook": string;
1642
1707
  };
1643
1708
  } | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
@@ -1647,26 +1712,11 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1647
1712
  "arrow-body-style": ["error", string];
1648
1713
  "object-shorthand": "error";
1649
1714
  "prefer-arrow-callback": "error";
1715
+ "no-console": "warn";
1650
1716
  };
1651
- files?: undefined;
1652
- languageOptions?: undefined;
1653
1717
  } | {
1654
1718
  rules: eslint.Linter.RulesRecord;
1655
1719
  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;
1670
1720
  })[];
1671
1721
 
1672
1722
  export { jimmyDotCodes as default };
package/dist/index.d.mts CHANGED
@@ -68,9 +68,25 @@ interface Options {
68
68
  * @default []
69
69
  */
70
70
  overrides?: FlatConfigItem[];
71
+ /**
72
+ * Is auto detection enabled?
73
+ * @default false
74
+ */
75
+ autoDetect?: boolean;
71
76
  }
72
77
 
73
- declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Options) => (FlatConfigItem | {
78
+ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, autoDetect, }?: Options) => (FlatConfigItem | {
79
+ name: string;
80
+ files: string[];
81
+ languageOptions: {
82
+ globals: {
83
+ readonly exports: true;
84
+ readonly global: false;
85
+ readonly module: false;
86
+ readonly require: false;
87
+ };
88
+ };
89
+ } | {
74
90
  name: string;
75
91
  settings: {
76
92
  "import-x/resolver": {
@@ -1623,6 +1639,53 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1623
1639
  "jest/require-to-throw-message": "error";
1624
1640
  "jest/require-top-level-describe": "off";
1625
1641
  "jest/unbound-method": "off";
1642
+ "jest/expect-expect"?: undefined;
1643
+ };
1644
+ plugins: string[];
1645
+ languageOptions: {
1646
+ 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;
1647
+ sourceType?: "module" | "script" | "commonjs" | undefined;
1648
+ globals?: eslint.ESLint.Globals | undefined;
1649
+ parser?: eslint.Linter.FlatConfigParserModule | undefined;
1650
+ parserOptions?: eslint.Linter.ParserOptions | undefined;
1651
+ } | undefined;
1652
+ name: string;
1653
+ files: string[];
1654
+ } | {
1655
+ rules: {
1656
+ "jest/no-alias-methods": "error";
1657
+ "jest/no-commented-out-tests": "error";
1658
+ "jest/consistent-test-it": ["error", {
1659
+ fn: string;
1660
+ withinDescribe: string;
1661
+ }];
1662
+ "jest/no-conditional-in-test": "error";
1663
+ "jest/no-confusing-set-timeout": "error";
1664
+ "jest/no-duplicate-hooks": "error";
1665
+ "jest/no-hooks": "off";
1666
+ "jest/no-large-snapshots": "off";
1667
+ "jest/no-restricted-jest-methods": "off";
1668
+ "jest/no-restricted-matchers": "off";
1669
+ "jest/no-test-return-statement": "error";
1670
+ "jest/no-untyped-mock-factory": "off";
1671
+ "jest/prefer-called-with": "error";
1672
+ "jest/prefer-comparison-matcher": "error";
1673
+ "jest/prefer-each": "error";
1674
+ "jest/prefer-equality-matcher": "error";
1675
+ "jest/prefer-expect-assertions": "off";
1676
+ "jest/prefer-expect-resolves": "error";
1677
+ "jest/prefer-hooks-in-order": "error";
1678
+ "jest/prefer-hooks-on-top": "error";
1679
+ "jest/prefer-lowercase-title": "off";
1680
+ "jest/prefer-mock-promise-shorthand": "error";
1681
+ "jest/prefer-snapshot-hint": "error";
1682
+ "jest/prefer-spy-on": "off";
1683
+ "jest/prefer-strict-equal": "error";
1684
+ "jest/prefer-todo": "warn";
1685
+ "jest/require-hook": "error";
1686
+ "jest/require-to-throw-message": "error";
1687
+ "jest/require-top-level-describe": "off";
1688
+ "jest/unbound-method": "off";
1626
1689
  };
1627
1690
  plugins: string[];
1628
1691
  languageOptions: {
@@ -1638,6 +1701,8 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1638
1701
  name: string;
1639
1702
  files: string[];
1640
1703
  rules: {
1704
+ "jest/expect-expect": string;
1705
+ "jest/no-deprecated-functions": string;
1641
1706
  "jest/require-hook": string;
1642
1707
  };
1643
1708
  } | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
@@ -1647,26 +1712,11 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
1647
1712
  "arrow-body-style": ["error", string];
1648
1713
  "object-shorthand": "error";
1649
1714
  "prefer-arrow-callback": "error";
1715
+ "no-console": "warn";
1650
1716
  };
1651
- files?: undefined;
1652
- languageOptions?: undefined;
1653
1717
  } | {
1654
1718
  rules: eslint.Linter.RulesRecord;
1655
1719
  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;
1670
1720
  })[];
1671
1721
 
1672
1722
  export { jimmyDotCodes as default };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
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};
1
+ import T from"eslint-config-prettier";import u from"globals";import c from"eslint-plugin-import-x";import _ from"eslint-plugin-node-import";import O from"eslint-plugin-simple-import-sort";import*as q from"@tanstack/eslint-plugin-query";import d from"eslint-plugin-jsx-a11y";import C from"eslint-plugin-react";import L from"eslint-plugin-react-hooks";import*as E from"eslint-plugin-react-refresh";import{isPackageExists as n}from"local-pkg";import a from"eslint-plugin-jest";import*as j from"eslint-plugin-jest-dom";import y from"eslint-plugin-testing-library";import{config as R,configs as p}from"typescript-eslint";import S from"@eslint/js";const r="?([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"],I="**/*.?([cm])js",l="**/*.?([cm])jsx",g="**/*.?([cm])tsx",f=[`**/__tests__/**/*.${r}`,`**/*.spec.${r}`,`**/*.test.${r}`,`**/*.bench.${r}`,`**/*.benchmark.${r}`],x=[`**/e2e/**/*.spec.${r}`,`**/e2e/**/*.test.${r}`,`**/cypress/**/*.spec.${r}`,`**/cypress/**/*.test.${r}`],B="**/*.cjs",$=["vi.mock"],N=["@testing-library/react"],A=()=>[{name:"jimmy.codes/commonjs",files:[B],languageOptions:{globals:u.commonjs}}],J={...c.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"},V={name:"jimmy.codes/imports/typescript",settings:{...c.configs.typescript.settings,"import-x/resolver":{...c.configs.typescript.settings["import-x/resolver"],typescript:!0}},rules:c.configs.typescript.rules},F=({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":c,"simple-import-sort":O,"node-import":_},settings:{"import-x/parsers":{espree:[".js",".cjs",".mjs",".jsx"]}},languageOptions:{parserOptions:{ecmaVersion:"latest",sourceType:"module"}},rules:J},...e?[V]:[]],X=()=>n("typescript"),P=()=>n("react"),h=()=>n("vitest"),b=()=>n("jest"),Q=()=>h()||b(),H=()=>N.some(e=>n(e)),M=()=>n("@tanstack/react-query"),W={...d.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"},Y=({utilities:e=[]}={},s=!1)=>{const t=e.includes("@tanstack/query")||s&&M();return[{name:"jimmy.codes/react",files:[l,g],plugins:{react:C,"react-hooks":L,"jsx-a11y":{rules:d.rules},"react-refresh":E},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...u.browser}},settings:{react:{version:"detect"}},rules:W},...t?[{name:"jimmy.codes/react/query",files:[l,g],plugins:{"@tanstack/query":q},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]:[]]},k={...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"},z=()=>[{name:"jimmy.codes/testing/testing-library",files:f,plugins:{"testing-library":y,"jest-dom":j},rules:{...y.configs.react.rules,...j.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:x,rules:{"testing-library/prefer-screen-queries":"off"}}],U=({framework:e="vitest",utilities:s}={},t=!1)=>{const m=t?h():e==="vitest",o=e==="jest"||t&&b(),i=!!s?.includes("testing-library")||t&&H();return[{name:"jimmy.codes/testing",files:f,...a.configs["flat/recommended"]},...m?[{name:"jimmy.codes/testing/vitest",files:f,...a.configs["flat/recommended"],rules:{...k,"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:$}]}}]:[],...o?[{name:"jimmy.codes/testing/jest",files:f,...a.configs["flat/recommended"],rules:k}]:[],{name:"jimmy.codes/testing/disabled",files:x,rules:{"jest/expect-expect":"off","jest/no-deprecated-functions":"off","jest/require-hook":"off"}},...i?z():[]]},K=e=>R(...p.strictTypeChecked,{name:"jimmy.codes/typescript",extends:[...p.strictTypeChecked,...p.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}}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}]}},{files:[I,l],...p.disableTypeChecked}),Z={...S.configs.recommended.rules,curly:"error","arrow-body-style":["error","always"],"object-shorthand":"error","prefer-arrow-callback":"error","no-console":"warn"},D=e=>typeof e=="object"?e:{project:"./tsconfig.json"},ee=e=>typeof e=="object"?e:{framework:"vitest"},re=e=>typeof e=="object"?e:{utilities:[]},te=({typescript:e=!1,react:s=!1,testing:t=!1,overrides:m=[],autoDetect:o=!1}={})=>{const i=e||o&&X(),v=s||o&&P(),w=t||o&&Q();return[{name:"jimmy.codes/base",rules:Z},...F({typescript:i}),...i?K(D(e)):[],...v?Y(re(s),o):[],...w?U(ee(t),o):[],{name:"jimmy.codes/disabled",...T},...A(),{ignores:G},...m]};export{te as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimmy.codes/eslint-config",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "another opinionated eslint config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -47,6 +47,7 @@
47
47
  "eslint-plugin-simple-import-sort": "^12.0.0",
48
48
  "eslint-plugin-testing-library": "^6.2.0",
49
49
  "globals": "^15.0.0",
50
+ "local-pkg": "0.5.0",
50
51
  "typescript-eslint": "^7.6.0"
51
52
  },
52
53
  "peerDependencies": {