{"record":{"id":"3c45f43314c3fadc","repo":"oxc-project/oxc","slug":"the-vitest-function-accessor-used-is-not-allowed","errorCode":null,"errorMessage":"The vitest function accessor used is not allowed","messagePattern":"The vitest function accessor used is not allowed","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vitest/consistent_vitest_vi.rs","lineNumber":20,"sourceCode":"use serde::{Deserialize, Serialize};\n\nuse oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n    utils::{\n        JestFnKind, JestGeneralFnKind, PossibleJestNode, is_vitest_import_source,\n        parse_general_jest_fn_call,\n    },\n};\n\nfn consistent_vitest_vi_diagnostic(span: Span, fn_value: &VitestFnName) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"The vitest function accessor used is not allowed\")\n        .with_help(format!(\n            \"Prefer using `{}` instead of `{}`.\",\n            fn_value.as_str(),\n            fn_value.not().as_str()\n        ))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct ConsistentVitestVi(Box<ConsistentVitestConfig>);\n\nimpl std::ops::Deref for ConsistentVitestVi {\n    type Target = ConsistentVitestConfig;\n\n    fn deref(&self) -> &Self::Target {\n        &self.0\n    }\n}","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vitest/consistent_vitest_vi.rs#L2-L38","documentation":"Emitted by the vitest/consistent-vitest-git rule's companion (consistent-vitest-vi) when a vitest import accessor violates the configured preference between `vi` and `vitest` accessors. It fires at the jest/vitest function-call node because the project requires one consistent accessor style for the `vi` namespace.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vitest/consistent_vitest_vi.rs:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the allowed accessor form configured by the rule's `allowed` option (e.g. always `vi.mock()` or always `vitest.mock()`)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}