@djangocfg/eslint-config 2.1.610 → 2.1.612

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/next.js CHANGED
@@ -2,7 +2,7 @@ import js from "@eslint/js";
2
2
  import eslintConfigPrettier from "eslint-config-prettier";
3
3
  import tseslint from "typescript-eslint";
4
4
  import pluginReactHooks from "eslint-plugin-react-hooks";
5
- import pluginReact from "eslint-plugin-react";
5
+ import { reactRecommended } from "./react-plugin.js";
6
6
  import globals from "globals";
7
7
  import pluginNext from "@next/eslint-plugin-next";
8
8
  import { config as baseConfig } from "./base.js";
@@ -18,9 +18,9 @@ export const nextJsConfig = [
18
18
  eslintConfigPrettier,
19
19
  ...tseslint.configs.recommended,
20
20
  {
21
- ...pluginReact.configs.flat.recommended,
21
+ ...reactRecommended,
22
22
  languageOptions: {
23
- ...pluginReact.configs.flat.recommended.languageOptions,
23
+ ...reactRecommended.languageOptions,
24
24
  globals: {
25
25
  ...globals.serviceworker,
26
26
  },
@@ -41,7 +41,12 @@ export const nextJsConfig = [
41
41
  },
42
42
  settings: { react: { version: "detect" } },
43
43
  rules: {
44
- ...pluginReactHooks.configs.recommended.rules,
44
+ // Only the two classic rules. react-hooks 7's `recommended` also turns on
45
+ // the React Compiler rules (set-state-in-effect, refs, immutability...),
46
+ // which flag existing, working code as errors; adopting them is a
47
+ // separate cleanup, not part of the eslint 10 upgrade.
48
+ "react-hooks/rules-of-hooks": "error",
49
+ "react-hooks/exhaustive-deps": "warn",
45
50
  // React scope no longer necessary with new JSX transform.
46
51
  "react/react-in-jsx-scope": "off",
47
52
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/eslint-config",
3
- "version": "2.1.610",
3
+ "version": "2.1.612",
4
4
  "description": "Shared ESLint configurations for Next.js, React, and TypeScript projects with best practices and Prettier integration",
5
5
  "keywords": [
6
6
  "eslint",
@@ -40,16 +40,17 @@
40
40
  "LICENSE"
41
41
  ],
42
42
  "devDependencies": {
43
- "@eslint/js": "^9.39.5",
44
- "@next/eslint-plugin-next": "^15.5.20",
45
- "eslint": "^9.39.5",
43
+ "@eslint/compat": "^2.1.1",
44
+ "@eslint/js": "^10.0.1",
45
+ "@next/eslint-plugin-next": "^16.4.5",
46
+ "eslint": "^10.14.0",
46
47
  "eslint-config-prettier": "^10.1.8",
47
48
  "eslint-plugin-react": "^7.37.5",
48
- "eslint-plugin-react-hooks": "^5.2.0",
49
- "eslint-plugin-turbo": "^2.10.4",
50
- "globals": "^16.5.0",
49
+ "eslint-plugin-react-hooks": "^7.1.1",
50
+ "eslint-plugin-turbo": "^2.11.10",
51
+ "globals": "^17.14.0",
51
52
  "typescript": "^5.9.3",
52
- "typescript-eslint": "^8.63.0"
53
+ "typescript-eslint": "^8.72.1"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
package/react-internal.js CHANGED
@@ -2,7 +2,7 @@ import js from "@eslint/js";
2
2
  import eslintConfigPrettier from "eslint-config-prettier";
3
3
  import tseslint from "typescript-eslint";
4
4
  import pluginReactHooks from "eslint-plugin-react-hooks";
5
- import pluginReact from "eslint-plugin-react";
5
+ import { reactRecommended } from "./react-plugin.js";
6
6
  import globals from "globals";
7
7
  import { config as baseConfig } from "./base.js";
8
8
 
@@ -15,10 +15,10 @@ export const config = [
15
15
  js.configs.recommended,
16
16
  eslintConfigPrettier,
17
17
  ...tseslint.configs.recommended,
18
- pluginReact.configs.flat.recommended,
18
+ reactRecommended,
19
19
  {
20
20
  languageOptions: {
21
- ...pluginReact.configs.flat.recommended.languageOptions,
21
+ ...reactRecommended.languageOptions,
22
22
  globals: {
23
23
  ...globals.serviceworker,
24
24
  ...globals.browser,
@@ -31,7 +31,12 @@ export const config = [
31
31
  },
32
32
  settings: { react: { version: "detect" } },
33
33
  rules: {
34
- ...pluginReactHooks.configs.recommended.rules,
34
+ // Only the two classic rules. react-hooks 7's `recommended` also turns on
35
+ // the React Compiler rules (set-state-in-effect, refs, immutability...),
36
+ // which flag existing, working code as errors; adopting them is a
37
+ // separate cleanup, not part of the eslint 10 upgrade.
38
+ "react-hooks/rules-of-hooks": "error",
39
+ "react-hooks/exhaustive-deps": "warn",
35
40
  // React scope no longer necessary with new JSX transform.
36
41
  "react/react-in-jsx-scope": "off",
37
42
  // Same reasoning, for TypeScript: `react/prop-types` checks for a runtime
@@ -0,0 +1,17 @@
1
+ import { fixupPluginRules } from "@eslint/compat";
2
+ import pluginReact from "eslint-plugin-react";
3
+
4
+ /**
5
+ * eslint-plugin-react@7.37.5 (the latest release) still calls
6
+ * `context.getFilename()`, `getSourceCode()` etc., which ESLint 10 removed, so
7
+ * every `react/*` rule crashes with "contextOrFilename.getFilename is not a
8
+ * function". `fixupPluginRules` puts those context methods back. Drop the shim
9
+ * once eslint-plugin-react ships an ESLint 10 release (peer range is `^9.7`).
10
+ */
11
+ export const reactPlugin = fixupPluginRules(pluginReact);
12
+
13
+ /** `plugin:react/recommended` as a flat config entry using the patched plugin. */
14
+ export const reactRecommended = {
15
+ ...pluginReact.configs.flat.recommended,
16
+ plugins: { react: reactPlugin },
17
+ };