Skip to content

feat(eslint-plugin-jest): add no-duplicate-hooks rule#1026

Open
eryue0220 wants to merge 4 commits into
web-infra-dev:mainfrom
eryue0220:feat/no-duplicate-hooks
Open

feat(eslint-plugin-jest): add no-duplicate-hooks rule#1026
eryue0220 wants to merge 4 commits into
web-infra-dev:mainfrom
eryue0220:feat/no-duplicate-hooks

Conversation

@eryue0220
Copy link
Copy Markdown
Contributor

Summary

  • Port no-duplicate-hooks from eslint-plugin-jest to rslint.

Related Links

Tracking issue: #476
eslint-plugin-jest/no-duplicate-hooks doc code

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new lint rule jest/no-duplicate-hooks to disallow duplicate Jest lifecycle hooks within the same scope. It includes the rule implementation, documentation, Go unit tests, and TypeScript-based integration tests. However, the reviewer identified a critical issue in rstest.config.mts where the newly added test file was not registered, and an unrelated test file was added instead, which would prevent the integration tests from running.

'./tests/eslint-plugin-jest/rules/no-mocks-import.test.ts',
'./tests/eslint-plugin-jest/rules/no-standalone-expect.test.ts',
'./tests/eslint-plugin-jest/rules/no-test-prefixes.test.ts',
'./tests/eslint-plugin-jest/rules/prefer-called-with.test.ts',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In rstest.config.mts, the test file for the newly added no-duplicate-hooks rule (./tests/eslint-plugin-jest/rules/no-duplicate-hooks.test.ts) was not included. Instead, ./tests/eslint-plugin-jest/rules/prefer-called-with.test.ts was added, which seems to be a copy-paste error or an unrelated change. Please update this to include the correct test file so that the tests for no-duplicate-hooks are actually executed.

    './tests/eslint-plugin-jest/rules/no-duplicate-hooks.test.ts',

eryue0220 added 3 commits May 27, 2026 17:37
… into feat/no-duplicate-hooks

* 'feat/no-duplicate-hooks' of github.com:eryue0220/rslint:
  test(eslint-plugin-runner): skip worker-pool e2e suites on windows (napi terminate aborts) (web-infra-dev#1031)
  feat: port rule react/checked-requires-onchange-or-readonly (web-infra-dev#1030)
  chore(deps): update actions/checkout action to v6 (web-infra-dev#1007)
  chore(deps): update actions/setup-go action to v6 (web-infra-dev#1009)
  chore(deps): update actions/setup-node action to v6 (web-infra-dev#1010)
  feat: port rule @stylistic/jsx-indent-props (web-infra-dev#1028)
  feat(eslint-plugin-runner): new package for ESLint plugin compatibility runtime (web-infra-dev#991)
  feat: port rule @stylistic/jsx-function-call-newline (web-infra-dev#1027)
  feat(eslint-plugin-jest): add `prefer-called-with` rule (web-infra-dev#1025)
  feat: port rule @stylistic/jsx-first-prop-new-line (web-infra-dev#1024)
  feat: port rule @stylistic/jsx-curly-spacing (web-infra-dev#1023)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant