Skip to content

Commit

Permalink
Fix false positives for WebExtension replacement keywords in value-ke…
Browse files Browse the repository at this point in the history
…yword-case (#4778)
  • Loading branch information
mattxwang committed May 16, 2020
1 parent d2fb35d commit 4f8360b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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;
};

0 comments on commit 4f8360b

Please sign in to comment.