-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: no-invalid-property-values rule #9
Conversation
The types for the |
@nzakas I would prefer it to be not combined with |
It may be worth considering if the syntax can be customised and where the user can do that. There'll be duplication in the configuration file if the rules are separate and the syntax can be customised via the rules' options. For example, if a user wants to use the non-spec export default [
{
rules: {
"no-unknown-properties": ["error", { "ignoreProperty": ["size"] }],
"no-invalid-property-values": ["error", { "propertiesSyntax": { "size": "<length-percentage>" } }]
}
}
]; We have this problem in Stylelint. We added our To avoid the duplication, you could combine the rules. For example: export default [
{
rules: {
"no-invalid-declarations": ["error", { "propertiesSyntax": { "size": "<length-percentage>" } }]
}
}
]; Or you could keep the rules separate and allow customisation of the syntax in export default [
{
languageOptions: {
"propertiesSyntax": { "size": "<length-percentage>" }
},
rules: {
"no-unknown-properties": "error",
"no-invalid-property-values": "error"
}
}
]; Whichever approach you take, you may want to use the same one for your @property foo {} It can also validate descriptors. For example, it'll flag @property --foo {
margin: 10px;
} We used the |
@akulsr0 the problem is that we are duplicating effort with two rules. Even though I'm not reporting unknown properties in this rule, the check is still occurring (I'm just ignoring the result). We can certainly add options to allow people to configure whether they want to ignore unknown rules or not. @jeddy3 thanks, that's very helpful. And yes, I agree that the same pattern should be followed for at rules. |
Closing in favor of #11. |
Prerequisites checklist
What is the purpose of this pull request?
Add a rule to validate property values. This uses the CSS spec to check every value of every property to ensure it's correct and expected.
What changes did you make? (Give an overview)
no-invalid-property-values
ruleno-invalid-property-values
rule torecommended
configRelated Issues
Refs #6
Is there anything you'd like reviewers to focus on?
I'm a bit torn as to whether to combine this rule with
no-unknown-properties
, becauselexer.matchDeclaration
will also check for unknown properties. I'd like some opinions on this. Here's what that looks like:#11
cc @akulsr0