Skip to content

fix(linter): Fix vitest/no-restricted-vi-methods not marked as implemented#16940

Merged
graphite-app[bot] merged 1 commit intomainfrom
copilot/fix-linter-rules-implementation
Dec 17, 2025
Merged

fix(linter): Fix vitest/no-restricted-vi-methods not marked as implemented#16940
graphite-app[bot] merged 1 commit intomainfrom
copilot/fix-linter-rules-implementation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 16, 2025

The vitest rule no-restricted-vi-methods is implemented via the jest rule no-restricted-jest-methods, but the different names prevented automatic status syncing in the rules table generation.

Changes

  • tasks/lint_rules/src/oxlint-rules.mjs: Added special case in syncVitestPluginStatusWithJestPluginStatus() to map vitest/no-restricted-vi-methods status from jest/no-restricted-jest-methods

Result

The rules table will correctly show vitest/no-restricted-vi-methods as implemented when the lint rules tracking task is run.

Original prompt

This section details on the original issue you should resolve

<issue_title>linter: rules table does not properly mark no-restricted-vi-methods as implemented</issue_title>
<issue_description>> Working in #16540 I have notice that vitest/no-restricted-vi-methods is implemented but the table show as not. As you can see

"no-restricted-jest-methods",

Probably is due a name mistmatch. For Vitest the linter is named no-restricted-vi-methods but in jest is no-restricted-jest-methods. Following you can see how the jest rule have test case for the vitest context:

let pass_vitest = vec![
("vi", None),
("vi()", None),
("vi.mock()", None),
("expect(a).rejects;", None),
("expect(a);", None),
(
"
import { vi } from 'vitest';
vi;
",
None,
), // { "parserOptions": { "sourceType": "module" } }
];
let fail_vitest = vec![
("vi.fn()", Some(serde_json::json!([{ "fn": null }]))),
("vi.mock()", Some(serde_json::json!([{ "mock": "Do not use mocks" }]))),
(
"
import { vi } from 'vitest';
vi.advanceTimersByTime();
",
Some(serde_json::json!([{ "advanceTimersByTime": null }])),
), // { "parserOptions": { "sourceType": "module" } },
(r#"vi["fn"]()"#, Some(serde_json::json!([{ "fn": null }]))),
];
pass.extend(pass_vitest);
fail.extend(fail_vitest);
Tester::new(NoRestrictedJestMethods::NAME, NoRestrictedJestMethods::PLUGIN, pass, fail)
.with_jest_plugin(true)
.with_vitest_plugin(true)

Originally posted by @Afsoon in #4656

We should fix this by adding a one-off logic change to the rule list generation logic when mapping jest<->vitest rules, probably?</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@connorshea
Copy link
Copy Markdown
Member

@copilot Please fix this by updating the code in tasks/lint_rules/src/markdown-renderer.mjs and/or tasks/lint_rules/src/oxlint-rules.mjs, there's no reason to change table.rs here.

Copilot AI changed the title [WIP] Fix linter rules table for no-restricted-vi-methods linter: Fix vitest/no-restricted-vi-methods not marked as implemented Dec 16, 2025
Copilot AI requested a review from connorshea December 16, 2025 06:28
Copilot AI requested a review from connorshea December 16, 2025 06:31
@connorshea connorshea marked this pull request as ready for review December 16, 2025 06:35
Copilot AI review requested due to automatic review settings December 16, 2025 06:35
@connorshea connorshea changed the title linter: Fix vitest/no-restricted-vi-methods not marked as implemented fix(linter): Fix vitest/no-restricted-vi-methods not marked as implemented Dec 16, 2025
@github-actions github-actions bot added the C-bug Category - Bug label Dec 16, 2025
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 16, 2025

@copilot Please fix this by updating the code in tasks/lint_rules/src/markdown-renderer.mjs and/or tasks/lint_rules/src/oxlint-rules.mjs, there's no reason to change table.rs here.

Reverted the Rust changes in commit 7062d63. The fix now only modifies tasks/lint_rules/src/oxlint-rules.mjs as requested.

Copilot AI changed the title fix(linter): Fix vitest/no-restricted-vi-methods not marked as implemented linter: Fix vitest/no-restricted-vi-methods not marked as implemented Dec 16, 2025
Copilot AI requested a review from connorshea December 16, 2025 06:37
@connorshea connorshea changed the title linter: Fix vitest/no-restricted-vi-methods not marked as implemented fix(linter): Fix vitest/no-restricted-vi-methods not marked as implemented Dec 16, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix the issue where the vitest rule no-restricted-vi-methods was not being marked as implemented in the rules table, despite being implemented via the jest rule no-restricted-jest-methods. The issue stems from the different naming between these two equivalent rules.

Key Changes:

  • Added special case handling in syncVitestPluginStatusWithJestPluginStatus() to map status from jest/no-restricted-jest-methods to vitest/no-restricted-vi-methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@connorshea connorshea added the 0-merge Merge with Graphite Merge Queue label Dec 17, 2025
Copy link
Copy Markdown
Member

connorshea commented Dec 17, 2025

Merge activity

…ented (#16940)

The vitest rule `no-restricted-vi-methods` is implemented via the jest rule `no-restricted-jest-methods`, but the different names prevented automatic status syncing in the rules table generation.

## Changes

- **tasks/lint_rules/src/oxlint-rules.mjs**: Added special case in `syncVitestPluginStatusWithJestPluginStatus()` to map `vitest/no-restricted-vi-methods` status from `jest/no-restricted-jest-methods`

## Result

The rules table will correctly show `vitest/no-restricted-vi-methods` as implemented when the lint rules tracking task is run.

<!-- START COPILOT ORIGINAL PROMPT -->

<details>

<summary>Original prompt</summary>

>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>linter: rules table does not properly mark no-restricted-vi-methods as implemented</issue_title>
> <issue_description>> Working in #16540 I have notice that `vitest/no-restricted-vi-methods` is implemented but the table show as not. As you can see
> >
> > https://github.com/oxc-project/oxc/blob/d6d2bcd1c7b2524addab2394c2849ba809006567/crates/oxc_linter/src/utils/mod.rs#L51
> >
> > Probably is due a name mistmatch. For Vitest the linter is named `no-restricted-vi-methods` but in jest is `no-restricted-jest-methods`. Following you can see how the jest rule have test case for the vitest context:
> >
> > https://github.com/oxc-project/oxc/blob/d6d2bcd1c7b2524addab2394c2849ba809006567/crates/oxc_linter/src/rules/jest/no_restricted_jest_methods.rs#L198-L231
>
>  _Originally posted by @Afsoon in [#4656](#4656 (comment)
>
> We should fix this by adding a one-off logic change to the rule list generation logic when mapping jest<->vitest rules, probably?</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>

</details>

<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes #16732

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/oxc-project/oxc/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.
@graphite-app graphite-app bot force-pushed the copilot/fix-linter-rules-implementation branch from 7062d63 to 2e563e0 Compare December 17, 2025 01:25
@graphite-app graphite-app bot merged commit 2e563e0 into main Dec 17, 2025
18 checks passed
@graphite-app graphite-app bot deleted the copilot/fix-linter-rules-implementation branch December 17, 2025 01:31
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 17, 2025
qinyuhang pushed a commit to qinyuhang/oxc that referenced this pull request Jan 22, 2026
…ented (oxc-project#16940)

The vitest rule `no-restricted-vi-methods` is implemented via the jest rule `no-restricted-jest-methods`, but the different names prevented automatic status syncing in the rules table generation.

## Changes

- **tasks/lint_rules/src/oxlint-rules.mjs**: Added special case in `syncVitestPluginStatusWithJestPluginStatus()` to map `vitest/no-restricted-vi-methods` status from `jest/no-restricted-jest-methods`

## Result

The rules table will correctly show `vitest/no-restricted-vi-methods` as implemented when the lint rules tracking task is run.

<!-- START COPILOT ORIGINAL PROMPT -->

<details>

<summary>Original prompt</summary>

>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>linter: rules table does not properly mark no-restricted-vi-methods as implemented</issue_title>
> <issue_description>> Working in oxc-project#16540 I have notice that `vitest/no-restricted-vi-methods` is implemented but the table show as not. As you can see
> >
> > https://github.com/oxc-project/oxc/blob/d6d2bcd1c7b2524addab2394c2849ba809006567/crates/oxc_linter/src/utils/mod.rs#L51
> >
> > Probably is due a name mistmatch. For Vitest the linter is named `no-restricted-vi-methods` but in jest is `no-restricted-jest-methods`. Following you can see how the jest rule have test case for the vitest context:
> >
> > https://github.com/oxc-project/oxc/blob/d6d2bcd1c7b2524addab2394c2849ba809006567/crates/oxc_linter/src/rules/jest/no_restricted_jest_methods.rs#L198-L231
>
>  _Originally posted by @Afsoon in [oxc-project#4656](oxc-project#4656 (comment)
>
> We should fix this by adding a one-off logic change to the rule list generation logic when mapping jest<->vitest rules, probably?</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>

</details>

<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes oxc-project#16732

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/oxc-project/oxc/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: rules table does not properly mark no-restricted-vi-methods as implemented

4 participants