@caspeco/eslint-config-react 5.4.2 → 5.5.0-beta.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
@@ -72,8 +72,7 @@ This configuration includes everything from our TypeScript config plus React-spe
72
72
 
73
73
  This package requires the following peer dependencies (automatically installed by npm 7+):
74
74
 
75
- - `eslint`
76
- - `eslint-plugin-react`
75
+ - `eslint` (9 or 10)
77
76
  - `eslint-plugin-react-hooks`
78
77
  - `eslint-plugin-react-refresh`
79
78
  - `globals`
@@ -82,6 +81,16 @@ See [package.json](./package.json) for specific version requirements.
82
81
 
83
82
  **Note:** Additional TypeScript-related peer dependencies are inherited from `@caspeco/eslint-config-ts` (installed automatically as a regular dependency).
84
83
 
84
+ `eslint-plugin-react` is a regular dependency, not a peer. It has no release that supports ESLint 10 yet, so this package patches it with `fixupRule` from `@eslint/compat`.
85
+
86
+ ### ESLint 10
87
+
88
+ - Remove `eslint-plugin-react` from your own `package.json`, or npm fails with `ERESOLVE`.
89
+ - npm prints `npm warn ERESOLVE overriding peer dependency` for `eslint-plugin-react`. The install succeeds and linting works.
90
+ - Installs with strict peer dependencies (e.g. pnpm `strict-peer-dependencies`) fail until `eslint-plugin-react` supports ESLint 10.
91
+ - Use `@eslint/js` 10 with ESLint 10. Its `recommended` adds `no-useless-assignment`, `no-unassigned-vars` and `preserve-caught-error`.
92
+ - On ESLint 9, keep `@eslint/js` on `^9`. A fresh install without a lockfile otherwise picks `@eslint/js` 10.
93
+
85
94
  ## Plugins
86
95
 
87
96
  ### eslint-plugin-react
@@ -1 +1 @@
1
- {"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../src/create-config.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,kDAHG;IAAqD,eAAe,EAA5D,OAAO,QAAQ,EAAE,MAAM,CAAC,WAAW;CAC3C,GAAU,OAAO,mBAAmB,EAAE,WAAW,CA4DnD"}
1
+ {"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../src/create-config.js"],"names":[],"mappings":"AAiBA;;;;;;;GAOG;AACH,kDAHG;IAAqD,eAAe,EAA5D,OAAO,QAAQ,EAAE,MAAM,CAAC,WAAW;CAC3C,GAAU,OAAO,mBAAmB,EAAE,WAAW,CA4DnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"caspeco-react.d.ts","sourceRoot":"","sources":["../../src/plugins/caspeco-react.js"],"names":[],"mappings":";mBACa,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU;AAD7C;;GAEG;AAEH;;GAEG;AACH,uBAFU;IAAE,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CAAE,CAqC1C"}
1
+ {"version":3,"file":"caspeco-react.d.ts","sourceRoot":"","sources":["../../src/plugins/caspeco-react.js"],"names":[],"mappings":";mBACa,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU;AAD7C;;GAEG;AAEH;;GAEG;AACH,uBAFU;IAAE,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CAAE,CAoC1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspeco/eslint-config-react",
3
- "version": "5.4.2",
3
+ "version": "5.5.0-beta.0",
4
4
  "description": "Caspeco ESLint configuration for React projects",
5
5
  "keywords": [
6
6
  "eslint",
@@ -45,24 +45,24 @@
45
45
  "build": "tsc --project tsconfig.build.json",
46
46
  "check:types": "attw --pack . --ignore-rules=cjs-resolves-to-esm --profile node16",
47
47
  "prepublishOnly": "npm run build",
48
- "test": "vitest"
48
+ "test": "vitest --config ../../vitest.config.ts"
49
49
  },
50
50
  "dependencies": {
51
- "@caspeco/eslint-config-ts": "5.4.2"
51
+ "@caspeco/eslint-config-ts": "5.5.0-beta.0",
52
+ "@eslint/compat": "^2.1.1",
53
+ "eslint-plugin-react": "^7.37.5"
52
54
  },
53
55
  "devDependencies": {
54
56
  "@caspeco/test-utils": "*",
55
- "eslint": "^9.39.4",
56
- "eslint-plugin-react": "^7.37.5",
57
+ "eslint": "^10.13.0",
57
58
  "eslint-plugin-react-hooks": "^7.1.1",
58
- "eslint-plugin-react-refresh": "^0.5.3",
59
- "globals": "^17.9.0"
59
+ "eslint-plugin-react-refresh": "^0.5.7",
60
+ "globals": "^17.13.0"
60
61
  },
61
62
  "peerDependencies": {
62
- "eslint": "^9.39.4",
63
- "eslint-plugin-react": "^7.37.5",
63
+ "eslint": "^9.39.4 || ^10.0.0",
64
64
  "eslint-plugin-react-hooks": "^7.0.1",
65
- "eslint-plugin-react-refresh": "^0.5.3",
65
+ "eslint-plugin-react-refresh": "^0.5.4",
66
66
  "globals": "^17.4.0"
67
67
  },
68
68
  "publishConfig": {
@@ -1,3 +1,4 @@
1
+ import { fixupRule } from "@eslint/compat";
1
2
  import tsConfig from "@caspeco/eslint-config-ts";
2
3
  import reactRefresh from "eslint-plugin-react-refresh";
3
4
  import reactPlugin from "eslint-plugin-react";
@@ -5,6 +6,15 @@ import reactHooksPlugin from "eslint-plugin-react-hooks";
5
6
  import caspecoReactPlugin from "./plugins/caspeco-react.js";
6
7
  import globals from "globals";
7
8
 
9
+ // eslint-plugin-react calls rule context and SourceCode methods that ESLint 10
10
+ // removed. Patched in place rather than with `fixupPluginRules`, which returns
11
+ // a copy: `configs.flat.recommended` registers the original object, and two
12
+ // different objects under "react" fail with `Cannot redefine plugin "react"`.
13
+ const reactRules = /** @type {Record<string, any>} */ (reactPlugin.rules);
14
+ for (const [name, rule] of Object.entries(reactRules)) {
15
+ reactRules[name] = fixupRule(rule);
16
+ }
17
+
8
18
  /**
9
19
  * Builds the Caspeco React flat config. The only part that varies between the
10
20
  * default and the React Compiler opt-in config is the set of `react-hooks` rules.
@@ -13,7 +13,6 @@ const caspeco = {
13
13
  docs: {
14
14
  description:
15
15
  'Discourage importing anything from "@chakra-ui/*". Use imports from "@caspeco/casper-ui-library" instead.',
16
- category: "Best Practices",
17
16
  url: "https://caspeco.github.io/eslint-config/#/plugins/caspeco?id=caspecodiscourage-chakra-import",
18
17
  recommended: false,
19
18
  },