'use strict'; const report = require('../../utils/report'); const ruleMessages = require('../../utils/ruleMessages'); const validateOptions = require('../../utils/validateOptions'); const ruleName = 'no-invalid-double-slash-comments'; const messages = ruleMessages(ruleName, { rejected: 'Unexpected double-slash CSS comment', }); const meta = { url: 'https://stylelint.io/user-guide/rules/list/no-invalid-double-slash-comments', }; /** @type {import('stylelint').Rule} */ const rule = (primary) => { return (root, result) => { const validOptions = validateOptions(result, ruleName, { actual: primary }); if (!validOptions) { return; } root.walkDecls((decl) => { if (decl.prop.startsWith('//')) { report({ message: messages.rejected, node: decl, result, ruleName, }); } }); root.walkRules((ruleNode) => { for (const selector of ruleNode.selectors) { if (selector.startsWith('//')) { report({ message: messages.rejected, node: ruleNode, result, ruleName, }); } } }); }; }; rule.ruleName = ruleName; rule.messages = messages; rule.meta = meta; module.exports = rule;