-
-
Notifications
You must be signed in to change notification settings - Fork 943
linter: rules table does not properly mark no-restricted-vi-methods as implemented #16732
Copy link
Copy link
Closed
Copy link
Labels
A-linterArea - LinterArea - Linter
Description
Working in #16540 I have notice that
vitest/no-restricted-vi-methodsis implemented but the table show as not. As you can seeoxc/crates/oxc_linter/src/utils/mod.rs
Line 51 in d6d2bcd
"no-restricted-jest-methods", Probably is due a name mistmatch. For Vitest the linter is named
no-restricted-vi-methodsbut in jest isno-restricted-jest-methods. Following you can see how the jest rule have test case for the vitest context:oxc/crates/oxc_linter/src/rules/jest/no_restricted_jest_methods.rs
Lines 198 to 231 in d6d2bcd
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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-linterArea - LinterArea - Linter
Type
Fields
Give feedbackPriority
None yet
Effort
None yet