@open-xchange/linter-presets 1.14.1 → 1.15.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.15.0` – 2025-Oct-24
4
+
5
+ - removed: (ESLint) plugin `eslint-plugin-react-hooks-static-deps`
6
+ - removed: (ESLint) options `additionalHooks` and `staticHooks` in `env.react`
7
+ - added: (ESLint) reactivated rule `react-hooks/exhaustive-deps` in `env.react`
8
+
3
9
  ## `1.14.1` – 2025-Oct-23
4
10
 
5
11
  - chore: bump dependencies
@@ -9,34 +9,6 @@ export interface EnvReactOptions extends EnvBaseOptions {
9
9
  * Additional hooks that will be treated as effect hooks, like "useEffect".
10
10
  */
11
11
  effectHooks?: readonly string[];
12
- /**
13
- * Configuration for the rule "react-hooks-static-deps/exhaustive-deps".
14
- *
15
- * Additional hooks that will be checked for dependencies, as a dictionary
16
- * mapping hook names to the parameter index of the callback function to be
17
- * analyzed.
18
- *
19
- * @example
20
- * additionalHooks: {
21
- * useCustomHook: 0, // usage: `useCustomHook(callback, [deps])`
22
- * useOtherHook: 1, // usage: `useOtherHook(value, callback, [deps])`
23
- * }
24
- */
25
- additionalHooks?: Record<string, number>;
26
- /**
27
- * Configuration for the rule "react-hooks-static-deps/exhaustive-deps".
28
- *
29
- * Additional hooks that return stable values, as a dictionary mapping hook
30
- * names to the declaration of the stable values the hook will return.
31
- *
32
- * @example
33
- * staticHooks: {
34
- * useCustomHook: true, // entire return value is stable
35
- * useOtherHook: [false, true], // second array element is stable
36
- * useThirdHook: { callback: true }, // property "callback" is stable
37
- * }
38
- */
39
- staticHooks?: Record<string, boolean | boolean[] | Record<string, boolean>>;
40
12
  }
41
13
  /**
42
14
  * Creates configuration objects with linter rules for ReactJS.
@@ -44,7 +16,6 @@ export interface EnvReactOptions extends EnvBaseOptions {
44
16
  * Wraps the following packages:
45
17
  * - `@eslint-react/eslint-plugin`
46
18
  * - `eslint-plugin-react-hooks`
47
- * - `eslint-plugin-react-hooks-static-deps`
48
19
  * - `eslint-plugin-react-refresh`
49
20
  * - `eslint-plugin-jsx-a11y`
50
21
  *
@@ -1,9 +1,7 @@
1
1
  import reactPlugin from "@eslint-react/eslint-plugin";
2
2
  import reactHooksPluginModule from "eslint-plugin-react-hooks";
3
- import reactHooksStaticDepsPlugin from "eslint-plugin-react-hooks-static-deps";
4
3
  import reactRefreshPlugin from "eslint-plugin-react-refresh";
5
4
  import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
6
- import { fixupPluginRules } from "@eslint/compat";
7
5
  import { parser } from "typescript-eslint";
8
6
  import { createConfig, customRules, convertRuleWarningsToErrors } from "../shared/env-utils.js";
9
7
  // workaround for broken typings
@@ -15,7 +13,6 @@ const reactHooksPlugin = reactHooksPluginModule;
15
13
  * Wraps the following packages:
16
14
  * - `@eslint-react/eslint-plugin`
17
15
  * - `eslint-plugin-react-hooks`
18
- * - `eslint-plugin-react-hooks-static-deps`
19
16
  * - `eslint-plugin-react-refresh`
20
17
  * - `eslint-plugin-jsx-a11y`
21
18
  *
@@ -63,19 +60,6 @@ export default function react(envOptions) {
63
60
  }),
64
61
  // "react-hooks" plugin and recommended rules, raise all recommended rules to "error" level
65
62
  createConfig("env.react.react-hooks", envOptions, convertRuleWarningsToErrors(reactHooksPlugin.configs.flat.recommended)),
66
- // "react-hooks-static-deps" plugin
67
- (envOptions.additionalHooks ?? envOptions.staticHooks) && createConfig("env.react.static-deps", envOptions, {
68
- plugins: {
69
- "react-hooks-static-deps": fixupPluginRules(reactHooksStaticDepsPlugin), // https://github.com/stoikio/eslint-plugin-react-hooks-static-deps/issues/1
70
- },
71
- rules: {
72
- "react-hooks/exhaustive-deps": "off",
73
- "react-hooks-static-deps/exhaustive-deps": ["error", {
74
- additionalHooks: envOptions.additionalHooks,
75
- staticHooks: envOptions.staticHooks,
76
- }],
77
- },
78
- }),
79
63
  // "react-refresh" plugin
80
64
  createConfig("env.react.react-refresh", envOptions, reactRefreshPlugin.configs.vite),
81
65
  // "jsx-a11y" plugin
@@ -4,7 +4,6 @@ Creates configuration objects with linter rules for ReactJS. Adds the following
4
4
 
5
5
  - [@eslint-react/eslint-plugin](https://eslint-react.xyz/)
6
6
  - [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks)
7
- - [eslint-plugin-react-hooks-static-deps](https://github.com/stoikio/eslint-plugin-react-hooks-static-deps)
8
7
  - [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh)
9
8
  - [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
10
9
 
@@ -23,8 +22,6 @@ function react(options: EnvReactOptions): Linter.Config[];
23
22
  | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
24
23
  | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
25
24
  | `effectHooks` | `string[]` | `[]` | Additional hooks that will be treated as effect hooks, like "useEffect". |
26
- | `additionalHooks` | `Record<string,number>` | `{}` | Additional hooks that will be checked for dependencies. |
27
- | `staticHooks` | `Record<string,boolean\|boolean[]\|Record<string,boolean>>` | `{}` | Additional hooks that return stable values. |
28
25
 
29
26
  ## Example
30
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/linter-presets",
3
- "version": "1.14.1",
3
+ "version": "1.15.0",
4
4
  "description": "Configuration presets for ESLint and StyleLint",
5
5
  "repository": {
6
6
  "type": "git",
@@ -62,7 +62,6 @@
62
62
  "eslint-plugin-no-unsanitized": "^4.1.4",
63
63
  "eslint-plugin-promise": "^7.2.1",
64
64
  "eslint-plugin-react-hooks": "^7.0.0",
65
- "eslint-plugin-react-hooks-static-deps": "^1.0.7",
66
65
  "eslint-plugin-react-refresh": "^0.4.24",
67
66
  "eslint-plugin-regexp": "^2.10.0",
68
67
  "eslint-plugin-testing-library": "^7.13.3",