1 | "use strict";
|
2 |
|
3 | const isStandardSyntaxRule = require("../utils/isStandardSyntaxRule");
|
4 | const report = require("../utils/report");
|
5 | const styleSearch = require("style-search");
|
6 |
|
7 | module.exports = function(opts) {
|
8 | opts.root.walkRules(rule => {
|
9 | if (!isStandardSyntaxRule(rule)) {
|
10 | return;
|
11 | }
|
12 |
|
13 | const selector = rule.raws.selector
|
14 | ? rule.raws.selector.raw
|
15 | : rule.selector;
|
16 |
|
17 | styleSearch(
|
18 | {
|
19 | source: selector,
|
20 | target: ",",
|
21 | functionArguments: "skip"
|
22 | },
|
23 | match => {
|
24 | checkDelimiter(selector, match.startIndex, rule);
|
25 | }
|
26 | );
|
27 | });
|
28 |
|
29 | function checkDelimiter(source, index, node) {
|
30 | opts.locationChecker({
|
31 | source,
|
32 | index,
|
33 | err: m => {
|
34 | if (opts.fix && opts.fix(node, index)) {
|
35 | return;
|
36 | }
|
37 |
|
38 | report({
|
39 | message: m,
|
40 | node,
|
41 | index,
|
42 | result: opts.result,
|
43 | ruleName: opts.checkedRuleName
|
44 | });
|
45 | }
|
46 | });
|
47 | }
|
48 | };
|