Skip to content

Commit

Permalink
fix: Emphasis @import
Browse files Browse the repository at this point in the history
  • Loading branch information
t-shiratori committed May 5, 2024
1 parent e97271b commit 7495e81
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ impl Rule for NoInvalidPositionAtImportRule {
rule_category!(),
span,
markup! {
"This @import is in the wrong position."
"This "<Emphasis>"@import"</Emphasis>" is in the wrong position."
},
)
.note(markup! {
"Consider moving import position."
}).note(markup! {
"Any @import rules must precede all other valid at-rules and style rules in a stylesheet (ignoring @charset and @layer), or else the @import rule is invalid."
"Any "<Emphasis>"@import"</Emphasis>" rules must precede all other valid at-rules and style rules in a stylesheet (ignoring @charset and @layer), or else the "<Emphasis>"@import"</Emphasis>" rule is invalid."
}),
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
source: crates/biome_css_analyze/tests/spec_tests.rs
assertion_line: 83
expression: invalid.css
---
# Input
```css
a {}
@import 'foo.css';

```

# Diagnostics
```
invalid.css:2:2 lint/nursery/noInvalidPositionAtImportRule ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

! This @import is in the wrong position.

1 │ a {}
> 2 │ @import 'foo.css';
│ ^^^^^^^^^^^^^^^^^
3 │

i Consider moving import position.

i Any @import rules must precede all other valid at-rules and style rules in a stylesheet (ignoring @charset and @layer), or else the @import rule is invalid.


```
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
source: crates/biome_css_analyze/tests/spec_tests.rs
assertion_line: 83
expression: invalidBetweenImport.css
---
# Input
```css
@import 'foo.css';
a {}
@import 'bar.css';

```

# Diagnostics
```
invalidBetweenImport.css:3:2 lint/nursery/noInvalidPositionAtImportRule ━━━━━━━━━━━━━━━━━━━━━━━━━━━━

! This @import is in the wrong position.

1 │ @import 'foo.css';
2 │ a {}
> 3 │ @import 'bar.css';
│ ^^^^^^^^^^^^^^^^^
4 │

i Consider moving import position.

i Any @import rules must precede all other valid at-rules and style rules in a stylesheet (ignoring @charset and @layer), or else the @import rule is invalid.


```
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
source: crates/biome_css_analyze/tests/spec_tests.rs
assertion_line: 83
expression: invalidMediaImport.css
---
# Input
```css
@media print {}
@import url('foo.css');

```

# Diagnostics
```
invalidMediaImport.css:2:2 lint/nursery/noInvalidPositionAtImportRule ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

! This @import is in the wrong position.

1 │ @media print {}
> 2 │ @import url('foo.css');
│ ^^^^^^^^^^^^^^^^^^^^^^
3 │

i Consider moving import position.

i Any @import rules must precede all other valid at-rules and style rules in a stylesheet (ignoring @charset and @layer), or else the @import rule is invalid.


```
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
source: crates/biome_css_analyze/tests/spec_tests.rs
assertion_line: 83
expression: invalidMediaImportUpperCase.css
---
# Input
```css
@media print {}
@imPort URl('foo.css');

```

# Diagnostics
```
invalidMediaImportUpperCase.css:2:2 lint/nursery/noInvalidPositionAtImportRule ━━━━━━━━━━━━━━━━━━━━━

! This @import is in the wrong position.

1 │ @media print {}
> 2 │ @imPort URl('foo.css');
│ ^^^^^^^^^^^^^^^^^^^^^^
3 │

i Consider moving import position.

i Any @import rules must precede all other valid at-rules and style rules in a stylesheet (ignoring @charset and @layer), or else the @import rule is invalid.


```

0 comments on commit 7495e81

Please sign in to comment.