mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 17:54:15 +03:00
fix(css/lints): Allow empty @layer
at-rule before @import
at-rule (#3842)
This commit is contained in:
parent
08a4bb7454
commit
90fdbab0d6
@ -37,6 +37,11 @@ impl Visit for NoInvalidPositionAtImportRule {
|
||||
|
||||
match rule {
|
||||
Rule::AtRule(AtRule::Charset(..) | AtRule::Import(..)) => seen,
|
||||
Rule::AtRule(AtRule::Layer(LayerRule { block, .. })) => match block {
|
||||
Some(block) if block.value.is_empty() => seen,
|
||||
None => seen,
|
||||
_ => true,
|
||||
},
|
||||
Rule::AtRule(AtRule::Unknown(UnknownAtRule { name, .. })) => {
|
||||
let name = match name {
|
||||
AtRuleName::DashedIdent(dashed_ident) => &dashed_ident.value,
|
||||
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"rules": {
|
||||
"no-invalid-position-at-import-rule": ["error"]
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
@layer framework {
|
||||
.title {
|
||||
}
|
||||
}
|
||||
|
||||
@import "kumiko.css";
|
@ -0,0 +1,6 @@
|
||||
error: Unexpected invalid position '@import' rule.
|
||||
--> $DIR/tests/rules/fail/no-invalid-position-at-import-rule/default/at-layer-rule/input.css:6:1
|
||||
|
|
||||
6 | @import "kumiko.css";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,4 +1,6 @@
|
||||
@charset "utf-8";
|
||||
@layer framework, override;
|
||||
@layer {}
|
||||
|
||||
@import "kumiko.css";
|
||||
@import "reina.css";
|
||||
|
Loading…
Reference in New Issue
Block a user