Skip to content
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

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

Closed
hverlin opened this issue Nov 10, 2021 · 5 comments · Fixed by #5717
Closed

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

hverlin opened this issue Nov 10, 2021 · 5 comments · Fixed by #5717
Labels
status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule

Comments

@hverlin
Copy link
Contributor

hverlin commented Nov 10, 2021

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"]
    }]
  }
}
@ybiquitous
Copy link
Member

@hverlin Thank you for using a template! It seems useful to ignore foreignObject (something else?) by default.

I've labeled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

Perhaps, a bugfix may add an additional check to tag.value before the following code:

if (optionsMatches(options, 'ignoreTypes', tag.value)) {
return;
}

@ybiquitous ybiquitous added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule labels Nov 12, 2021
@ybiquitous
Copy link
Member

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

@jeddy3
Copy link
Member

jeddy3 commented Nov 13, 2021

Let's add these to our reference file and ignore them by default.

@jeddy3 jeddy3 changed the title "selector-type-case" false warning reported for foreignObject Fix false positives for SVG type selectors in selector-type-case Nov 13, 2021
@hverlin
Copy link
Contributor Author

hverlin commented Nov 14, 2021

Thanks! Will create a PR with the suggested fix

@hverlin
Copy link
Contributor Author

hverlin commented Nov 14, 2021

Created #5717, let me know if you have feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule
Development

Successfully merging a pull request may close this issue.

3 participants