fix(css/lints): Allow empty @layer at-rule before @import at-rule (#3842)

This commit is contained in:
Pig Fang 2022-03-04 19:41:44 +08:00 committed by GitHub
parent 08a4bb7454
commit 90fdbab0d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 0 deletions

View File

@ -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,

View File

@ -0,0 +1,5 @@
{
"rules": {
"no-invalid-position-at-import-rule": ["error"]
}
}

View File

@ -0,0 +1,6 @@
@layer framework {
.title {
}
}
@import "kumiko.css";

View File

@ -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";
| ^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,6 @@
@charset "utf-8";
@layer framework, override;
@layer {}
@import "kumiko.css";
@import "reina.css";