Fix false positives for SVG type selectors in selector-type-case
See original GitHub issueWhat steps are needed to reproduce the bug?
There is a false positive for foreignObject
.
The following code will indicate that there is selector-type-case
issue
foreignObject {
color: white;
}
Link to a demo
What Stylelint configuration is needed to reproduce the bug?
{
"rules": {
"selector-type-case": ["lower"]
}
}
How did you run Stylelint?
CLI, or see the demo link
Which version of Stylelint are you using?
14.0.0
, 13.13.1
What did you expect to happen?
No problems to be reported
What actually happened?
Got the following error:
Expected "foreignObject" to be "foreignobject" (selector-type-case)
Does the bug relate to non-standard syntax?
No
Proposal to fix the bug
There should be no issue as foreignObject
tag is part of SVG definition.
A potential workaround for now is to use the following config
{
"rules": {
"selector-type-case": ["lower", {
"ignoreTypes": ["foreignObject"]
}]
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Changelog | Stylelint
Fixed : selector-type-case false positives for SVG elements (#5973). Fixed: unit-no-unknown false positives for large/small/dynamic viewport units (#5970).
Read more >7.7.1 - stylelint
Fixed : false positives for some camel-case SVG keywords in value-keyword-case . ... Fixed: selector-no-type and selector-type-case now ignore non-standard ...
Read more >sonarqube giving false positive with the rule "Unknown type ...
While this is a valid workaround, I would hope there's a way to configure SonarQube to understand custom selectors so I don't have...
Read more >False positive on duplication in React/SVG component
Hello, I am experiencing some false positives with a few icons components. They are created using TSX and not pure svg files (full...
Read more >Type selectors - CSS: Cascading Style Sheets - MDN Web Docs
The CSS type selector matches elements by node name. In other words, it selects all elements of the given type within a document....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! Will create a PR with the suggested fix
When seeing https://developer.mozilla.org/en-US/docs/Web/SVG/Element, there are many elements with mixed-case like
animateMotion
. 👀