Skip to content

feat(eslint-config)!: enable recommended react-hooks rules from v6#424

Merged
wakamsha merged 2 commits intomainfrom
feat/eslint-config-react-hooks-v6-rules
Apr 17, 2026
Merged

feat(eslint-config)!: enable recommended react-hooks rules from v6#424
wakamsha merged 2 commits intomainfrom
feat/eslint-config-react-hooks-v6-rules

Conversation

@wakamsha
Copy link
Copy Markdown
Contributor

@wakamsha wakamsha commented Apr 17, 2026

What changed / motivation ?

Enable the new rule set shipped in eslint-plugin-react-hooks v6+ (the React Compiler era rules) as part of eslint-config-moneyforward. Previously only exhaustive-deps and rules-of-hooks were explicitly set to error; this change pulls in the plugin's full recommended preset so the shared config keeps up with current best practices.

Changes

  • packages/eslint-config/configs/flat/react.mjs
    • Spread reactHooks.configs.flat.recommended.rules to enable the new rules in the flat config
    • Switch languageOptions to reference react.configs.flat?.recommended.languageOptions so the flat-config JSX parser options are propagated correctly
  • packages/eslint-config/rules/react-hooks.js
    • Add extends: ['plugin:react-hooks/recommended'] for the eslintrc consumers
  • Snapshot tests updated to reflect the new rule activations

Newly activated rules

Error level (13 new rules)

  • react-hooks/component-hook-factories
  • react-hooks/config
  • react-hooks/error-boundaries
  • react-hooks/gating
  • react-hooks/globals
  • react-hooks/immutability
  • react-hooks/preserve-manual-memoization
  • react-hooks/purity
  • react-hooks/refs
  • react-hooks/set-state-in-effect
  • react-hooks/set-state-in-render
  • react-hooks/static-components
  • react-hooks/use-memo

Warn level (2 new rules)

  • react-hooks/incompatible-library
  • react-hooks/unsupported-syntax

Impact on consumers and mitigations

Downstream projects may see new lint errors on existing React code. Suggested paths:

  1. Review each reported issue and fix the code where feasible.
  2. For rules that are difficult to adopt immediately, override them in the project's ESLint config:
    // e.g. eslint.config.mjs
    export default [
      // ...
      {
        rules: {
          'react-hooks/purity': 'off',
        },
      },
    ];

Linked PR / Issues

N/A

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Chore (routine task, maintenance, or non-functional change that doesn't modify src or test files)

Versioning

Per the Versioning policy in the package README, changes that add error-level rules require a major bump (5.1.4 → 6.0.0). The commit message uses `feat(eslint-config)!` and a `BREAKING CHANGE:` footer so semantic-release will produce v6.0.0 automatically.

Pre-flight checklist

References

🤖 Generated with Claude Code

wakamsha and others added 2 commits April 17, 2026 17:20
Spread `reactHooks.configs.flat.recommended.rules` into the flat React
config and add `extends: ['plugin:react-hooks/recommended']` to the
eslintrc rule set. Switch the flat config's `languageOptions` to
`react.configs.flat?.recommended.languageOptions` so JSX parser options
are propagated correctly.

BREAKING CHANGE: 13 new error-level react-hooks rules are now enabled
by default (component-hook-factories, config, error-boundaries, gating,
globals, immutability, preserve-manual-memoization, purity, refs,
set-state-in-effect, set-state-in-render, static-components, use-memo),
plus 2 new warn-level rules (incompatible-library, unsupported-syntax).
Downstream consumers may see new lint errors on existing React code
and should either fix the violations or explicitly override these rules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wakamsha wakamsha merged commit 5308724 into main Apr 17, 2026
3 checks passed
@wakamsha wakamsha deleted the feat/eslint-config-react-hooks-v6-rules branch April 17, 2026 08:29
oss-frontend-github-app bot pushed a commit that referenced this pull request Apr 18, 2026
## [eslint-config-moneyforward-v6.0.0](5.1.4...6.0.0) (2026-04-18)

### ⚠ BREAKING CHANGES

* **eslint-config:** 13 new error-level react-hooks rules are now enabled
by default (component-hook-factories, config, error-boundaries, gating,
globals, immutability, preserve-manual-memoization, purity, refs,
set-state-in-effect, set-state-in-render, static-components, use-memo),
plus 2 new warn-level rules (incompatible-library, unsupported-syntax).
Downstream consumers may see new lint errors on existing React code
and should either fix the violations or explicitly override these rules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: fix ci

### Features

* **eslint-config:** enable recommended react-hooks rules from v6 ([#424](#424)) ([5308724](5308724))

### Bug Fixes

* **deps:** update dependency @next/eslint-plugin-next to v15.5.15 ([#441](#441)) ([65bd3d1](65bd3d1))
* **deps:** update dependency eslint-plugin-import to v2.32.0 ([#430](#430)) ([c638eb9](c638eb9))
* **deps:** update dependency eslint-plugin-jest to v29 ([#425](#425)) ([6e84da9](6e84da9))
* **deps:** update dependency eslint-plugin-jsdoc to v62 ([#426](#426)) ([bd6bbc2](bd6bbc2))
* **deps:** update dependency eslint-plugin-n to v17.24.0 ([#447](#447)) ([975af80](975af80))
* **deps:** update dependency eslint-plugin-react-hooks to v7.1.0 ([#443](#443)) ([789ee77](789ee77))
* **deps:** update dependency eslint-plugin-storybook to v10 ([#427](#427)) ([f75c9f6](f75c9f6))
* **deps:** update dependency eslint-plugin-storybook to v9.1.20 ([#445](#445)) ([c2378b1](c2378b1))
* **deps:** update dependency eslint-plugin-testing-library to v7.16.2 ([#446](#446)) ([148c9f3](148c9f3))
* **deps:** update dependency globals to v17 ([#429](#429)) ([83b3424](83b3424))
* **deps:** update typescript-eslint monorepo to v8.58.2 ([#448](#448)) ([de7dc10](de7dc10))
@oss-frontend-github-app
Copy link
Copy Markdown

🎉 This PR is included in version eslint-config-moneyforward-v6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant