mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(linter): remove once_cell (#7510)
This commit is contained in:
parent
3539f56cac
commit
2077ff9269
5 changed files with 12 additions and 14 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1712,7 +1712,6 @@ dependencies = [
|
|||
"memchr",
|
||||
"mime_guess",
|
||||
"nonmax",
|
||||
"once_cell",
|
||||
"oxc_allocator",
|
||||
"oxc_ast",
|
||||
"oxc_cfg",
|
||||
|
|
|
|||
|
|
@ -165,7 +165,6 @@ mime_guess = "2.0.5"
|
|||
nonmax = "0.5.5"
|
||||
num-bigint = "0.4.6"
|
||||
num-traits = "0.2.19"
|
||||
once_cell = "1.20.2"
|
||||
oxc-browserslist = "1.1.0"
|
||||
oxc_index = "1.0.0"
|
||||
oxc_resolver = "2.0.0"
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ lazy_static = { workspace = true }
|
|||
memchr = { workspace = true }
|
||||
mime_guess = { workspace = true }
|
||||
nonmax = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
phf = { workspace = true, features = ["macros"] }
|
||||
rayon = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
use once_cell::sync::Lazy;
|
||||
use lazy_static::lazy_static;
|
||||
use phf::phf_map;
|
||||
|
||||
use oxc_ast::{
|
||||
ast::{JSXAttributeItem, JSXAttributeValue},
|
||||
AstKind,
|
||||
|
|
@ -6,7 +8,6 @@ use oxc_ast::{
|
|||
use oxc_diagnostics::OxcDiagnostic;
|
||||
use oxc_macros::declare_oxc_lint;
|
||||
use oxc_span::Span;
|
||||
use phf::phf_map;
|
||||
|
||||
use crate::{
|
||||
context::LintContext,
|
||||
|
|
@ -78,16 +79,16 @@ impl PreferTagOverRole {
|
|||
}
|
||||
}
|
||||
|
||||
static ROLE_TO_TAG_MAP: Lazy<phf::Map<&'static str, &'static str>> = Lazy::new(|| {
|
||||
phf_map! {
|
||||
lazy_static! {
|
||||
static ref ROLE_TO_TAG_MAP: phf::Map<&'static str, &'static str> = phf_map! {
|
||||
"checkbox" => "input",
|
||||
"button" => "button",
|
||||
"heading" => "h1,h2,h3,h4,h5,h6",
|
||||
"link" => "a,area",
|
||||
"rowgroup" => "tbody,tfoot,thead",
|
||||
"banner" => "header",
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
impl Rule for PreferTagOverRole {
|
||||
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::borrow::Cow;
|
|||
|
||||
use cow_utils::CowUtils;
|
||||
use itertools::Itertools;
|
||||
use once_cell::sync::Lazy;
|
||||
use lazy_static::lazy_static;
|
||||
use oxc_ast::{
|
||||
ast::{JSXAttributeItem, JSXAttributeName, JSXElementName},
|
||||
AstKind,
|
||||
|
|
@ -425,12 +425,12 @@ const DOM_PROPERTIES_IGNORE_CASE: [&str; 5] = [
|
|||
"webkitDirectory",
|
||||
];
|
||||
|
||||
static DOM_PROPERTIES_LOWER_MAP: Lazy<FxHashMap<String, &'static str>> = Lazy::new(|| {
|
||||
DOM_PROPERTIES_NAMES
|
||||
lazy_static! {
|
||||
static ref DOM_PROPERTIES_LOWER_MAP: FxHashMap<String, &'static str> = DOM_PROPERTIES_NAMES
|
||||
.iter()
|
||||
.map(|it| (it.cow_to_lowercase().into_owned(), *it))
|
||||
.collect::<FxHashMap<_, _>>()
|
||||
});
|
||||
.collect::<FxHashMap<_, _>>();
|
||||
}
|
||||
|
||||
/// Checks if an attribute name is a valid `data-*` attribute:
|
||||
/// - Name starts with "data-" and has alphanumeric words (browsers require lowercase, but React and TS lowercase them),
|
||||
|
|
|
|||
Loading…
Reference in a new issue