Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tailwind variant sorting #3208

Merged
merged 11 commits into from
Jun 24, 2024
Merged
40 changes: 40 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/biome_js_analyze/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ biome_string_case = { workspace = true }
biome_suppression = { workspace = true }
biome_unicode_table = { workspace = true }
bitflags = { workspace = true }
bitvec = "1.0.1"
enumflags2 = { workspace = true }
lazy_static = { workspace = true }
natord = { workspace = true }
Expand Down
15 changes: 6 additions & 9 deletions crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ use biome_js_factory::make::{
};
use biome_rowan::{AstNode, BatchMutationExt};
use lazy_static::lazy_static;
use presets::get_config_preset;

use crate::JsRuleAction;

pub use self::options::UtilityClassSortingOptions;
use self::{
any_class_string_like::AnyClassStringLike,
presets::{get_utilities_preset, UseSortedClassesPreset},
sort::sort_class_name,
sort_config::SortConfig,
any_class_string_like::AnyClassStringLike, presets::UseSortedClassesPreset,
sort::sort_class_name, sort_config::SortConfig,
};

declare_rule! {
Expand All @@ -49,7 +48,7 @@ declare_rule! {
///
/// Notably, keep in mind that the following features are not supported yet:
///
/// - Variant sorting.
/// - Variant sorting (arbitrary variants are not supported yet).
/// - Custom utilitites and variants (such as ones introduced by Tailwind CSS plugins). Only the default Tailwind CSS configuration is supported.
/// - Options such as `prefix` and `separator`.
/// - Tagged template literals.
Expand Down Expand Up @@ -147,10 +146,8 @@ declare_rule! {
}

lazy_static! {
static ref SORT_CONFIG: SortConfig = SortConfig::new(
get_utilities_preset(&UseSortedClassesPreset::default()),
Vec::new(),
);
static ref SORT_CONFIG: SortConfig =
SortConfig::new(&get_config_preset(&UseSortedClassesPreset::default()));
}

impl Rule for UseSortedClasses {
Expand Down
Loading