What rule do you want to change?
no-invalid-at-rules
What change do you want to make?
Generate more warnings
How do you think the change should be implemented?
A new default behavior
Example code
@property --size {
syntax: "<length>";
inherits: false;
initial-value: red;
}
@property --theme {
syntax: "<not-a-type-name>";
inherits: false;
initial-value: red;
}
What does the rule currently do for this code?
The rule does not report either example.
First example
The rule checks each value separately:
"<length>" is a string, so syntax passes.
red is a CSS value, so initial-value passes.
- The rule does not check whether
red matches <length>.
Second example
The rule handles it as follows:
"<not-a-type-name>" is a string, so syntax passes.
- The rule does not check the syntax definition inside the string.
What will the rule do after it's changed?
The rule will perform two additional checks.
- Check whether the value inside
syntax is a valid registered custom property syntax definition.
- Check whether a specified
initial-value matches that syntax.
The first example will report red because a color does not match <length>.
The second example will report "<not-a-type-name>" because that type does not exist.
The rule should not report missing descriptors. In the current specification, all @property descriptors are optional:
syntax defaults to "*".
inherits defaults to true.
initial-value defaults to the guaranteed-invalid value.
These examples should remain valid:
@property --anything {
initial-value: red;
}
@property --size {
syntax: "<length>";
}
Participation
AI acknowledgment
Additional comments
There are existing implementations.
- Stylelint
syntax-string-no-invalid checks the syntax definition inside the string.
- Biome
noInvalidPropertyInitValue checks whether initial-value matches syntax.
Disclosure: I'm a participant of open source contribution program OSSCA
What rule do you want to change?
no-invalid-at-rulesWhat change do you want to make?
Generate more warnings
How do you think the change should be implemented?
A new default behavior
Example code
What does the rule currently do for this code?
The rule does not report either example.
First example
The rule checks each value separately:
"<length>"is a string, sosyntaxpasses.redis a CSS value, soinitial-valuepasses.redmatches<length>.Second example
The rule handles it as follows:
"<not-a-type-name>"is a string, sosyntaxpasses.What will the rule do after it's changed?
The rule will perform two additional checks.
syntaxis a valid registered custom property syntax definition.initial-valuematches that syntax.The first example will report
redbecause a color does not match<length>.The second example will report
"<not-a-type-name>"because that type does not exist.The rule should not report missing descriptors. In the current specification, all
@propertydescriptors are optional:syntaxdefaults to"*".inheritsdefaults totrue.initial-valuedefaults to the guaranteed-invalid value.These examples should remain valid:
Participation
AI acknowledgment
Additional comments
There are existing implementations.
syntax-string-no-invalidchecks the syntax definition inside the string.noInvalidPropertyInitValuechecks whetherinitial-valuematchessyntax.Disclosure: I'm a participant of open source contribution program OSSCA