Skip to content

Commit

Permalink
feat: support basic var and func hash
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOGo committed Sep 6, 2020
1 parent 873ab5d commit 2a097bc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import stylelint from 'stylelint'
import shortCSS from 'shortcss'

import {
validProperties, validOptions, expected, getTypes, getIgnoredKeywords, getIgnoredValues, getAutoFixFunc,
validProperties, validOptions, expected, getTypes, getIgnoredVariablesOrFunctions, getIgnoredKeywords, getIgnoredValues, getAutoFixFunc,
} from './lib/validation'
import defaults from './defaults'

Expand Down Expand Up @@ -190,12 +190,20 @@ const ruleFunction = (properties, options, context = {}) => (root, result) => {

// test variable
if (ignoreVariables) {
validVar = reVar.test(value) || cssLoaderValues.test(value)
const ignoreVariable = getIgnoredVariablesOrFunctions(ignoreVariables, property)

if (ignoreVariable) {
validVar = reVar.test(value) || cssLoaderValues.test(value)
}
}

// test function
if (ignoreFunctions && !validVar) {
validFunc = reFunc.test(value)
const ignoreFunction = getIgnoredVariablesOrFunctions(ignoreFunctions, property)

if (ignoreFunction) {
validFunc = reFunc.test(value)
}
}

// test keywords
Expand Down

0 comments on commit 2a097bc

Please sign in to comment.