Skip to content

Commit

Permalink
fix(lint/noDuplicateAtImportRules): correctly handle both single- and…
Browse files Browse the repository at this point in the history
… double quotes (#2707)
  • Loading branch information
DerTimonius authored May 4, 2024
1 parent e825c55 commit 293084b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ impl Rule for NoDuplicateAtImportRules {
.text()
.to_lowercase()
.replace("url(", "")
.replace(')', "");
.replace(')', "")
.replace('"', "'");
if let Some(media_query_set) = import_url_map.get_mut(&import_url) {
// if the current import_rule has no media queries or there are no queries saved in the
// media_query_set, this is always a duplicate
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "a.css";
@import 'a.css';
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
source: crates/biome_css_analyze/tests/spec_tests.rs
expression: invalidQuotes.css
---
# Input
```css
@import "a.css";
@import 'a.css';
```

# Diagnostics
```
invalidQuotes.css:2:2 lint/nursery/noDuplicateAtImportRules ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Each @import should be unique unless differing by media queries.
1 │ @import "a.css";
> 2 │ @import 'a.css';
│ ^^^^^^^^^^^^^^^
3 │
i Consider removing one of the duplicated imports.
```

0 comments on commit 293084b

Please sign in to comment.