1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-01 08:17:34 -04:00
notes/node_modules/stylelint/lib/rules/selector-no-empty/index.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

52 lines
1.1 KiB
JavaScript

"use strict"
const report = require("../../utils/report")
const ruleMessages = require("../../utils/ruleMessages")
const validateOptions = require("../../utils/validateOptions")
const ruleName = "selector-no-empty"
const messages = ruleMessages(ruleName, {
rejected: "Unexpected empty selector",
})
const rule = function (actual) {
return (root, result) => {
const validOptions = validateOptions(result, ruleName, { actual })
if (!validOptions) {
return
}
result.warn((
"'selector-no-empty' has been deprecated and in 8.0 will be removed."
), {
stylelintType: "deprecation",
stylelintReference: "https://stylelint.io/user-guide/rules/selector-no-empty/",
})
root.walkRules(rule => {
let index = 0
rule.selector.split(",").forEach(item => {
index += item.length + 1
if (item.trim() !== "") {
return
}
report({
message: messages.rejected,
node: rule,
index: index - 1,
ruleName,
result,
})
})
})
}
}
rule.ruleName = ruleName
rule.messages = messages
module.exports = rule