Skip to content

Commit

Permalink
Improve lint vars output messaging (#25049)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed Dec 28, 2017
1 parent 57083c3 commit dd621e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/lint-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ function findUnusedVars(dir) {
// Array of all Sass variables
const variables = sassFilesString.match(/(^\$[a-zA-Z0-9_-]+[^:])/gm)

console.log(`There's a total of ${variables.length} variables.`)
console.log(`Found ${variables.length} total variables.`)

// Loop through each variable
variables.forEach((variable) => {
const re = new RegExp(regExpQuote(variable), 'g')
const count = (sassFilesString.match(re) || []).length

if (count === 1) {
console.log(`Variable "${variable}" is only used once!`)
console.log(`Variable "${variable}" is not being used.`)
unusedVarsFound = true
globalSuccess = false
}
Expand Down

0 comments on commit dd621e5

Please sign in to comment.