Files
react-native-devtools-frontend/node_modules/stylelint/lib/utils/isStandardSyntaxValue.js
T
Tim van der Lippe cc71b28ac4 Update stylelint to 13.10.0
DISABLE_THIRD_PARTY_CHECK=NPM update
R=jacktfranklin@chromium.org

Bug: none
Change-Id: I41b7006f336b9465677cc7434abd70a732c58221
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692907
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-02-15 14:11:00 +00:00

48 lines
1008 B
JavaScript

'use strict';
const hasInterpolation = require('../utils/hasInterpolation');
/**
* Check whether a value is standard
*
* @param {string} value
* @returns {boolean}
*/
module.exports = function (value) {
let normalizedValue = value;
// Ignore operators before variables (example -$variable)
if (/^[-+*/]/.test(value[0])) {
normalizedValue = normalizedValue.slice(1);
}
// SCSS variable (example $variable)
if (normalizedValue.startsWith('$')) {
return false;
}
// SCSS namespace (example namespace.$variable)
if (/^.+\.\$/.test(value)) {
return false;
}
// Less variable
if (normalizedValue.startsWith('@')) {
return false;
}
// SCSS or Less interpolation
if (hasInterpolation(normalizedValue)) {
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;
};