mirror of
https://github.com/thangisme/notes.git
synced 2025-09-24 02:34:12 -04:00
Initial commit
This commit is contained in:
49
node_modules/stylelint/lib/rules/comment-no-empty/index.js
generated
vendored
Normal file
49
node_modules/stylelint/lib/rules/comment-no-empty/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict"
|
||||
|
||||
const report = require("../../utils/report")
|
||||
const ruleMessages = require("../../utils/ruleMessages")
|
||||
const validateOptions = require("../../utils/validateOptions")
|
||||
|
||||
const ruleName = "comment-no-empty"
|
||||
|
||||
const messages = ruleMessages(ruleName, {
|
||||
rejected: "Unexpected empty comment",
|
||||
})
|
||||
|
||||
const rule = function (actual) {
|
||||
return (root, result) => {
|
||||
const validOptions = validateOptions(result, ruleName, { actual })
|
||||
if (!validOptions) {
|
||||
return
|
||||
}
|
||||
|
||||
root.walkComments(comment => {
|
||||
// To ignore inline SCSS comments
|
||||
if (
|
||||
comment.raws.inline
|
||||
|| comment.inline
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
// To ignore comments that are not empty
|
||||
if (
|
||||
comment.text
|
||||
&& comment.text.length !== 0
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
report({
|
||||
message: messages.rejected,
|
||||
node: comment,
|
||||
result,
|
||||
ruleName,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
rule.ruleName = ruleName
|
||||
rule.messages = messages
|
||||
module.exports = rule
|
Reference in New Issue
Block a user