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 WebExtension replacement keywords in value-keyword-case #4707

Closed
fregante opened this issue Apr 19, 2020 · 4 comments · Fixed by #4778
Closed

Fix false positives for WebExtension replacement keywords in value-keyword-case #4707

fregante opened this issue Apr 19, 2020 · 4 comments · Fixed by #4778
Labels
good first issue is good for newcomers status: wip is being worked on by someone type: bug a problem with a feature or rule

Comments

@fregante
Copy link

Clearly describe the bug

Chrome/Firefox extensions have CSS keywords that are replaced at runtime and are case-sensitive. For example:

body {
	direction: __MSG_@@bidi_dir__;
}

Which the browser interprets as:

body {
	direction: ltr;
	/* or direction: rtl; */
}

These are mostly used for localization/internalization. Documentation: https://developer.chrome.com/extensions/i18n

Which rule, if any, is the bug related to?

value-keyword-case

What stylelint configuration is needed to reproduce the bug?

{
  "rules": {
    "value-keyword-case": "lower"
  }
}

Which version of stylelint are you using?

13.3.2

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

CLI

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

Kinda. However it's parsed by the browsers, not a transpiler.

What did you expect to happen?

Keywords that match /__MSG_[^\s]+__/ should be skipped by the rule.

What actually happened (e.g. what warnings or errors did you get)?

test.css
 2:13  ✖  Expected "__MSG_@@bidi_dir__" to be "__msg_@@bidi_dir__"   value-keyword-case
@fregante
Copy link
Author

NB: the lower case version is not compatible with browsers.

@jeddy3 jeddy3 changed the title Exclude WebExtension replacement keywords from value-keyword-case Fix false positives for WebExtension replacement keywords in value-keyword-case Apr 19, 2020
@jeddy3 jeddy3 added good first issue is good for newcomers status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule labels Apr 19, 2020
@jeddy3
Copy link
Member

jeddy3 commented Apr 19, 2020

@fregante Thanks for the clear report and for using the template.

I can reproduce this using the demo.

Keywords that match /__MSG_[^\s]+__/ should be skipped by the rule.

Sounds good. It can be added to the isStandardSyntaxValue util (and tests).

I've labelled 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.

@mattxwang
Copy link
Member

Is anybody else working on this? If not, I can give it a shot!

@jeddy3
Copy link
Member

jeddy3 commented May 11, 2020

I can give it a shot!

Excellent. I'll label as "wip" for you.

@jeddy3 jeddy3 added status: wip is being worked on by someone and removed status: ready to implement is ready to be worked on by someone labels May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue is good for newcomers status: wip is being 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