fix(web): token linter ignores comments
This commit is contained in:
@@ -99,7 +99,13 @@ function checkCss(source, rel) {
|
||||
}
|
||||
|
||||
function checkPlain(source, rel) {
|
||||
source.split("\n").forEach((rawLine, index) => {
|
||||
// Comments are prose, not styling — `checkCss` already ignores them, and
|
||||
// without the same treatment here an issue reference like `#140` reads as a
|
||||
// three-digit hex colour and fails the gate.
|
||||
const stripped = source
|
||||
.replace(/\/\*[\s\S]*?\*\//g, (comment) => comment.replace(/[^\n]/g, " "))
|
||||
.replace(/\/\/.*$/gm, "");
|
||||
stripped.split("\n").forEach((rawLine, index) => {
|
||||
const neutral = rawLine.replace(RELATIVE_FROM_TOKEN, "from-token(");
|
||||
if (COLOR_LITERAL.test(neutral)) {
|
||||
errors.push(`${rel}:${index + 1}: literal colour outside the token block`);
|
||||
|
||||
Reference in New Issue
Block a user