fix(xtask): enforce a stable ordering for the generated imports of lint rules
MODIFY
crates/rome_analyze/src/analyzers.rs
crates/rome_analyze/src/analyzers.rs
//! Generated file, do not edit by hand, see `xtask/codegen`
-mod use_while;
-pub(crate) use use_while::UseWhile;
+mod no_compare_neg_zero;
+pub(crate) use no_compare_neg_zero::NoCompareNegZero;
mod no_delete;
pub(crate) use no_delete::NoDelete;
mod no_double_equals;
pub(crate) use no_double_equals::NoDoubleEquals;
mod no_negation_else;
pub(crate) use no_negation_else::NoNegationElse;
-mod no_compare_neg_zero;
-pub(crate) use no_compare_neg_zero::NoCompareNegZero;
-mod use_valid_typeof;
-pub(crate) use use_valid_typeof::UseValidTypeof;
mod use_single_var_declarator;
pub(crate) use use_single_var_declarator::UseSingleVarDeclarator;
+mod use_valid_typeof;
+pub(crate) use use_valid_typeof::UseValidTypeof;
+mod use_while;
+pub(crate) use use_while::UseWhile;

MODIFY
crates/rome_analyze/src/registry.rs
crates/rome_analyze/src/registry.rs
@@ -36,13 +36,13 @@ macro_rules! impl_registry_builders {
impl_registry_builders!(
// Analyzers
- UseWhile,
+ NoCompareNegZero,
NoDelete,
NoDoubleEquals,
NoNegationElse,
- NoCompareNegZero,
- UseValidTypeof,
UseSingleVarDeclarator,
+ UseValidTypeof,
+ UseWhile,
// Assists
FlipBinExp,
);

MODIFY
xtask/codegen/src/generate_analyzer.rs
xtask/codegen/src/generate_analyzer.rs
@@ -42,15 +42,19 @@ fn generate_module(name: &'static str, entries: &mut Vec<String>) -> Result<()>
rule_name.push(char);
}
- entries.push(rule_name.clone());
+ let index = entries.binary_search(&rule_name).unwrap_err();
+ entries.insert(index, rule_name.clone());
let module_name = format_ident!("{}", file_name);
let rule_name = format_ident!("{}", rule_name);
- rules.push(quote! {
+ rules.insert(
+ index,
+ quote! {
mod #module_name;
pub(crate) use #module_name::#rule_name;
- });
+ },
+ );
}
let tokens = xtask::reformat(quote! {

fix(xtask): enforce a stable ordering for the generated imports of lint rules (#2695)