Skip to content

Commit 89d15dd

Browse files
committed
Minor refactor so that errorTokens that are not commas skip other if conditions.
1 parent 81bb712 commit 89d15dd

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/validations/css/prettycss.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,20 @@ const errorMap = {
7171
column: previousLine.length - 1,
7272
};
7373
}
74-
if (/,(?=\s*,)/.test(thisLine)) {
75-
return {
76-
reason: 'extra-commas',
77-
row: lineNumber - 1,
78-
column: errorToken.charNum,
79-
};
80-
}
81-
if (
82-
errorToken.content === ',' &&
83-
errorToken.charNum - 1 !== /,/.exec(thisLine).index &&
84-
endsWith(trim(thisLine), ';')
85-
) {
86-
return null;
74+
if (errorToken.content === ',') {
75+
if (/,(?=\s*,)/.test(thisLine)) {
76+
return {
77+
reason: 'extra-commas',
78+
row: lineNumber - 1,
79+
column: errorToken.charNum,
80+
};
81+
}
82+
if (
83+
errorToken.charNum - 1 !== /,/.exec(thisLine).index &&
84+
endsWith(trim(thisLine), ';')
85+
) {
86+
return null;
87+
}
8788
}
8889
}
8990

0 commit comments

Comments
 (0)