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 #4778

Merged
merged 1 commit into from May 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/utils/__tests__/isStandardSyntaxValue.test.js
Expand Up @@ -42,4 +42,10 @@ describe('isStandardSyntaxValue', () => {
it('less interpolation', () => {
expect(isStandardSyntaxValue('@{var}')).toBeFalsy();
});
it('WebExtension replacement keyword', () => {
expect(isStandardSyntaxValue('__MSG_@@bidi_dir__')).toBeFalsy();
});
it('negative WebExtension replacement keyword', () => {
expect(isStandardSyntaxValue('__msg_@@bidi_dir__')).toBeTruthy();
});
});
7 changes: 7 additions & 0 deletions lib/utils/isStandardSyntaxValue.js
Expand Up @@ -36,5 +36,12 @@ module.exports = function (value) {
return false;
}

// WebExtension replacement keyword used by Chrome/Firefox
// more information: https://developer.chrome.com/extensions/i18n
// and https://github.com/stylelint/stylelint/issues/4707
if (/__MSG_[^\s]+__/.test(value)) {
return false;
}

return true;
};