Skip to content

Conversation

@Afsoon
Copy link
Contributor

@Afsoon Afsoon commented Dec 5, 2025

Related to #4656

Implement no-mocks-import lint ruler adding a new entry in the mapping between jest and vitest compatible rules.

Oxlint-migrate PR related: oxc-project/oxlint-migrate#269

@Afsoon Afsoon requested a review from camc314 as a code owner December 5, 2025 12:28
@github-actions github-actions bot added A-linter Area - Linter C-enhancement Category - New feature or request labels Dec 5, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 5, 2025

CodSpeed Performance Report

Merging #16540 will not alter performance

Comparing Afsoon:12-05-vitest_no_mocks_import (3ad66ee) with main (5c62c16)

Summary

✅ 4 untouched
⏩ 41 skipped1

Footnotes

  1. 41 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.


/// List of Jest rules that have Vitest equivalents.
// When adding a new rule to this list, please ensure oxlint-migrate is also updated.
// See https://github.com/oxc-project/oxlint-migrate/blob/2c336c67d75adb09a402ae66fb3099f1dedbe516/scripts/constants.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

Should make sure to open a PR to oxlint-migrate if we end up merging this one

Copy link
Contributor

@connorshea connorshea left a comment

Choose a reason for hiding this comment

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

The docs block in the declare_oxc_lint! should be updated to mention that this rule is compatible with Vitest as well. (we should probably consider auto-generating something in the docs for these cases as well, honestly, but for now this is how it is done).

Other rules have a note like so:

    /// This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-alias-methods.md),
    /// to use it, add the following configuration to your `.oxlintrc.json`:
    ///
    /// ```json
    /// {
    ///   "rules": {
    ///      "vitest/no-alias-methods": "error"
    ///   }
    /// }
    /// ```

@Afsoon Afsoon changed the title feat(linter/eslint-plugin-vitest): reuse the jest linter rule feat(linter/eslint-plugin-vitest): reuse no-mocks-import jest linter rule Dec 7, 2025
@Afsoon
Copy link
Contributor Author

Afsoon commented Dec 7, 2025

@connorshea Added missing dock blocks and update the PR description to point the oxlint-migrate PR. I haven't opened before because I didn't know when to open it.

The docs block in the declare_oxc_lint! should be updated to mention that this rule is compatible with Vitest as well. (we should probably consider auto-generating something in the docs for these cases as well, honestly, but for now this is how it is done).

Other rules have a note like so:

    /// This rule is compatible with [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest/blob/v1.1.9/docs/rules/no-alias-methods.md),
    /// to use it, add the following configuration to your `.oxlintrc.json`:
    ///
    /// ```json
    /// {
    ///   "rules": {
    ///      "vitest/no-alias-methods": "error"
    ///   }
    /// }
    /// ```

Just FYI, some compatibles vitest rule are missing that doc block, for example jest/prefer_each. It's out of scope of this PR, but maybe can be a good idea to review which compatible rules don't have this dock block.

@connorshea
Copy link
Contributor

Just FYI, some compatibles vitest rule are missing that doc block, for example jest/prefer_each. It's out of scope of this PR, but maybe can be a good idea to review which compatible rules don't have this dock block.

Good point, if you want to open a PR for that change, I'd be happy to review/merge that :)

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

Labels

A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants