@jimmy.codes/eslint-config 5.4.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/dist/index.js CHANGED
@@ -108,7 +108,7 @@ var importsTypescriptConfig = () => {
108
108
  ];
109
109
  };
110
110
  var importsConfig = ({
111
- typescript = false
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
- ...typescript ? importsTypescriptConfig() : []
122
+ ...isTypescriptEnabled ? importsTypescriptConfig() : []
123
123
  ];
124
124
  };
125
125
 
@@ -432,6 +432,70 @@ var regexpConfig = () => {
432
432
  ];
433
433
  };
434
434
 
435
+ // src/configs/stylistic.ts
436
+ import stylisticPlugin from "@stylistic/eslint-plugin";
437
+
438
+ // src/rules/stylistic.ts
439
+ var stylisticRules = {
440
+ "@stylistic/object-curly-newline": [
441
+ "error",
442
+ {
443
+ consistent: true,
444
+ multiline: true
445
+ }
446
+ ],
447
+ "@stylistic/object-property-newline": [
448
+ "error",
449
+ { allowAllPropertiesOnSameLine: true }
450
+ ],
451
+ "@stylistic/padding-line-between-statements": [
452
+ "error",
453
+ {
454
+ blankLine: "always",
455
+ next: "return",
456
+ prev: "*"
457
+ },
458
+ {
459
+ blankLine: "always",
460
+ next: "*",
461
+ prev: ["const", "let", "var"]
462
+ },
463
+ {
464
+ blankLine: "any",
465
+ next: ["const", "let", "var"],
466
+ prev: ["const", "let", "var"]
467
+ },
468
+ {
469
+ blankLine: "always",
470
+ next: "*",
471
+ prev: "directive"
472
+ },
473
+ {
474
+ blankLine: "any",
475
+ next: "directive",
476
+ prev: "directive"
477
+ },
478
+ {
479
+ blankLine: "always",
480
+ next: "function",
481
+ prev: "*"
482
+ }
483
+ ]
484
+ };
485
+
486
+ // src/configs/stylistic.ts
487
+ function stylisticConfig() {
488
+ return [
489
+ {
490
+ name: "jimmy.codes/stylistic",
491
+ plugins: {
492
+ "@stylistic": stylisticPlugin
493
+ },
494
+ rules: stylisticRules
495
+ }
496
+ ];
497
+ }
498
+
435
499
  // src/configs/unicorn.ts
436
500
  import eslintPluginUnicorn2 from "eslint-plugin-unicorn";
437
501
 
@@ -513,19 +577,20 @@ var defineConfig = async ({
513
577
  eslintCommentsConfig(),
514
578
  regexpConfig(),
515
579
  jsdocConfig(),
516
- importsConfig({ typescript: isTypescriptEnabled })
580
+ importsConfig({ isTypescriptEnabled }),
581
+ stylisticConfig()
517
582
  ];
518
583
  const featureConfigs = await Promise.all([
519
584
  isTypescriptEnabled && unwrap(import("./typescript-IBCLQD7Q.js")),
520
- isReactEnabled && unwrap(import("./react-X5DWOH4Y.js")),
585
+ isReactEnabled && unwrap(import("./react-7A5RCHOX.js")),
521
586
  isTanstackQueryEnabled && unwrap(import("./tanstack-query-P4IBOLDK.js")),
522
587
  isAstroEnabled && unwrap(import("./astro-Z5RFF624.js")),
523
588
  isJestEnabled && unwrap(import("./jest-AHG2WRSU.js")),
524
589
  isVitestEnabled && unwrap(import("./vitest-YI6KNRZE.js")),
525
590
  isTestingLibraryEnabled && unwrap(import("./testing-library-7RTMAEOX.js")),
526
591
  isPlaywrightEnabled && unwrap(import("./playwright-U4PCWDYV.js")),
527
- isStorybookEnabled && unwrap(import("./storybook-4KS3DD3C.js")),
528
- isNextjsEnabled && unwrap(import("./nextjs-RCR4GYMK.js"))
592
+ isStorybookEnabled && unwrap(import("./storybook-IPSVKYYB.js")),
593
+ isNextjsEnabled && unwrap(import("./nextjs-7V464KOE.js"))
529
594
  ]);
530
595
  return [
531
596
  ...baseConfigs,
@@ -1,6 +1,6 @@
1
1
  import {
2
- warningAsErrors
3
- } from "./chunk-BJU7UEJ3.js";
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 warningAsErrors(
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
- warningAsErrors
3
- } from "./chunk-BJU7UEJ3.js";
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
- ...warningAsErrors(storiesConfig?.rules),
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.4.0",
3
+ "version": "5.6.0",
4
4
  "description": "A pragmatic and opinionated ESLint config for modern development.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -24,26 +24,28 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
27
- "@eslint/js": "^9.21.0",
28
- "@next/eslint-plugin-next": "^15.1.7",
27
+ "@eslint-react/eslint-plugin": "^1.37.3",
28
+ "@eslint-react/shared": "^1.37.3",
29
+ "@eslint/js": "^9.22.0",
30
+ "@next/eslint-plugin-next": "^15.2.3",
31
+ "@stylistic/eslint-plugin": "^4.2.0",
29
32
  "@tanstack/eslint-plugin-query": "^5.68.0",
30
33
  "@types/eslint": "9.6.1",
31
- "@typescript-eslint/parser": "^8.26.1",
32
- "@typescript-eslint/utils": "^8.26.1",
34
+ "@typescript-eslint/parser": "^8.27.0",
35
+ "@typescript-eslint/utils": "^8.27.0",
33
36
  "@vitest/eslint-plugin": "^1.1.38",
34
37
  "astro-eslint-parser": "^1.2.1",
35
38
  "eslint-config-prettier": "^10.1.1",
36
- "eslint-import-resolver-typescript": "^4.2.1",
39
+ "eslint-import-resolver-typescript": "^4.2.2",
37
40
  "eslint-plugin-astro": "^1.3.1",
38
- "eslint-plugin-import-x": "^4.8.1",
41
+ "eslint-plugin-import-x": "^4.9.1",
39
42
  "eslint-plugin-jest": "^28.11.0",
40
43
  "eslint-plugin-jest-dom": "^5.5.0",
41
44
  "eslint-plugin-jsdoc": "^50.6.8",
42
45
  "eslint-plugin-jsx-a11y": "^6.10.2",
43
46
  "eslint-plugin-n": "^17.16.2",
44
- "eslint-plugin-perfectionist": "^4.9.0",
47
+ "eslint-plugin-perfectionist": "^4.10.1",
45
48
  "eslint-plugin-playwright": "^2.2.0",
46
- "eslint-plugin-react": "^7.37.4",
47
49
  "eslint-plugin-react-compiler": "19.0.0-beta-3229e95-20250315",
48
50
  "eslint-plugin-react-hooks": "^5.2.0",
49
51
  "eslint-plugin-react-refresh": "0.4.19",
@@ -52,8 +54,8 @@
52
54
  "eslint-plugin-testing-library": "^7.1.1",
53
55
  "eslint-plugin-unicorn": "^57.0.0",
54
56
  "globals": "^16.0.0",
55
- "local-pkg": "^1.0.0",
56
- "typescript-eslint": "^8.26.1"
57
+ "local-pkg": "^1.1.1",
58
+ "typescript-eslint": "^8.27.0"
57
59
  },
58
60
  "peerDependencies": {
59
61
  "eslint": "^9.10.0"
@@ -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
- };