From 20bf1ddccd4827792a393d65eb2fca10b58a8835 Mon Sep 17 00:00:00 2001 From: Justinas Delinda <8914032+minht11@users.noreply.github.com> Date: Mon, 5 Aug 2024 01:14:42 +0300 Subject: [PATCH] code gen --- .../execute/migrate/eslint_any_rule_to_biome.rs | 15 ++++++++++----- crates/biome_configuration/src/linter/rules.rs | 4 +--- .../@biomejs/backend-jsonrpc/src/workspace.ts | 2 +- packages/@biomejs/biome/configuration_schema.json | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs b/crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs index d721fb805758..468171e97ed4 100644 --- a/crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs +++ b/crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs @@ -39,11 +39,8 @@ pub(crate) fn migrate_eslint_any_rule( rule.set_level(rule_severity.into()); } "@typescript-eslint/ban-types" => { - if !options.include_nursery { - return false; - } - let group = rules.nursery.get_or_insert_with(Default::default); - let rule = group.no_restricted_types.get_or_insert(Default::default()); + let group = rules.complexity.get_or_insert_with(Default::default); + let rule = group.no_banned_types.get_or_insert(Default::default()); rule.set_level(rule_severity.into()); } "@typescript-eslint/consistent-type-exports" => { @@ -178,6 +175,14 @@ pub(crate) fn migrate_eslint_any_rule( .get_or_insert(Default::default()); rule.set_level(rule_severity.into()); } + "@typescript-eslint/no-restricted-types" => { + if !options.include_nursery { + return false; + } + let group = rules.nursery.get_or_insert_with(Default::default); + let rule = group.no_restricted_types.get_or_insert(Default::default()); + rule.set_level(rule_severity.into()); + } "@typescript-eslint/no-this-alias" => { if !options.include_inspired { results.has_inspired_rules = true; diff --git a/crates/biome_configuration/src/linter/rules.rs b/crates/biome_configuration/src/linter/rules.rs index 624ff85cf135..7633a02b035a 100644 --- a/crates/biome_configuration/src/linter/rules.rs +++ b/crates/biome_configuration/src/linter/rules.rs @@ -2878,7 +2878,7 @@ pub struct Nursery { #[doc = "Disallow specified modules when loaded by import or require."] #[serde(skip_serializing_if = "Option::is_none")] pub no_restricted_imports: Option>, - #[doc = "Disallow primitive type aliases and misleading types."] + #[doc = "Disallow primitive type aliases, misleading or user defined types."] #[serde(skip_serializing_if = "Option::is_none")] pub no_restricted_types: Option>, #[doc = "Disallow shorthand properties that override related longhand properties."] @@ -3091,7 +3091,6 @@ impl Nursery { "noInvalidDirectionInLinearGradient", "noInvalidPositionAtImportRule", "noLabelWithoutControl", - "noRestrictedTypes", "noShorthandPropertyOverrides", "noUnknownFunction", "noUnknownProperty", @@ -3118,7 +3117,6 @@ impl Nursery { RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[13]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[14]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[17]), - RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[21]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[22]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[26]), RuleFilter::Rule(Self::GROUP_NAME, Self::GROUP_RULES[28]), diff --git a/packages/@biomejs/backend-jsonrpc/src/workspace.ts b/packages/@biomejs/backend-jsonrpc/src/workspace.ts index b9246f1deacf..6c5b2e995c92 100644 --- a/packages/@biomejs/backend-jsonrpc/src/workspace.ts +++ b/packages/@biomejs/backend-jsonrpc/src/workspace.ts @@ -1134,7 +1134,7 @@ export interface Nursery { */ noRestrictedImports?: RuleConfiguration_for_RestrictedImportsOptions; /** - * Disallow primitive type aliases and misleading types. + * Disallow primitive type aliases, misleading or user defined types. */ noRestrictedTypes?: RuleFixConfiguration_for_NoRestrictedTypesOptions; /** diff --git a/packages/@biomejs/biome/configuration_schema.json b/packages/@biomejs/biome/configuration_schema.json index a038a4a3c21f..9f4ec6663815 100644 --- a/packages/@biomejs/biome/configuration_schema.json +++ b/packages/@biomejs/biome/configuration_schema.json @@ -1935,7 +1935,7 @@ ] }, "noRestrictedTypes": { - "description": "Disallow primitive type aliases and misleading types.", + "description": "Disallow primitive type aliases, misleading or user defined types.", "anyOf": [ { "$ref": "#/definitions/NoRestrictedTypesConfiguration" }, { "type": "null" }