Skip to content

Commit

Permalink
Tidy up no-color-keywords logic
Browse files Browse the repository at this point in the history
  • Loading branch information
DanPurdy committed Aug 30, 2017
1 parent e31abb6 commit 9ee4330
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/rules/no-color-keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ var cssColors = yaml.safeLoad(fs.readFileSync(path.join(__dirname, '../../data',
* @returns {boolean} Whether the node is a valid type or not
*/
var checkValidParentType = function (node) {
if (node) {
return node.type === 'function' || node.type === 'variable' || node.type === 'customProperty';
if (node && (node.is('function') || node.is('variable') || node.is('customProperty'))) {
return false;
}

return false;
return true;
};

module.exports = {
Expand All @@ -30,7 +30,7 @@ module.exports = {

ast.traverseByType('value', function (node) {
node.traverse(function (elem, i, parent) {
if (elem.type === 'ident' && !checkValidParentType(parent)) {
if (elem.type === 'ident' && checkValidParentType(parent)) {
var index = cssColors.indexOf(elem.content.toLowerCase());

if (index !== -1) {
Expand Down

0 comments on commit 9ee4330

Please sign in to comment.