Skip to content

Commit a0370bf

Browse files
heygscautofix-ci[bot]
andauthoredSep 9, 2024··
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>
1 parent 023c160 commit a0370bf

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed
 

‎Cargo.lock

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ cfg-if = "1.0.0"
119119
compact_str = "0.8.0"
120120
console = "0.15.8"
121121
convert_case = "0.6.0"
122+
cow-utils = "0.1.3"
122123
criterion2 = { version = "1.1.0", default-features = false }
123124
daachorse = { version = "1.0.0" }
124125
dashmap = "6.0.1"

‎crates/oxc_linter/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ oxc_syntax = { workspace = true }
3636

3737
bitflags = { workspace = true }
3838
convert_case = { workspace = true }
39+
cow-utils = { workspace = true }
3940
dashmap = { workspace = true }
4041
globset = { workspace = true }
4142
itertools = { workspace = true }

‎crates/oxc_linter/src/rules/eslint/no_script_url.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use cow_utils::CowUtils;
12
use oxc_ast::AstKind;
23
use oxc_diagnostics::OxcDiagnostic;
34
use oxc_macros::declare_oxc_lint;
@@ -37,7 +38,7 @@ impl Rule for NoScriptUrl {
3738
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
3839
match node.kind() {
3940
AstKind::StringLiteral(literal)
40-
if literal.value.to_lowercase().starts_with("javascript:") =>
41+
if literal.value.cow_to_lowercase().starts_with("javascript:") =>
4142
{
4243
emit_diagnostic(ctx, literal.span);
4344
}
@@ -51,7 +52,7 @@ impl Rule for NoScriptUrl {
5152
.unwrap()
5253
.value
5354
.raw
54-
.to_lowercase()
55+
.cow_to_lowercase()
5556
.starts_with("javascript:")
5657
{
5758
emit_diagnostic(ctx, literal.span);

0 commit comments

Comments
 (0)
Please sign in to comment.