@jimmy.codes/eslint-config 1.0.0 → 1.2.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 +17 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.mts +28 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -3
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:
|
|
@@ -24,7 +26,6 @@ Then if you want a simple configuration:
|
|
|
24
26
|
|
|
25
27
|
```js
|
|
26
28
|
// eslint.config.mjs
|
|
27
|
-
// @ts-check
|
|
28
29
|
import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
29
30
|
|
|
30
31
|
export default jimmyDotCodes();
|
|
@@ -44,8 +45,6 @@ And if you're using [VS Code](https://code.visualstudio.com), make sure to enabl
|
|
|
44
45
|
This package contains rules that can be enabled or disabled as follows:
|
|
45
46
|
|
|
46
47
|
```js
|
|
47
|
-
// eslint.config.mjs
|
|
48
|
-
// @ts-check
|
|
49
48
|
import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
50
49
|
|
|
51
50
|
export default jimmyDotCodes({
|
|
@@ -72,8 +71,6 @@ export default jimmyDotCodes({
|
|
|
72
71
|
You can also change the project location which can be helpful for monorepos:
|
|
73
72
|
|
|
74
73
|
```js
|
|
75
|
-
// eslint.config.mjs
|
|
76
|
-
// @ts-check
|
|
77
74
|
import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
78
75
|
|
|
79
76
|
export default jimmyDotCodes({
|
|
@@ -85,11 +82,9 @@ export default jimmyDotCodes({
|
|
|
85
82
|
|
|
86
83
|
#### Testing
|
|
87
84
|
|
|
88
|
-
By default [vitest](https://vitest.dev) is used as the testing framework but you can override and add
|
|
85
|
+
By default [vitest](https://vitest.dev) is used as the testing framework but you can override and add additional rules for utilities:
|
|
89
86
|
|
|
90
87
|
```js
|
|
91
|
-
// eslint.config.mjs
|
|
92
|
-
// @ts-check
|
|
93
88
|
import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
94
89
|
|
|
95
90
|
export default jimmyDotCodes({
|
|
@@ -100,13 +95,25 @@ export default jimmyDotCodes({
|
|
|
100
95
|
});
|
|
101
96
|
```
|
|
102
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
|
+
|
|
103
112
|
#### Overrides
|
|
104
113
|
|
|
105
114
|
You can also extend or override the configuration:
|
|
106
115
|
|
|
107
116
|
```js
|
|
108
|
-
// eslint.config.mjs
|
|
109
|
-
// @ts-check
|
|
110
117
|
import jimmyDotCodes from "@jimmy.codes/eslint-config";
|
|
111
118
|
|
|
112
119
|
export default jimmyDotCodes({
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var y=require("eslint-config-prettier"),s=require("eslint-plugin-import-x"),g=require("eslint-plugin-node-import"),x=require("eslint-plugin-simple-import-sort"),h=require("@tanstack/eslint-plugin-query"),f=require("eslint-plugin-jsx-a11y"),b=require("eslint-plugin-react"),v=require("eslint-plugin-react-hooks"),k=require("eslint-plugin-react-refresh"),q=require("globals"),c=require("eslint-plugin-jest"),_=require("eslint-plugin-jest-dom"),l=require("eslint-plugin-testing-library"),n=require("typescript-eslint"),O=require("@eslint/js");function i(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}var w=i(h),C=i(k),u=i(_);const E={...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"},L={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},R=({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":s,"simple-import-sort":x,"node-import":g},rules:E},...e?[L]:[]],o="?([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",p="**/*.?([cm])jsx",m="**/*.?([cm])tsx",d=[`**/__tests__/**/*.${o}`,`**/*.spec.${o}`,`**/*.test.${o}`,`**/*.bench.${o}`,`**/*.benchmark.${o}`],j=[`**/e2e/**/*.spec.${o}`,`**/e2e/**/*.test.${o}`],G={...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","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:[p,m],plugins:{react:b,"react-hooks":v,"jsx-a11y":{rules:f.rules},"react-refresh":C},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...q.browser}},settings:{react:{version:"detect"}},rules:G},...e.includes("@tanstack/query")?[{name:"jimmy.codes/react/query",files:[p,m],plugins:{"@tanstack/query":w},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]:[]],D={...c.configs["flat/recommended"].rules,...c.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"},$=()=>[{name:"jimmy.codes/testing/testing-library",files:d,plugins:{"testing-library":l,"jest-dom":u},rules:{...l.configs.react.rules,...u.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:j,rules:{"testing-library/prefer-screen-queries":"off"}}],I=({framework:e="vitest",utilities:r})=>[{name:"jimmy.codes/testing",files:d,...c.configs["flat/recommended"],rules:{...D,...e==="vitest"&&{"jest/no-deprecated-functions":"off"}}},{name:"jimmy.codes/testing/disabled",files:j,rules:{"jest/require-hook":"off"}},...r?.includes("testing-library")?$():[]],N=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:[T,p],...n.configs.disableTypeChecked}),P={...O.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"},z=e=>typeof e=="object"?e:{framework:"vitest"},A=e=>typeof e=="object"?e:{utilities:[]},H=({typescript:e=!1,react:r=!1,testing:t=!1,overrides:a=[]}={})=>[{name:"jimmy.codes/base",rules:P},...R({typescript:e}),...e?N(X(e)):[],...r?B(A(r)):[],...t?I(z(t)):[],{name:"jimmy.codes/disabled",...y},{ignores:S},...a];module.exports=H;
|
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
|
|
@@ -328,6 +337,7 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
|
|
|
328
337
|
rules: Record<string, eslint.Rule.RuleModule | ((context: eslint.Rule.RuleContext) => eslint.Rule.RuleListener)> | undefined;
|
|
329
338
|
};
|
|
330
339
|
"react-refresh": typeof eslint_plugin_react_refresh;
|
|
340
|
+
"@tanstack/query"?: undefined;
|
|
331
341
|
};
|
|
332
342
|
languageOptions: {
|
|
333
343
|
parserOptions: {
|
|
@@ -1515,6 +1525,23 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
|
|
|
1515
1525
|
"react/style-prop-object": "error";
|
|
1516
1526
|
"react/void-dom-elements-no-children": "error";
|
|
1517
1527
|
};
|
|
1528
|
+
} | {
|
|
1529
|
+
name: string;
|
|
1530
|
+
files: string[];
|
|
1531
|
+
plugins: {
|
|
1532
|
+
"@tanstack/query": typeof _tanstack_eslint_plugin_query;
|
|
1533
|
+
react?: undefined;
|
|
1534
|
+
"react-hooks"?: undefined;
|
|
1535
|
+
"jsx-a11y"?: undefined;
|
|
1536
|
+
"react-refresh"?: undefined;
|
|
1537
|
+
};
|
|
1538
|
+
rules: {
|
|
1539
|
+
"@tanstack/query/exhaustive-deps": string;
|
|
1540
|
+
"@tanstack/query/no-rest-destructuring": string;
|
|
1541
|
+
"@tanstack/query/stable-query-client": string;
|
|
1542
|
+
};
|
|
1543
|
+
languageOptions?: undefined;
|
|
1544
|
+
settings?: undefined;
|
|
1518
1545
|
} | {
|
|
1519
1546
|
name: string;
|
|
1520
1547
|
files: string[];
|
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
|
|
@@ -328,6 +337,7 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
|
|
|
328
337
|
rules: Record<string, eslint.Rule.RuleModule | ((context: eslint.Rule.RuleContext) => eslint.Rule.RuleListener)> | undefined;
|
|
329
338
|
};
|
|
330
339
|
"react-refresh": typeof eslint_plugin_react_refresh;
|
|
340
|
+
"@tanstack/query"?: undefined;
|
|
331
341
|
};
|
|
332
342
|
languageOptions: {
|
|
333
343
|
parserOptions: {
|
|
@@ -1515,6 +1525,23 @@ declare const jimmyDotCodes: ({ typescript, react, testing, overrides, }?: Optio
|
|
|
1515
1525
|
"react/style-prop-object": "error";
|
|
1516
1526
|
"react/void-dom-elements-no-children": "error";
|
|
1517
1527
|
};
|
|
1528
|
+
} | {
|
|
1529
|
+
name: string;
|
|
1530
|
+
files: string[];
|
|
1531
|
+
plugins: {
|
|
1532
|
+
"@tanstack/query": typeof _tanstack_eslint_plugin_query;
|
|
1533
|
+
react?: undefined;
|
|
1534
|
+
"react-hooks"?: undefined;
|
|
1535
|
+
"jsx-a11y"?: undefined;
|
|
1536
|
+
"react-refresh"?: undefined;
|
|
1537
|
+
};
|
|
1538
|
+
rules: {
|
|
1539
|
+
"@tanstack/query/exhaustive-deps": string;
|
|
1540
|
+
"@tanstack/query/no-rest-destructuring": string;
|
|
1541
|
+
"@tanstack/query/stable-query-client": string;
|
|
1542
|
+
};
|
|
1543
|
+
languageOptions?: undefined;
|
|
1544
|
+
settings?: undefined;
|
|
1518
1545
|
} | {
|
|
1519
1546
|
name: string;
|
|
1520
1547
|
files: string[];
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import j from"eslint-config-prettier";import t from"eslint-plugin-import-x";import y from"eslint-plugin-node-import";import g from"eslint-plugin-simple-import-sort";import*as x from"@tanstack/eslint-plugin-query";import i from"eslint-plugin-jsx-a11y";import h from"eslint-plugin-react";import b from"eslint-plugin-react-hooks";import*as k from"eslint-plugin-react-refresh";import v from"globals";import n from"eslint-plugin-jest";import*as p from"eslint-plugin-jest-dom";import f from"eslint-plugin-testing-library";import{config as w,configs as s}from"typescript-eslint";import q from"@eslint/js";const _={...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"},O={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":g,"node-import":y},rules:_},...e?[O]:[]],r="?([cm])[jt]s?(x)",L=["**/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"],S="**/*.?([cm])js",c="**/*.?([cm])jsx",m="**/*.?([cm])tsx",l=[`**/__tests__/**/*.${r}`,`**/*.spec.${r}`,`**/*.test.${r}`,`**/*.bench.${r}`,`**/*.benchmark.${r}`],d=[`**/e2e/**/*.spec.${r}`,`**/e2e/**/*.test.${r}`],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"},E=({utilities:e=[]}={})=>[{name:"jimmy.codes/react",files:[c,m],plugins:{react:h,"react-hooks":b,"jsx-a11y":{rules:i.rules},"react-refresh":k},languageOptions:{parserOptions:{jsxPragma:null,ecmaFeatures:{jsx:!0}},globals:{...v.browser}},settings:{react:{version:"detect"}},rules:T},...e.includes("@tanstack/query")?[{name:"jimmy.codes/react/query",files:[c,m],plugins:{"@tanstack/query":x},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"},R=()=>[{name:"jimmy.codes/testing/testing-library",files:l,plugins:{"testing-library":f,"jest-dom":p},rules:{...f.configs.react.rules,...p.configs["flat/recommended"].rules}},{name:"jimmy.codes/testing/testing-library/disabled",files:d,rules:{"testing-library/prefer-screen-queries":"off"}}],B=({framework:e="vitest",utilities:o})=>[{name:"jimmy.codes/testing",files:l,...n.configs["flat/recommended"],rules:{...G,...e==="vitest"&&{"jest/no-deprecated-functions":"off"}}},{name:"jimmy.codes/testing/disabled",files:d,rules:{"jest/require-hook":"off"}},...o?.includes("testing-library")?R():[]],$=e=>w(...s.strictTypeChecked,{name:"jimmy.codes/typescript",extends:[...s.strictTypeChecked,...s.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:[S,c],...s.disableTypeChecked}),I={...q.configs.recommended.rules,curly:"error","arrow-body-style":["error","always"],"object-shorthand":"error","prefer-arrow-callback":"error"},D=e=>typeof e=="object"?e:{project:"./tsconfig.json"},X=e=>typeof e=="object"?e:{framework:"vitest"},N=e=>typeof e=="object"?e:{utilities:[]},A=({typescript:e=!1,react:o=!1,testing:a=!1,overrides:u=[]}={})=>[{name:"jimmy.codes/base",rules:I},...C({typescript:e}),...e?$(D(e)):[],...o?E(N(o)):[],...a?B(X(a)):[],{name:"jimmy.codes/disabled",...j},{ignores:L},...u];export{A as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jimmy.codes/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "another opinionated eslint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@eslint/js": "^8.57.0",
|
|
35
|
-
"@
|
|
35
|
+
"@tanstack/eslint-plugin-query": "^5.28.11",
|
|
36
|
+
"@typescript-eslint/utils": "^7.6.0",
|
|
36
37
|
"eslint-config-prettier": "^9.1.0",
|
|
37
38
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
38
39
|
"eslint-plugin-import-x": "0.5.0",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
47
48
|
"eslint-plugin-testing-library": "^6.2.0",
|
|
48
49
|
"globals": "^15.0.0",
|
|
49
|
-
"typescript-eslint": "^7.
|
|
50
|
+
"typescript-eslint": "^7.6.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"eslint": "^8.57.0"
|