fix(linter): Fix vitest/no-restricted-vi-methods not marked as implemented#16940
Conversation
|
@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. |
There was a problem hiding this comment.
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 fromjest/no-restricted-jest-methodstovitest/no-restricted-vi-methods
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
7062d63 to
2e563e0
Compare
…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.
The vitest rule
no-restricted-vi-methodsis implemented via the jest ruleno-restricted-jest-methods, but the different names prevented automatic status syncing in the rules table generation.Changes
syncVitestPluginStatusWithJestPluginStatus()to mapvitest/no-restricted-vi-methodsstatus fromjest/no-restricted-jest-methodsResult
The rules table will correctly show
vitest/no-restricted-vi-methodsas implemented when the lint rules tracking task is run.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.