Skip to content

Commit 5d40676

Browse files
committedApr 7, 2025·
perf(linter): replace phf_set with array in react/iframe-missing-sandbox (#10281)
Related to #10076
1 parent 794b180 commit 5d40676

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

‎crates/oxc_linter/src/rules/react/iframe_missing_sandbox.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use phf::{Set, phf_set};
2-
31
use oxc_ast::{
42
AstKind,
53
ast::{
@@ -37,7 +35,7 @@ fn invalid_sandbox_combination_prop(span: Span) -> OxcDiagnostic {
3735
.with_label(span)
3836
}
3937

40-
const ALLOWED_VALUES: Set<&'static str> = phf_set! {
38+
const ALLOWED_VALUES: [&str; 15] = [
4139
"",
4240
"allow-downloads-without-user-activation",
4341
"allow-downloads",
@@ -52,8 +50,8 @@ const ALLOWED_VALUES: Set<&'static str> = phf_set! {
5250
"allow-scripts",
5351
"allow-storage-access-by-user-activation",
5452
"allow-top-navigation",
55-
"allow-top-navigation-by-user-activation"
56-
};
53+
"allow-top-navigation-by-user-activation",
54+
];
5755

5856
#[derive(Debug, Default, Clone)]
5957
pub struct IframeMissingSandbox;
@@ -177,7 +175,7 @@ fn validate_sandbox_value(literal: &StringLiteral, ctx: &LintContext) {
177175
let mut has_allow_same_origin = false;
178176
let mut has_allow_scripts = false;
179177
for trimmed_atr in attrs.into_iter().map(str::trim) {
180-
if !ALLOWED_VALUES.contains(trimmed_atr) {
178+
if !ALLOWED_VALUES.contains(&trimmed_atr) {
181179
ctx.diagnostic(invalid_sandbox_prop(literal.span, trimmed_atr));
182180
}
183181
if trimmed_atr == "allow-scripts" {

0 commit comments

Comments
 (0)
Please sign in to comment.