UNPKG

753 BJavaScriptView Raw
1'use strict';
2
3const isStandardSyntaxAtRule = require('../utils/isStandardSyntaxAtRule');
4const report = require('../utils/report');
5
6module.exports = function (options) {
7 options.root.walkAtRules((atRule) => {
8 if (!isStandardSyntaxAtRule(atRule)) {
9 return;
10 }
11
12 checkColon(
13 `@${atRule.name}${atRule.raws.afterName || ''}${atRule.params}`,
14 atRule.name.length,
15 atRule,
16 );
17 });
18
19 function checkColon(source, index, node) {
20 options.locationChecker({
21 source,
22 index,
23 err: (m) => {
24 if (options.fix) {
25 options.fix(node);
26
27 return;
28 }
29
30 report({
31 message: m,
32 node,
33 index,
34 result: options.result,
35 ruleName: options.checkedRuleName,
36 });
37 },
38 errTarget: `@${node.name}`,
39 });
40 }
41};