mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
feat(linter): add schema for vitest/consistent-vitest-vi (#23292)
This commit is contained in:
1 parent
d8a5b57d7c
commit
ff94d4afa5
4 files changed
+92
-6
No files matched your search
@@ -234,6 +234,7 @@ export type NoInstanceofBuiltinsStrategy = "strict" | "loose";
|
||||
export type PreferTernaryOption = "always" | "only-single-line";
|
||||
export type RelativeUrlStyleConfig = "never" | "always";
|
||||
export type SwitchCaseBracesConfig = "always" | "avoid";
|
||||
export type VitestFnName = "vi" | "vitest";
|
||||
export type CaseType = "PascalCase" | "kebab-case";
|
||||
export type DeclarationStyle = "type-based" | "type-literal" | "runtime";
|
||||
export type DeclarationStyle2 = "type-based" | "runtime";
|
||||
@@ -1536,7 +1537,7 @@ export interface DummyRuleMap {
|
||||
"vitest/consistent-each-for"?: DummyRule;
|
||||
"vitest/consistent-test-filename"?: DummyRule;
|
||||
"vitest/consistent-test-it"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, ConsistentTestItConfig];
|
||||
"vitest/consistent-vitest-vi"?: DummyRule;
|
||||
"vitest/consistent-vitest-vi"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, ConsistentVitestConfig];
|
||||
"vitest/expect-expect"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, ExpectExpectConfig];
|
||||
"vitest/hoisted-apis-on-top"?: RuleNoConfig;
|
||||
"vitest/max-expects"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, MaxExpectsConfig];
|
||||
@@ -5304,6 +5305,12 @@ export interface ValidTypeof {
|
||||
*/
|
||||
requireStringLiterals?: boolean;
|
||||
}
|
||||
export interface ConsistentVitestConfig {
|
||||
/**
|
||||
* Decides whether to prefer vitest function accessor
|
||||
*/
|
||||
fn?: VitestFnName;
|
||||
}
|
||||
export interface PreferImportInMockConfig {
|
||||
/**
|
||||
* Whether the rule should generate fixes or not.
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::rules::RuleEnum;
|
||||
/// These should return the DummyRule struct/schema instead of the actual rule struct/schema,
|
||||
/// until we verify that the rule's schema is valid and can be generated by schemars.
|
||||
#[cfg(feature = "ruledocs")]
|
||||
const NO_VERIFIED_VALID_SCHEMA: [&str; 55] = [
|
||||
const NO_VERIFIED_VALID_SCHEMA: [&str; 54] = [
|
||||
"eslint/func-name-matching",
|
||||
"eslint/no-restricted-globals",
|
||||
"eslint/no-restricted-imports",
|
||||
@@ -66,7 +66,6 @@ const NO_VERIFIED_VALID_SCHEMA: [&str; 55] = [
|
||||
"unicorn/prefer-at",
|
||||
"vitest/consistent-each-for",
|
||||
"vitest/consistent-test-filename",
|
||||
"vitest/consistent-vitest-vi",
|
||||
"vitest/prefer-lowercase-title",
|
||||
"vitest/valid-title",
|
||||
];
|
||||
|
||||
@@ -1052,6 +1052,22 @@
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"ConsistentVitestConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fn": {
|
||||
"description": "Decides whether to prefer vitest function accessor",
|
||||
"default": "vi",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/VitestFnName"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Decides whether to prefer vitest function accessor"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"CountThis": {
|
||||
"oneOf": [
|
||||
{
|
||||
@@ -7712,7 +7728,24 @@
|
||||
]
|
||||
},
|
||||
"vitest/consistent-vitest-vi": {
|
||||
"$ref": "#/definitions/DummyRule"
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/AllowWarnDeny"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"$ref": "#/definitions/AllowWarnDeny"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/ConsistentVitestConfig"
|
||||
}
|
||||
],
|
||||
"maxItems": 2,
|
||||
"minItems": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"vitest/expect-expect": {
|
||||
"anyOf": [
|
||||
@@ -14995,6 +15028,13 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"VitestFnName": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"vi",
|
||||
"vitest"
|
||||
]
|
||||
},
|
||||
"VitestPluginSettings": {
|
||||
"description": "Configure Vitest plugin rules.\n\nSee [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest)'s\nconfiguration for a full reference.",
|
||||
"type": "object",
|
||||
@@ -15041,4 +15081,4 @@
|
||||
}
|
||||
},
|
||||
"markdownDescription": "Oxlint Configuration File\n\nThis configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).\n\nUsage: `oxlint -c oxlintrc.json`\n\nExample\n\n`.oxlintrc.json`\n\n```json\n{\n\"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n\"plugins\": [\"import\", \"typescript\", \"unicorn\"],\n\"env\": {\n\"browser\": true\n},\n\"globals\": {\n\"foo\": \"readonly\"\n},\n\"settings\": {\n\"react\": {\n\"version\": \"18.2.0\"\n},\n\"custom\": { \"option\": true }\n},\n\"rules\": {\n\"eqeqeq\": \"warn\",\n\"import/no-cycle\": \"error\",\n\"react/self-closing-comp\": [\"error\", { \"html\": false }]\n},\n\"overrides\": [\n{\n\"files\": [\"*.test.ts\", \"*.spec.ts\"],\n\"rules\": {\n\"@typescript-eslint/no-explicit-any\": \"off\"\n}\n}\n]\n}\n```\n\n`oxlint.config.ts`\n\n```ts\nimport { defineConfig } from \"oxlint\";\n\nexport default defineConfig({\nplugins: [\"import\", \"typescript\", \"unicorn\"],\nenv: {\n\"browser\": true\n},\nglobals: {\n\"foo\": \"readonly\"\n},\nsettings: {\nreact: {\nversion: \"18.2.0\"\n},\ncustom: { option: true }\n},\nrules: {\n\"eqeqeq\": \"warn\",\n\"import/no-cycle\": \"error\",\n\"react/self-closing-comp\": [\"error\", { \"html\": false }]\n},\noverrides: [\n{\nfiles: [\"*.test.ts\", \"*.spec.ts\"],\nrules: {\n\"@typescript-eslint/no-explicit-any\": \"off\"\n}\n}\n]\n});\n```"
|
||||
}
|
||||
}
|
||||
@@ -1056,6 +1056,22 @@ expression: json
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"ConsistentVitestConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fn": {
|
||||
"description": "Decides whether to prefer vitest function accessor",
|
||||
"default": "vi",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/VitestFnName"
|
||||
}
|
||||
],
|
||||
"markdownDescription": "Decides whether to prefer vitest function accessor"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"CountThis": {
|
||||
"oneOf": [
|
||||
{
|
||||
@@ -7716,7 +7732,24 @@ expression: json
|
||||
]
|
||||
},
|
||||
"vitest/consistent-vitest-vi": {
|
||||
"$ref": "#/definitions/DummyRule"
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/AllowWarnDeny"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"$ref": "#/definitions/AllowWarnDeny"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/ConsistentVitestConfig"
|
||||
}
|
||||
],
|
||||
"maxItems": 2,
|
||||
"minItems": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"vitest/expect-expect": {
|
||||
"anyOf": [
|
||||
@@ -14999,6 +15032,13 @@ expression: json
|
||||
}
|
||||
]
|
||||
},
|
||||
"VitestFnName": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"vi",
|
||||
"vitest"
|
||||
]
|
||||
},
|
||||
"VitestPluginSettings": {
|
||||
"description": "Configure Vitest plugin rules.\n\nSee [eslint-plugin-vitest](https://github.com/vitest-dev/eslint-plugin-vitest)'s\nconfiguration for a full reference.",
|
||||
"type": "object",
|
||||
|
||||
Reference in new issue
Block a user