Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize lint vars output, improve messaging #25049

Merged
merged 3 commits into from
Dec 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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