Skip to content

Commit e8e5447

Browse files
authored
Fix an exception with hard coded color rule (#1394)
1 parent dcc7bd6 commit e8e5447

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

eslint-rules/lib/rules/no-hard-coded-color.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = {
4040
.invert()
4141
.value();
4242
const invertedColorsDict = _.assign({}, validColorsDic, extraColors);
43-
const lowerCaseColorString = colorString.toLowerCase().replace(/ /g, '');
43+
const lowerCaseColorString = (colorString ? colorString.toLowerCase() : '').replace(/ /g, '');
4444
if (invertedColorsDict[lowerCaseColorString]) {
4545
return fixer.replaceText(node, `Colors.${invertedColorsDict[lowerCaseColorString]}`);
4646
}
@@ -78,7 +78,7 @@ module.exports = {
7878

7979
const colorExceptions = ['transparent'];
8080

81-
function isColorException(colorString) {
81+
function isColorException(colorString = '') {
8282
const lowerCaseColorString = colorString.toLowerCase();
8383
return colorExceptions.indexOf(lowerCaseColorString) !== -1;
8484
}

0 commit comments

Comments
 (0)