Skip to content

Commit

Permalink
chore: fix codegen and move tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Jul 16, 2024
1 parent dfdd17b commit c325f4a
Show file tree
Hide file tree
Showing 37 changed files with 442 additions and 278 deletions.
8 changes: 2 additions & 6 deletions crates/biome_configuration/src/analyzer/assists/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
use crate::analyzer::{RuleConfiguration, RuleFixConfiguration, RulePlainConfiguration};
use biome_analyze::{options::RuleOptions, RuleFilter};
use biome_console::markup;
use biome_css_analyze::options::*;
use biome_deserialize::{DeserializableValidator, DeserializationDiagnostic};
use biome_deserialize_macros::{Deserializable, Merge};
use biome_diagnostics::{Category, Severity};
use biome_graphql_analyze::options::*;
use biome_js_analyze::options::*;
use biome_json_analyze::options::*;
use biome_rowan::TextRange;
use rustc_hash::FxHashSet;
#[cfg(feature = "schema")]
Expand Down Expand Up @@ -170,10 +166,10 @@ pub struct Refactor {
pub all: Option<bool>,
#[doc = "Provides a whole-source code action to sort the imports in the file using import groups and natural ordering."]
#[serde(skip_serializing_if = "Option::is_none")]
pub organize_imports: Option<RuleFixConfiguration<OrganizeImports>>,
pub organize_imports: Option<RuleFixConfiguration<biome_js_analyze::options::OrganizeImports>>,
#[doc = "Sorts the keys of a JSON object in natural order"]
#[serde(skip_serializing_if = "Option::is_none")]
pub use_sorted_keys: Option<RuleConfiguration<UseSortedKeys>>,
pub use_sorted_keys: Option<RuleConfiguration<biome_json_analyze::options::UseSortedKeys>>,
}
impl DeserializableValidator for Refactor {
fn validate(
Expand Down
693 changes: 424 additions & 269 deletions crates/biome_configuration/src/analyzer/linter/rules.rs

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions xtask/codegen/src/generate_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,6 @@ fn generate_for_groups(
use biome_deserialize::{DeserializableValidator, DeserializationDiagnostic};
use biome_deserialize_macros::{Deserializable, Merge};
use biome_diagnostics::{Category, Severity};
use biome_js_analyze::options::*;
use biome_json_analyze::options::*;
use biome_rowan::TextRange;
use rustc_hash::FxHashSet;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -590,10 +588,25 @@ fn generate_struct(group: &str, rules: &BTreeMap<&'static str, RuleMetadata>) ->
lines_rule.push(quote! {
#rule
});
let rule_option_type = match metadata.language {
"css" => quote! {
biome_css_analyze::options::#rule_name
},
"graphql" => quote! {
biome_graphql_analyze::options::#rule_name
},
"json" => quote! {
biome_json_analyze::options::#rule_name
},
"ts" | "js" | "jsx" | "tsx" => quote! {
biome_js_analyze::options::#rule_name
},
_ => panic!("Language not supported"),
};
schema_lines_rules.push(quote! {
#[doc = #summary]
#[serde(skip_serializing_if = "Option::is_none")]
pub #rule_identifier: Option<#rule_config_type<#rule_name>>
pub #rule_identifier: Option<#rule_config_type<#rule_option_type>>
});

rule_enabled_check_line.push(quote! {
Expand Down

0 comments on commit c325f4a

Please sign in to comment.