Skip to content

Commit

Permalink
feat: tailwind variant sorting (#3208)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutaok authored Jun 24, 2024
1 parent fc9b1eb commit 5fe2f68
Show file tree
Hide file tree
Showing 18 changed files with 1,148 additions and 192 deletions.
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

0 comments on commit 5fe2f68

Please sign in to comment.