Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ mime_guess = "2.0.5"
nonmax = "0.5.5"
num-bigint = "0.4.6"
num-traits = "0.2.19"
once_cell = "1.19.0"
ouroboros = "0.18.4"
owo-colors = "4.0.0"
oxc_resolver = "1.10.2"
Expand Down
1 change: 0 additions & 1 deletion crates/oxc_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ oxc_index = { workspace = true }

bitflags = { workspace = true }
nonmax = { workspace = true }
once_cell = { workspace = true }
daachorse = { workspace = true }
rustc-hash = { workspace = true }

Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_codegen/src/annotation_comment.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use daachorse::DoubleArrayAhoCorasick;
use once_cell::sync::Lazy;
use oxc_ast::{Comment, CommentKind};
use oxc_span::Span;
use std::sync::LazyLock;

use crate::Codegen;
static MATCHER: Lazy<DoubleArrayAhoCorasick<usize>> = Lazy::new(|| {
static MATCHER: LazyLock<DoubleArrayAhoCorasick<usize>> = LazyLock::new(|| {
let patterns = vec!["#__NO_SIDE_EFFECTS__", "@__NO_SIDE_EFFECTS__", "@__PURE__", "#__PURE__"];

DoubleArrayAhoCorasick::new(patterns).unwrap()
Expand Down
1 change: 0 additions & 1 deletion crates/oxc_linter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ language-tags = { workspace = true }
mime_guess = { workspace = true }
url = { workspace = true }
rust-lapper = { workspace = true }
once_cell = { workspace = true }
memchr = { workspace = true }
json-strip-comments = { workspace = true }
schemars = { workspace = true, features = ["indexmap2"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use once_cell::sync::Lazy;
use oxc_ast::{
ast::{JSXAttributeItem, JSXAttributeValue},
AstKind,
Expand All @@ -7,6 +6,7 @@ use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use phf::phf_map;
use std::sync::LazyLock;

use crate::{
context::LintContext,
Expand Down Expand Up @@ -75,7 +75,7 @@ impl PreferTagOverRole {
}
}

static ROLE_TO_TAG_MAP: Lazy<phf::Map<&'static str, &'static str>> = Lazy::new(|| {
static ROLE_TO_TAG_MAP: LazyLock<phf::Map<&'static str, &'static str>> = LazyLock::new(|| {
phf_map! {
"checkbox" => "input",
"button" => "button",
Expand Down
10 changes: 6 additions & 4 deletions crates/oxc_linter/src/rules/react/no_unknown_property.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{borrow::Cow, collections::hash_map::HashMap};

use itertools::Itertools;
use once_cell::sync::Lazy;
use oxc_ast::{
ast::{JSXAttributeItem, JSXAttributeName, JSXElementName},
AstKind,
Expand All @@ -13,6 +12,7 @@ use phf::{phf_map, phf_set, Map, Set};
use regex::Regex;
use rustc_hash::FxHashSet;
use serde::Deserialize;
use std::sync::LazyLock;

use crate::{context::LintContext, rule::Rule, utils::get_jsx_attribute_name, AstNode};

Expand Down Expand Up @@ -419,7 +419,7 @@ const DOM_PROPERTIES_IGNORE_CASE: [&str; 5] = [
"webkitDirectory",
];

static DOM_PROPERTIES_LOWER_MAP: Lazy<HashMap<String, &'static str>> = Lazy::new(|| {
static DOM_PROPERTIES_LOWER_MAP: LazyLock<HashMap<String, &'static str>> = LazyLock::new(|| {
DOM_PROPERTIES_NAMES.iter().map(|it| (it.to_lowercase(), *it)).collect::<HashMap<_, _>>()
});

Expand All @@ -430,7 +430,8 @@ static DOM_PROPERTIES_LOWER_MAP: Lazy<HashMap<String, &'static str>> = Lazy::new
/// then the attribute is a valid data attribute.
///
fn is_valid_data_attr(name: &str) -> bool {
static DATA_ATTR_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^data(-?[^:]*)$").unwrap());
static DATA_ATTR_REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^data(-?[^:]*)$").unwrap());

!name.to_lowercase().starts_with("data-xml") && DATA_ATTR_REGEX.is_match(name)
}
Expand All @@ -455,7 +456,8 @@ impl Rule for NoUnknownProperty {
}

fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
static HTML_TAG_CONVENTION: Lazy<Regex> = Lazy::new(|| Regex::new("^[a-z][^-]*$").unwrap());
static HTML_TAG_CONVENTION: LazyLock<Regex> =
LazyLock::new(|| Regex::new("^[a-z][^-]*$").unwrap());

let AstKind::JSXOpeningElement(el) = &node.kind() else {
return;
Expand Down