Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lint/noDuplicateAtImportRules): correctly handle both single- and double quotes #2707

Merged
merged 1 commit into from
May 4, 2024
Merged
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
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.


```