@jimmy.codes/eslint-config 5.5.0 → 5.6.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 +34 -0
- package/dist/{chunk-BJU7UEJ3.js → chunk-BDIXPIKB.js} +3 -3
- package/dist/index.d.ts +1334 -1642
- package/dist/index.js +6 -6
- package/dist/{nextjs-RCR4GYMK.js → nextjs-7V464KOE.js} +3 -5
- package/dist/react-7A5RCHOX.js +113 -0
- package/dist/{storybook-4KS3DD3C.js → storybook-IPSVKYYB.js} +3 -3
- package/package.json +3 -2
- package/dist/react-X5DWOH4Y.js +0 -189
package/dist/index.js
CHANGED
|
@@ -108,7 +108,7 @@ var importsTypescriptConfig = () => {
|
|
|
108
108
|
];
|
|
109
109
|
};
|
|
110
110
|
var importsConfig = ({
|
|
111
|
-
|
|
111
|
+
isTypescriptEnabled = false
|
|
112
112
|
} = {}) => {
|
|
113
113
|
return [
|
|
114
114
|
{
|
|
@@ -119,7 +119,7 @@ var importsConfig = ({
|
|
|
119
119
|
},
|
|
120
120
|
rules: importsRules
|
|
121
121
|
},
|
|
122
|
-
...
|
|
122
|
+
...isTypescriptEnabled ? importsTypescriptConfig() : []
|
|
123
123
|
];
|
|
124
124
|
};
|
|
125
125
|
|
|
@@ -577,20 +577,20 @@ var defineConfig = async ({
|
|
|
577
577
|
eslintCommentsConfig(),
|
|
578
578
|
regexpConfig(),
|
|
579
579
|
jsdocConfig(),
|
|
580
|
-
importsConfig({
|
|
580
|
+
importsConfig({ isTypescriptEnabled }),
|
|
581
581
|
stylisticConfig()
|
|
582
582
|
];
|
|
583
583
|
const featureConfigs = await Promise.all([
|
|
584
584
|
isTypescriptEnabled && unwrap(import("./typescript-IBCLQD7Q.js")),
|
|
585
|
-
isReactEnabled && unwrap(import("./react-
|
|
585
|
+
isReactEnabled && unwrap(import("./react-7A5RCHOX.js")),
|
|
586
586
|
isTanstackQueryEnabled && unwrap(import("./tanstack-query-P4IBOLDK.js")),
|
|
587
587
|
isAstroEnabled && unwrap(import("./astro-Z5RFF624.js")),
|
|
588
588
|
isJestEnabled && unwrap(import("./jest-AHG2WRSU.js")),
|
|
589
589
|
isVitestEnabled && unwrap(import("./vitest-YI6KNRZE.js")),
|
|
590
590
|
isTestingLibraryEnabled && unwrap(import("./testing-library-7RTMAEOX.js")),
|
|
591
591
|
isPlaywrightEnabled && unwrap(import("./playwright-U4PCWDYV.js")),
|
|
592
|
-
isStorybookEnabled && unwrap(import("./storybook-
|
|
593
|
-
isNextjsEnabled && unwrap(import("./nextjs-
|
|
592
|
+
isStorybookEnabled && unwrap(import("./storybook-IPSVKYYB.js")),
|
|
593
|
+
isNextjsEnabled && unwrap(import("./nextjs-7V464KOE.js"))
|
|
594
594
|
]);
|
|
595
595
|
return [
|
|
596
596
|
...baseConfigs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
upwarn
|
|
3
|
+
} from "./chunk-BDIXPIKB.js";
|
|
4
4
|
import {
|
|
5
5
|
interopDefault
|
|
6
6
|
} from "./chunk-72FT76PY.js";
|
|
@@ -11,9 +11,7 @@ import {
|
|
|
11
11
|
// src/rules/nextjs.ts
|
|
12
12
|
var nextjsRules = async () => {
|
|
13
13
|
const nextjsPlugin = await interopDefault(import("@next/eslint-plugin-next"));
|
|
14
|
-
return
|
|
15
|
-
nextjsPlugin.configs.recommended.rules
|
|
16
|
-
);
|
|
14
|
+
return upwarn(nextjsPlugin.configs.recommended.rules);
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
// src/configs/nextjs.ts
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
upwarn
|
|
3
|
+
} from "./chunk-BDIXPIKB.js";
|
|
4
|
+
import {
|
|
5
|
+
hasNext,
|
|
6
|
+
hasTypescript,
|
|
7
|
+
hasVite
|
|
8
|
+
} from "./chunk-OCS4JNPP.js";
|
|
9
|
+
import {
|
|
10
|
+
interopDefault
|
|
11
|
+
} from "./chunk-72FT76PY.js";
|
|
12
|
+
import {
|
|
13
|
+
GLOB_JSX,
|
|
14
|
+
GLOB_TSX
|
|
15
|
+
} from "./chunk-N5KZEOXT.js";
|
|
16
|
+
|
|
17
|
+
// src/configs/react.ts
|
|
18
|
+
import globals from "globals";
|
|
19
|
+
|
|
20
|
+
// src/rules/react.ts
|
|
21
|
+
var nextAllowedExportNames = [
|
|
22
|
+
"dynamic",
|
|
23
|
+
"dynamicParams",
|
|
24
|
+
"revalidate",
|
|
25
|
+
"fetchCache",
|
|
26
|
+
"runtime",
|
|
27
|
+
"preferredRegion",
|
|
28
|
+
"maxDuration",
|
|
29
|
+
"config",
|
|
30
|
+
"generateStaticParams",
|
|
31
|
+
"metadata",
|
|
32
|
+
"generateMetadata",
|
|
33
|
+
"viewport",
|
|
34
|
+
"generateViewport"
|
|
35
|
+
];
|
|
36
|
+
var reactRules = async () => {
|
|
37
|
+
const [{ configs: reactConfigs }, jsxA11yPlugin] = await Promise.all([
|
|
38
|
+
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
39
|
+
interopDefault(import("eslint-plugin-jsx-a11y"))
|
|
40
|
+
]);
|
|
41
|
+
const isUsingNextjs = hasNext();
|
|
42
|
+
const isUsingVite = hasVite();
|
|
43
|
+
const isUsingTypesScript = hasTypescript();
|
|
44
|
+
const reactPluginRules = isUsingTypesScript ? reactConfigs["recommended-type-checked"].rules : reactConfigs.recommended.rules;
|
|
45
|
+
return {
|
|
46
|
+
...jsxA11yPlugin.configs.recommended.rules,
|
|
47
|
+
...upwarn(reactPluginRules),
|
|
48
|
+
"react-compiler/react-compiler": "error",
|
|
49
|
+
"react-hooks/exhaustive-deps": "error",
|
|
50
|
+
"react-hooks/rules-of-hooks": "error",
|
|
51
|
+
"react-refresh/only-export-components": [
|
|
52
|
+
"warn",
|
|
53
|
+
{
|
|
54
|
+
allowConstantExport: isUsingVite,
|
|
55
|
+
allowExportNames: isUsingNextjs ? nextAllowedExportNames : []
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// src/configs/react.ts
|
|
62
|
+
async function reactConfig() {
|
|
63
|
+
const [
|
|
64
|
+
reactPlugin,
|
|
65
|
+
jsxA11yPlugin,
|
|
66
|
+
reactHooksPlugin,
|
|
67
|
+
reactRefreshPlugin,
|
|
68
|
+
reactCompilerPlugin
|
|
69
|
+
] = await Promise.all([
|
|
70
|
+
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
71
|
+
interopDefault(import("eslint-plugin-jsx-a11y")),
|
|
72
|
+
import("eslint-plugin-react-hooks"),
|
|
73
|
+
interopDefault(import("eslint-plugin-react-refresh")),
|
|
74
|
+
import("eslint-plugin-react-compiler")
|
|
75
|
+
]);
|
|
76
|
+
const reactPlugins = reactPlugin.configs.all.plugins;
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
80
|
+
languageOptions: {
|
|
81
|
+
globals: {
|
|
82
|
+
...globals.browser
|
|
83
|
+
},
|
|
84
|
+
parserOptions: {
|
|
85
|
+
ecmaFeatures: {
|
|
86
|
+
jsx: true
|
|
87
|
+
},
|
|
88
|
+
jsxPragma: null
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
name: "jimmy.codes/react",
|
|
92
|
+
plugins: {
|
|
93
|
+
"@eslint-react": reactPlugins["@eslint-react"],
|
|
94
|
+
"@eslint-react/dom": reactPlugins["@eslint-react/dom"],
|
|
95
|
+
"@eslint-react/hooks-extra": reactPlugins["@eslint-react/hooks-extra"],
|
|
96
|
+
"@eslint-react/web-api": reactPlugins["@eslint-react/web-api"],
|
|
97
|
+
"jsx-a11y": jsxA11yPlugin,
|
|
98
|
+
"react-compiler": reactCompilerPlugin,
|
|
99
|
+
"react-hooks": reactHooksPlugin,
|
|
100
|
+
"react-refresh": reactRefreshPlugin
|
|
101
|
+
},
|
|
102
|
+
rules: await reactRules(),
|
|
103
|
+
settings: {
|
|
104
|
+
react: {
|
|
105
|
+
version: "detect"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
reactConfig as default
|
|
113
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
upwarn
|
|
3
|
+
} from "./chunk-BDIXPIKB.js";
|
|
4
4
|
import {
|
|
5
5
|
interopDefault
|
|
6
6
|
} from "./chunk-72FT76PY.js";
|
|
@@ -18,7 +18,7 @@ async function storybookConfig() {
|
|
|
18
18
|
files: storiesConfig?.files,
|
|
19
19
|
name: "jimmy.codes/storybook/stories-rules",
|
|
20
20
|
rules: {
|
|
21
|
-
...
|
|
21
|
+
...upwarn(storiesConfig?.rules),
|
|
22
22
|
"import-x/no-anonymous-default-export": "off",
|
|
23
23
|
"unicorn/no-anonymous-default-export": "off"
|
|
24
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jimmy.codes/eslint-config",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "A pragmatic and opinionated ESLint config for modern development.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
27
|
+
"@eslint-react/eslint-plugin": "^1.37.3",
|
|
28
|
+
"@eslint-react/shared": "^1.37.3",
|
|
27
29
|
"@eslint/js": "^9.22.0",
|
|
28
30
|
"@next/eslint-plugin-next": "^15.2.3",
|
|
29
31
|
"@stylistic/eslint-plugin": "^4.2.0",
|
|
@@ -44,7 +46,6 @@
|
|
|
44
46
|
"eslint-plugin-n": "^17.16.2",
|
|
45
47
|
"eslint-plugin-perfectionist": "^4.10.1",
|
|
46
48
|
"eslint-plugin-playwright": "^2.2.0",
|
|
47
|
-
"eslint-plugin-react": "^7.37.4",
|
|
48
49
|
"eslint-plugin-react-compiler": "19.0.0-beta-3229e95-20250315",
|
|
49
50
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
50
51
|
"eslint-plugin-react-refresh": "0.4.19",
|
package/dist/react-X5DWOH4Y.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
hasNext,
|
|
3
|
-
hasVite
|
|
4
|
-
} from "./chunk-OCS4JNPP.js";
|
|
5
|
-
import {
|
|
6
|
-
interopDefault
|
|
7
|
-
} from "./chunk-72FT76PY.js";
|
|
8
|
-
import {
|
|
9
|
-
GLOB_JSX,
|
|
10
|
-
GLOB_TSX
|
|
11
|
-
} from "./chunk-N5KZEOXT.js";
|
|
12
|
-
|
|
13
|
-
// src/configs/react.ts
|
|
14
|
-
import globals from "globals";
|
|
15
|
-
|
|
16
|
-
// src/utils/normalize-rule-entries.ts
|
|
17
|
-
var toStringSeverity = (option) => {
|
|
18
|
-
return option === 2 ? "error" : option === 1 ? "warn" : "off";
|
|
19
|
-
};
|
|
20
|
-
var normalizeRuleEntries = (rules = {}) => {
|
|
21
|
-
return Object.fromEntries(
|
|
22
|
-
Object.entries(rules).map(([rule, option]) => {
|
|
23
|
-
return [
|
|
24
|
-
rule,
|
|
25
|
-
typeof option === "number" ? toStringSeverity(option) : option
|
|
26
|
-
];
|
|
27
|
-
})
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// src/rules/react.ts
|
|
32
|
-
var nextAllowedExportNames = [
|
|
33
|
-
"dynamic",
|
|
34
|
-
"dynamicParams",
|
|
35
|
-
"revalidate",
|
|
36
|
-
"fetchCache",
|
|
37
|
-
"runtime",
|
|
38
|
-
"preferredRegion",
|
|
39
|
-
"maxDuration",
|
|
40
|
-
"config",
|
|
41
|
-
"generateStaticParams",
|
|
42
|
-
"metadata",
|
|
43
|
-
"generateMetadata",
|
|
44
|
-
"viewport",
|
|
45
|
-
"generateViewport"
|
|
46
|
-
];
|
|
47
|
-
var reactRules = async () => {
|
|
48
|
-
const [reactPlugin, jsxA11yPlugin] = await Promise.all([
|
|
49
|
-
interopDefault(import("eslint-plugin-react")),
|
|
50
|
-
interopDefault(import("eslint-plugin-jsx-a11y"))
|
|
51
|
-
]);
|
|
52
|
-
const isUsingNextjs = hasNext();
|
|
53
|
-
const isUsingVite = hasVite();
|
|
54
|
-
return {
|
|
55
|
-
...jsxA11yPlugin.configs.recommended.rules,
|
|
56
|
-
...normalizeRuleEntries(reactPlugin.configs.flat.recommended?.rules),
|
|
57
|
-
...normalizeRuleEntries(reactPlugin.configs.flat["jsx-runtime"]?.rules),
|
|
58
|
-
"react-compiler/react-compiler": "error",
|
|
59
|
-
"react-hooks/exhaustive-deps": "error",
|
|
60
|
-
"react-hooks/rules-of-hooks": "error",
|
|
61
|
-
"react-refresh/only-export-components": [
|
|
62
|
-
"warn",
|
|
63
|
-
{
|
|
64
|
-
allowConstantExport: isUsingVite,
|
|
65
|
-
allowExportNames: isUsingNextjs ? nextAllowedExportNames : []
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"react/boolean-prop-naming": "off",
|
|
69
|
-
// revisit
|
|
70
|
-
"react/button-has-type": "error",
|
|
71
|
-
"react/checked-requires-onchange-or-readonly": "error",
|
|
72
|
-
"react/default-props-match-prop-types": "error",
|
|
73
|
-
"react/destructuring-assignment": "off",
|
|
74
|
-
// revisit
|
|
75
|
-
"react/forbid-component-props": "off",
|
|
76
|
-
"react/forbid-dom-props": "off",
|
|
77
|
-
"react/forbid-elements": "off",
|
|
78
|
-
"react/forbid-foreign-prop-types": "off",
|
|
79
|
-
"react/forbid-prop-types": "off",
|
|
80
|
-
"react/forward-ref-uses-ref": "error",
|
|
81
|
-
"react/function-component-definition": "off",
|
|
82
|
-
// revisit
|
|
83
|
-
"react/hook-use-state": "error",
|
|
84
|
-
"react/iframe-missing-sandbox": "error",
|
|
85
|
-
"react/jsx-boolean-value": ["error", "never"],
|
|
86
|
-
"react/jsx-curly-brace-presence": "error",
|
|
87
|
-
"react/jsx-filename-extension": "off",
|
|
88
|
-
"react/jsx-fragments": ["error", "syntax"],
|
|
89
|
-
"react/jsx-handler-names": "off",
|
|
90
|
-
"react/jsx-max-depth": "off",
|
|
91
|
-
"react/jsx-no-bind": "off",
|
|
92
|
-
// revisit
|
|
93
|
-
"react/jsx-no-constructed-context-values": "error",
|
|
94
|
-
"react/jsx-no-leaked-render": "error",
|
|
95
|
-
"react/jsx-no-literals": "off",
|
|
96
|
-
"react/jsx-no-script-url": "error",
|
|
97
|
-
"react/jsx-no-useless-fragment": "error",
|
|
98
|
-
"react/jsx-one-expression-per-line": "off",
|
|
99
|
-
"react/jsx-pascal-case": ["error", { allowNamespace: true }],
|
|
100
|
-
"react/jsx-props-no-spread-multi": "off",
|
|
101
|
-
"react/jsx-props-no-spreading": "off",
|
|
102
|
-
"react/jsx-sort-default-props": "off",
|
|
103
|
-
"react/jsx-sort-props": "off",
|
|
104
|
-
"react/no-access-state-in-setstate": "error",
|
|
105
|
-
"react/no-adjacent-inline-elements": "off",
|
|
106
|
-
"react/no-array-index-key": "off",
|
|
107
|
-
"react/no-arrow-function-lifecycle": "error",
|
|
108
|
-
"react/no-danger": "off",
|
|
109
|
-
"react/no-did-mount-set-state": "error",
|
|
110
|
-
"react/no-did-update-set-state": "error",
|
|
111
|
-
"react/no-invalid-html-attribute": "error",
|
|
112
|
-
"react/no-multi-comp": "off",
|
|
113
|
-
"react/no-namespace": "error",
|
|
114
|
-
"react/no-object-type-as-default-prop": "error",
|
|
115
|
-
"react/no-redundant-should-component-update": "error",
|
|
116
|
-
"react/no-set-state": "off",
|
|
117
|
-
"react/no-this-in-sfc": "error",
|
|
118
|
-
"react/no-typos": "error",
|
|
119
|
-
"react/no-unstable-nested-components": "error",
|
|
120
|
-
"react/no-unused-class-component-methods": "error",
|
|
121
|
-
"react/no-unused-prop-types": "error",
|
|
122
|
-
"react/no-unused-state": "error",
|
|
123
|
-
"react/no-will-update-set-state": "error",
|
|
124
|
-
"react/prefer-es6-class": "off",
|
|
125
|
-
"react/prefer-exact-props": "off",
|
|
126
|
-
"react/prefer-read-only-props": "off",
|
|
127
|
-
"react/prefer-stateless-function": "off",
|
|
128
|
-
"react/require-default-props": "off",
|
|
129
|
-
"react/require-optimization": "off",
|
|
130
|
-
"react/self-closing-comp": "error",
|
|
131
|
-
"react/sort-comp": "off",
|
|
132
|
-
"react/sort-default-props": "off",
|
|
133
|
-
"react/sort-prop-types": "off",
|
|
134
|
-
"react/state-in-constructor": "off",
|
|
135
|
-
"react/static-property-placement": "off",
|
|
136
|
-
"react/style-prop-object": "error",
|
|
137
|
-
"react/void-dom-elements-no-children": "error"
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// src/configs/react.ts
|
|
142
|
-
async function reactConfig() {
|
|
143
|
-
const [
|
|
144
|
-
reactPlugin,
|
|
145
|
-
jsxA11yPlugin,
|
|
146
|
-
reactHooksPlugin,
|
|
147
|
-
reactRefreshPlugin,
|
|
148
|
-
reactCompilerPlugin
|
|
149
|
-
] = await Promise.all([
|
|
150
|
-
interopDefault(import("eslint-plugin-react")),
|
|
151
|
-
interopDefault(import("eslint-plugin-jsx-a11y")),
|
|
152
|
-
import("eslint-plugin-react-hooks"),
|
|
153
|
-
interopDefault(import("eslint-plugin-react-refresh")),
|
|
154
|
-
import("eslint-plugin-react-compiler")
|
|
155
|
-
]);
|
|
156
|
-
return [
|
|
157
|
-
{
|
|
158
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
159
|
-
languageOptions: {
|
|
160
|
-
globals: {
|
|
161
|
-
...globals.browser
|
|
162
|
-
},
|
|
163
|
-
parserOptions: {
|
|
164
|
-
ecmaFeatures: {
|
|
165
|
-
jsx: true
|
|
166
|
-
},
|
|
167
|
-
jsxPragma: null
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
name: "jimmy.codes/react",
|
|
171
|
-
plugins: {
|
|
172
|
-
"jsx-a11y": jsxA11yPlugin,
|
|
173
|
-
"react": reactPlugin,
|
|
174
|
-
"react-compiler": reactCompilerPlugin,
|
|
175
|
-
"react-hooks": reactHooksPlugin,
|
|
176
|
-
"react-refresh": reactRefreshPlugin
|
|
177
|
-
},
|
|
178
|
-
rules: await reactRules(),
|
|
179
|
-
settings: {
|
|
180
|
-
react: {
|
|
181
|
-
version: "detect"
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
export {
|
|
188
|
-
reactConfig as default
|
|
189
|
-
};
|