1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-01 10:17:42 -04:00
notes/node_modules/stylelint/lib/rules/selector-attribute-operator-space-after/index.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-03-09 13:16:08 -05:00
"use strict"
const ruleMessages = require("../../utils/ruleMessages")
const validateOptions = require("../../utils/validateOptions")
const whitespaceChecker = require("../../utils/whitespaceChecker")
const selectorAttributeOperatorSpaceChecker = require("../selectorAttributeOperatorSpaceChecker")
const ruleName = "selector-attribute-operator-space-after"
const messages = ruleMessages(ruleName, {
expectedAfter: operator => `Expected single space after "${operator}"`,
rejectedAfter: operator => `Unexpected whitespace after "${operator}"`,
})
const rule = function (expectation) {
return (root, result) => {
const checker = whitespaceChecker("space", expectation, messages)
const validOptions = validateOptions(result, ruleName, {
actual: expectation,
possible: [
"always",
"never",
],
})
if (!validOptions) {
return
}
selectorAttributeOperatorSpaceChecker({
root,
result,
locationChecker: checker.after,
checkedRuleName: ruleName,
checkBeforeOperator: false,
})
}
}
rule.ruleName = ruleName
rule.messages = messages
module.exports = rule