mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
perf(linter): use cow_utils in no_script_url (#5633)
part of #5586 --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
023c1607b0
commit
a0370bf506
4 changed files with 12 additions and 2 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
|
@ -327,6 +327,12 @@ dependencies = [
|
|||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cow-utils"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.12"
|
||||
|
|
@ -1621,6 +1627,7 @@ version = "0.9.3"
|
|||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"convert_case",
|
||||
"cow-utils",
|
||||
"dashmap 6.0.1",
|
||||
"globset",
|
||||
"insta",
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ cfg-if = "1.0.0"
|
|||
compact_str = "0.8.0"
|
||||
console = "0.15.8"
|
||||
convert_case = "0.6.0"
|
||||
cow-utils = "0.1.3"
|
||||
criterion2 = { version = "1.1.0", default-features = false }
|
||||
daachorse = { version = "1.0.0" }
|
||||
dashmap = "6.0.1"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ oxc_syntax = { workspace = true }
|
|||
|
||||
bitflags = { workspace = true }
|
||||
convert_case = { workspace = true }
|
||||
cow-utils = { workspace = true }
|
||||
dashmap = { workspace = true }
|
||||
globset = { workspace = true }
|
||||
itertools = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use cow_utils::CowUtils;
|
||||
use oxc_ast::AstKind;
|
||||
use oxc_diagnostics::OxcDiagnostic;
|
||||
use oxc_macros::declare_oxc_lint;
|
||||
|
|
@ -37,7 +38,7 @@ impl Rule for NoScriptUrl {
|
|||
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
||||
match node.kind() {
|
||||
AstKind::StringLiteral(literal)
|
||||
if literal.value.to_lowercase().starts_with("javascript:") =>
|
||||
if literal.value.cow_to_lowercase().starts_with("javascript:") =>
|
||||
{
|
||||
emit_diagnostic(ctx, literal.span);
|
||||
}
|
||||
|
|
@ -51,7 +52,7 @@ impl Rule for NoScriptUrl {
|
|||
.unwrap()
|
||||
.value
|
||||
.raw
|
||||
.to_lowercase()
|
||||
.cow_to_lowercase()
|
||||
.starts_with("javascript:")
|
||||
{
|
||||
emit_diagnostic(ctx, literal.span);
|
||||
|
|
|
|||
Loading…
Reference in a new issue