@jimmy.codes/eslint-config 1.12.0 → 3.0.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 +35 -23
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1003 -1051
- package/dist/index.d.mts +1003 -1051
- package/dist/index.mjs +1 -1
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
> 🔍 another opinionated [eslint](https://eslint.org) config
|
|
10
10
|
|
|
11
|
-
_This is an evolution of [eslint-config-jimmy-guzman](https://github.com/jimmy-guzman/eslint-config-jimmy-guzman)_
|
|
12
|
-
|
|
13
11
|
## 🛠️ Usage
|
|
14
12
|
|
|
15
13
|
_For a better experience, make sure to use [@jimmy.codes/prettier-config](https://github.com/jimmy-guzman/prettier-config) as well_
|
|
@@ -36,12 +34,14 @@ And if you're using [VS Code](https://code.visualstudio.com), make sure to enabl
|
|
|
36
34
|
```jsonc
|
|
37
35
|
// .vscode/settings.json
|
|
38
36
|
{
|
|
39
|
-
"eslint.
|
|
37
|
+
"eslint.useFlatConfig": true,
|
|
40
38
|
}
|
|
41
39
|
```
|
|
42
40
|
|
|
43
41
|
### 🔧 Configuration
|
|
44
42
|
|
|
43
|
+
**By default all rules are enabled based on the project's dependencies.**
|
|
44
|
+
|
|
45
45
|
This package contains rules that can be enabled or disabled as follows:
|
|
46
46
|
|
|
47
47
|
```js
|
|
@@ -49,34 +49,34 @@ import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
|
49
49
|
|
|
50
50
|
export default jimmyDotCodes({
|
|
51
51
|
/**
|
|
52
|
-
* Are TypeScript rules
|
|
52
|
+
* Are TypeScript rules enabled?
|
|
53
53
|
* @default false
|
|
54
54
|
*/
|
|
55
55
|
typescript: true,
|
|
56
56
|
/**
|
|
57
|
-
* Are React rules
|
|
57
|
+
* Are React rules enabled?
|
|
58
58
|
* @default false
|
|
59
59
|
*/
|
|
60
60
|
react: true,
|
|
61
61
|
/**
|
|
62
|
-
* Are Astro rules
|
|
62
|
+
* Are Astro rules enabled?
|
|
63
63
|
* @default false
|
|
64
64
|
*/
|
|
65
65
|
astro: true,
|
|
66
66
|
/**
|
|
67
|
-
* Are testing rules
|
|
67
|
+
* Are testing rules enabled?
|
|
68
68
|
* @default false
|
|
69
69
|
*/
|
|
70
70
|
testing: true,
|
|
71
71
|
});
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
Or you can
|
|
74
|
+
Or you can turn off auto detection to enable rules based on a project's dependencies
|
|
75
75
|
|
|
76
76
|
```js
|
|
77
77
|
import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
78
78
|
|
|
79
|
-
export default jimmyDotCodes({ autoDetect:
|
|
79
|
+
export default jimmyDotCodes({ autoDetect: false });
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
#### TypeScript
|
|
@@ -122,27 +122,39 @@ export default jimmyDotCodes({
|
|
|
122
122
|
});
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
####
|
|
125
|
+
#### Extending the Configuration
|
|
126
126
|
|
|
127
|
-
You can also extend
|
|
127
|
+
You can also extend the configuration:
|
|
128
128
|
|
|
129
129
|
```js
|
|
130
130
|
import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
131
131
|
|
|
132
|
-
export default jimmyDotCodes(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
files: ["/**/*.js"],
|
|
141
|
-
rules: {
|
|
142
|
-
semi: "error",
|
|
132
|
+
export default jimmyDotCodes(
|
|
133
|
+
{
|
|
134
|
+
configs: [
|
|
135
|
+
{
|
|
136
|
+
files: ["**/*.js"],
|
|
137
|
+
rules: {
|
|
138
|
+
"prefer-spread": "error",
|
|
139
|
+
},
|
|
143
140
|
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
rules: {
|
|
145
|
+
"prefer-const": "error",
|
|
144
146
|
},
|
|
145
|
-
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
You can also extend what is ignored:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
155
|
+
|
|
156
|
+
export default jimmyDotCodes({
|
|
157
|
+
ignores: ["**/*.mjs"],
|
|
146
158
|
});
|
|
147
159
|
```
|
|
148
160
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var r=(e,s)=>w(e,"name",{value:s,configurable:!0});var C=require("eslint-config-prettier"),L=require("astro-eslint-parser"),R=require("eslint-plugin-astro"),l=require("eslint-plugin-jsx-a11y"),y=require("globals"),a=require("typescript-eslint"),p=require("eslint-plugin-import-x"),S=require("eslint-plugin-node-import"),G=require("eslint-plugin-simple-import-sort"),A=require("@tanstack/eslint-plugin-query"),P=require("eslint-plugin-react"),B=require("eslint-plugin-react-hooks"),I=require("eslint-plugin-react-refresh"),c=require("local-pkg"),f=require("eslint-plugin-jest"),$=require("eslint-plugin-jest-dom"),x=require("eslint-plugin-testing-library"),N=require("@eslint/js");function m(e){var s=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:r(function(){return e[t]},"get")})}}),s.default=e,Object.freeze(s)}r(m,"_interopNamespaceDefault");var F=m(L),J=m(A),V=m(I),h=m($);const o="?([cm])[jt]s?(x)",Q=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/storybook-static","**/.eslint-config-inspector","**/playwright-report","**/.astro","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs","!.storybook"],X="**/*.?([cm])js",j="**/*.?([cm])jsx",b="**/*.?([cm])tsx",u=[`**/__tests__/**/*.${o}`,`**/*.spec.${o}`,`**/*.test.${o}`,`**/*.bench.${o}`,`**/*.benchmark.${o}`],v=[`**/e2e/**/*.spec.${o}`,`**/e2e/**/*.test.${o}`,`**/cypress/**/*.spec.${o}`,`**/cypress/**/*.test.${o}`],z="**/*.cjs",H="**/*.astro",M=["vi.mock"],W=["@testing-library/react"],Y=r(()=>{const e=[H];return[{files:e,name:"jimmy.codes/astro",plugins:{astro:R,"jsx-a11y":l},languageOptions:{globals:{...y.node,Astro:!1,Fragment:!1},parser:F,sourceType:"module",parserOptions:{parser:a.parser,extraFileExtensions:[".astro"]}},processor:"astro/client-side-ts",rules:{...l.configs.recommended.rules,"astro/missing-client-only-directive-value":"error","astro/no-conflict-set-directives":"error","astro/no-deprecated-astro-canonicalurl":"error","astro/no-deprecated-astro-fetchcontent":"error","astro/no-deprecated-astro-resolve":"error","astro/no-deprecated-getentrybyslug":"error","astro/no-unused-define-vars-in-style":"error","astro/valid-compile":"error","astro/no-exports-from-components":"off"}},{files:e,...a.configs.disableTypeChecked,name:"jimmy.codes/astro/disable-type-checked"},{settings:{"import-x/core-modules":["astro:content"]},name:"jimmy.codes/astro/imports"}]},"astroConfig"),D=r(()=>[{name:"jimmy.codes/commonjs",files:[z],languageOptions:{globals:y.commonjs}}],"commonjsConfig"),U={...p.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"},K={name:"jimmy.codes/imports/typescript",settings:{...p.configs.typescript.settings,"import-x/resolver":{...p.configs.typescript.settings["import-x/resolver"],typescript:!0}},rules:p.configs.typescript.rules},Z=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":p,"simple-import-sort":G,"node-import":S},settings:{"import-x/parsers":{espree:[".js",".cjs",".mjs",".jsx"]}},languageOptions:{parserOptions:{ecmaVersion:"latest",sourceType:"module"}},rules:U},...e?[K]:[]],"importsConfig"),ee=r(()=>c.isPackageExists("typescript"),"hasTypescript"),re=r(()=>c.isPackageExists("react"),"hasReact"),k=r(()=>c.isPackageExists("vitest"),"hasVitest"),q=r(()=>c.isPackageExists("jest"),"hasJest"),te=r(()=>k()||q(),"hasTesting"),se=r(()=>W.some(e=>c.isPackageExists(e)),"hasTestingLibrary"),oe=r(()=>c.isPackageExists("@tanstack/react-query"),"hasReactQuery"),ne=r(()=>c.isPackageExists("astro"),"hasAstro"),ae={...l.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"},ce=r(({utilities:e=[]}={},s=!1)=>{const t=e.includes("@tanstack/query")||s&&oe();return[{name:"jimmy.codes/react",files:[j,b],plugins:{react:P,"react-hooks":B,"jsx-a11y":l,"react-refresh":V},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...y.browser}},settings:{react:{version:"detect"}},rules:ae},...t?[{name:"jimmy.codes/react/query",files:[j,b],plugins:{"@tanstack/query":J},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]:[]]},"reactConfig"),_={...f.configs["flat/recommended"].rules,...f.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"},ie=r(()=>[{name:"jimmy.codes/testing/testing-library",files:u,plugins:{"testing-library":x,"jest-dom":h},rules:{...x.configs.react.rules,...h.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:v,rules:{"testing-library/prefer-screen-queries":"off"}}],"testingLibraryConfig"),pe=r(({framework:e="vitest",utilities:s}={},t=!1)=>{const i=t?k():e==="vitest",d=e==="jest"||t&&q(),n=!!s?.includes("testing-library")||t&&se();return[{name:"jimmy.codes/testing",files:u,...f.configs["flat/recommended"]},...i?[{name:"jimmy.codes/testing/vitest",files:u,...f.configs["flat/recommended"],rules:{..._,"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:M}]}}]:[],...d?[{name:"jimmy.codes/testing/jest",files:u,...f.configs["flat/recommended"],rules:_}]:[],{name:"jimmy.codes/testing/disabled",files:v,rules:{"jest/expect-expect":"off","jest/no-deprecated-functions":"off","jest/require-hook":"off"}},...n?ie():[]]},"testingConfig"),fe=r(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}}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}]}},{files:[X,j],...a.configs.disableTypeChecked}),"typescriptConfig"),le={...N.configs.recommended.rules,curly:["error","multi-or-nest","consistent"],"arrow-body-style":["error","always"],"object-shorthand":"error","no-useless-rename":"error","prefer-arrow-callback":"error","no-console":"warn"},me=r(e=>typeof e=="object"?e:{project:"./tsconfig.json"},"getTypescriptOptions"),ue=r(e=>typeof e=="object"?e:{framework:"vitest"},"getTestingOptions"),de=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),ye=r(({typescript:e=!1,react:s=!1,testing:t=!1,astro:i=!1,overrides:d=[],autoDetect:n=!1}={})=>{const g=e||n&&ee(),O=s||n&&re(),E=t||n&&te(),T=i||n&&ne();return[{name:"jimmy.codes/base",rules:le},...Z({typescript:g}),...g?fe(me(e)):[],...O?ce(de(s),n):[],...T?Y():[],...E?pe(ue(t),n):[],{name:"jimmy.codes/disabled",...C},...D(),{ignores:Q},...d]},"jimmyDotCodes");module.exports=ye;
|
|
1
|
+
"use strict";var L=Object.defineProperty;var r=(e,s)=>L(e,"name",{value:s,configurable:!0});var R=require("eslint-config-prettier"),S=require("astro-eslint-parser"),G=require("eslint-plugin-astro"),l=require("eslint-plugin-jsx-a11y"),d=require("globals"),a=require("typescript-eslint"),p=require("eslint-plugin-import-x"),P=require("eslint-plugin-node-import"),A=require("eslint-plugin-simple-import-sort"),B=require("@tanstack/eslint-plugin-query"),I=require("eslint-plugin-react"),$=require("eslint-plugin-react-hooks"),N=require("eslint-plugin-react-refresh"),c=require("local-pkg"),f=require("eslint-plugin-jest"),F=require("eslint-plugin-jest-dom"),x=require("eslint-plugin-testing-library"),J=require("@eslint/js");function y(e){var s=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:r(function(){return e[t]},"get")})}}),s.default=e,Object.freeze(s)}r(y,"_interopNamespaceDefault");var V=y(S),X=y(N),h=y(F);const o="?([cm])[jt]s?(x)",z=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/storybook-static","**/.eslint-config-inspector","**/playwright-report","**/.astro","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs","!.storybook"],H="**/*.?([cm])js",g="**/*.?([cm])jsx",b="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${o}`,`**/*.spec.${o}`,`**/*.test.${o}`,`**/*.bench.${o}`,`**/*.benchmark.${o}`],v=[`**/e2e/**/*.spec.${o}`,`**/e2e/**/*.test.${o}`,`**/cypress/**/*.spec.${o}`,`**/cypress/**/*.test.${o}`],M="**/*.cjs",Q="**/*.astro",W=["vi.mock"],Y=["@testing-library/react"],D=r(()=>{const e=[Q];return[{files:e,name:"jimmy.codes/astro",plugins:{astro:G,"jsx-a11y":l},languageOptions:{globals:{...d.node,Astro:!1,Fragment:!1},parser:V,sourceType:"module",parserOptions:{parser:a.parser,extraFileExtensions:[".astro"]}},processor:"astro/client-side-ts",rules:{...l.configs.recommended.rules,"astro/missing-client-only-directive-value":"error","astro/no-conflict-set-directives":"error","astro/no-deprecated-astro-canonicalurl":"error","astro/no-deprecated-astro-fetchcontent":"error","astro/no-deprecated-astro-resolve":"error","astro/no-deprecated-getentrybyslug":"error","astro/no-unused-define-vars-in-style":"error","astro/valid-compile":"error","astro/no-exports-from-components":"off"}},{files:e,...a.configs.disableTypeChecked,name:"jimmy.codes/astro/disable-type-checked"},{settings:{"import-x/core-modules":["astro:content"]},name:"jimmy.codes/astro/imports"}]},"astroConfig"),U=r(()=>[{name:"jimmy.codes/commonjs",files:[M],languageOptions:{globals:d.commonjs}}],"commonjsConfig"),K={...p.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"},Z={name:"jimmy.codes/imports/typescript",settings:{...p.configs.typescript.settings,"import-x/resolver":{...p.configs.typescript.settings["import-x/resolver"],typescript:!0}},rules:p.configs.typescript.rules},ee=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":p,"simple-import-sort":A,"node-import":P},settings:{"import-x/parsers":{espree:[".js",".cjs",".mjs",".jsx"]}},languageOptions:{parserOptions:{ecmaVersion:"latest",sourceType:"module"}},rules:K},...e?[Z]:[]],"importsConfig"),re=r(()=>c.isPackageExists("typescript"),"hasTypescript"),te=r(()=>c.isPackageExists("react"),"hasReact"),k=r(()=>c.isPackageExists("vitest"),"hasVitest"),q=r(()=>c.isPackageExists("jest"),"hasJest"),se=r(()=>k()||q(),"hasTesting"),oe=r(()=>Y.some(e=>c.isPackageExists(e)),"hasTestingLibrary"),ne=r(()=>c.isPackageExists("@tanstack/react-query"),"hasReactQuery"),ae=r(()=>c.isPackageExists("astro"),"hasAstro"),ce={...l.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"},ie=r(({utilities:e=[]}={},s=!0)=>{const t=e.includes("@tanstack/query")||s&&ne();return[{name:"jimmy.codes/react",files:[g,b],plugins:{react:I,"react-hooks":$,"jsx-a11y":l,"react-refresh":X},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...d.browser}},settings:{react:{version:"detect"}},rules:ce},...t?[{name:"jimmy.codes/react/query",files:[g,b],plugins:{"@tanstack/query":B},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]:[]]},"reactConfig"),O={...f.configs["flat/recommended"].rules,...f.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"},pe=r(()=>[{name:"jimmy.codes/testing/testing-library",files:m,plugins:{"testing-library":x,"jest-dom":h},rules:{...x.configs.react.rules,...h.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:v,rules:{"testing-library/prefer-screen-queries":"off"}}],"testingLibraryConfig"),fe=r(({framework:e="vitest",utilities:s}={},t=!0)=>{const i=t?k():e==="vitest",n=e==="jest"||t&&q(),u=!!s?.includes("testing-library")||t&&oe();return[{name:"jimmy.codes/testing",files:m,...f.configs["flat/recommended"]},...i?[{name:"jimmy.codes/testing/vitest",files:m,...f.configs["flat/recommended"],rules:{...O,"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:W}]}}]:[],...n?[{name:"jimmy.codes/testing/jest",files:m,...f.configs["flat/recommended"],rules:O}]:[],{name:"jimmy.codes/testing/disabled",files:v,rules:{"jest/expect-expect":"off","jest/no-deprecated-functions":"off","jest/require-hook":"off"}},...u?pe():[]]},"testingConfig"),le=r(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}}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}],"@typescript-eslint/no-deprecated":"warn"}},{files:[H,g],...a.configs.disableTypeChecked}),"typescriptConfig"),me={...J.configs.recommended.rules,curly:["error","multi-or-nest","consistent"],"arrow-body-style":["error","always"],"object-shorthand":"error","no-useless-rename":"error","prefer-arrow-callback":"error","no-console":"warn"},ue=r(e=>typeof e=="object"?e:{project:"./tsconfig.json"},"getTypescriptOptions"),de=r(e=>typeof e=="object"?e:{framework:"vitest"},"getTestingOptions"),ye=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),ge=r(({typescript:e=!1,react:s=!1,testing:t=!1,astro:i=!1,autoDetect:n=!0,configs:u=[],ignores:_=[]}={},...E)=>{const j=e||n&&re(),w=s||n&&te(),T=t||n&&se(),C=i||n&&ae();return[{name:"jimmy.codes/base",rules:me},...ee({typescript:j}),...j?le(ue(e)):[],...w?ie(ye(s),n):[],...C?D():[],...T?fe(de(t),n):[],{name:"jimmy.codes/disabled",...R},...U(),{name:"jimmy.codes/ignores",ignores:[...z,..._]},...u,...E]},"jimmyDotCodes");module.exports=ge;
|