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

Enable camelCaseSvgKeywords option for value-keyword-case #292

Open
rohm1 opened this issue Jun 2, 2023 · 13 comments
Open

Enable camelCaseSvgKeywords option for value-keyword-case #292

rohm1 opened this issue Jun 2, 2023 · 13 comments
Labels
status: needs discussion triage needs further discussion

Comments

@rohm1
Copy link

rohm1 commented Jun 2, 2023

What steps are needed to reproduce the bug?

* {
	text-rendering: optimizeLegibility;
}

What Stylelint configuration is needed to reproduce the bug?

{
  "extends": [
    "stylelint-config-standard"
  ]
}

How did you run Stylelint?

Demo website: https://stylelint.io/demo/#N4Igxg9gJgpiBcIBUACYAdAdugLjmAHjgLQBOMmspAlpgObwoQAOO1AttQF4wAyMdagCNqAG2o4AngG4sAXxAAaEADMxMAHIBDdnESEdzUTAB0YAM7ml4CJjV0EIDJhQp0IQvkrn3jANpYrq7u5lLG4pgkkHbUdMShWpRapFDugSgAuvLW0fYAYhCk7Fo4jgBW5rbWsMxWiM7BIKGS4bQ4vm4goiUwoe6K6SFhMBFRtvbxOIlQyakInd34fSDZckA

Which version of Stylelint or dependencies are you using?

latest

What did you expect to happen?

No problems to be reported

What actually happened?

Error: Expected "optimizeLegibility" to be "optimizelegibility" (value-keyword-case)

Does the bug relate to non-standard syntax?

no

Proposal to fix the bug

Possibly related to stylelint/stylelint#6517

@ybiquitous
Copy link
Member

@rohm1 Thanks for the report. But I believe this is not a bug. You can avoid the error by the camelCaseSvgKeywords option:

{
  "rules": {
    "value-keyword-case": ["lower", {"camelCaseSvgKeywords": true}]
  }
}

See also this demo.

@rohm1
Copy link
Author

rohm1 commented Jun 2, 2023

@ybiquitous thanks, but this is at least a default config bug. I should not have to configure anything for standard CSS properties and values.

@ybiquitous
Copy link
Member

Make sense. Let's move this into the standard config repo and continue discussing.

Ref:

'value-keyword-case': 'lower',

@ybiquitous ybiquitous transferred this issue from stylelint/stylelint Jun 2, 2023
@ybiquitous ybiquitous added the status: needs discussion triage needs further discussion label Jun 2, 2023
@ybiquitous ybiquitous changed the title False positive value-keyword-case with native value Enable camelCaseSvgKeywords for value-keyword-case Jun 2, 2023
@ybiquitous ybiquitous changed the title Enable camelCaseSvgKeywords for value-keyword-case Enable camelCaseSvgKeywords option for value-keyword-case Jun 2, 2023
@ybiquitous
Copy link
Member

Just to confirm, are both valid, e.g., optimizeLegibility and optimizelegibility?

@rohm1
Copy link
Author

rohm1 commented Jun 5, 2023

Not sure, the specs make only mention of the camel case option (https://svgwg.org/svg2-draft/painting.html#TextRenderingProperty). But both Firefox and Chrome seem to accept camel case and lowercase.

@ybiquitous
Copy link
Member

Umm, if we enable camelCaseSvgKeywords, the following valid CSS using the currentcolor keyword will be reported:

a {
  color: currentcolor;
/*       ^ Expected "currentcolor" to be "currentColor"
 */
}

See this demo.

What do you think?

@rohm1
Copy link
Author

rohm1 commented Jun 5, 2023

Looks like this is wrong: https://github.com/stylelint/stylelint/blob/main/lib/reference/keywords.js#L265 currentcolor is expected to be camel case but the spec you mention states lowercase.

@ybiquitous
Copy link
Member

Does the SVG spec support currentColor, right?

@rohm1
Copy link
Author

rohm1 commented Jun 7, 2023

The link you provided is CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/#currentcolor-color), keyword is only mentioned in lowercase.
In CSS Color Module Level 3 (https://www.w3.org/TR/css-color-3/#currentcolor) keyword is written in camel case, and references SVG 1.0 specifications which also use camel case.
Finaly, SVG2 draft also mentions the keyword in camel case: https://svgwg.org/svg2-draft/painting.html#ColorProperty.

To summarize:

  • CSS3, SVG1 and SVG2: currentColor
  • CSS4: currentcolor

@ybiquitous
Copy link
Member

Umm..., it seems we cannot enable camelCaseSvgKeywords until fixing the problem. 🤔

@nschonni
Copy link

nschonni commented Aug 5, 2023

I came across this issue, and trying to trace down any upstream issue I found w3c/csswg-drafts#4599
which points over that the values are case insensitive https://drafts.csswg.org/css-values-4/#keywords, so fixing them to the camelCase should be safe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs discussion triage needs further discussion
Development

No branches or pull requests

4 participants