question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix false positives for SVG type selectors in selector-type-case

See original GitHub issue

What 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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hverlincommented, Nov 14, 2021

Thanks! Will create a PR with the suggested fix

1reaction
ybiquitouscommented, Nov 12, 2021

When seeing https://developer.mozilla.org/en-US/docs/Web/SVG/Element, there are many elements with mixed-case like animateMotion. 👀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found