.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / valueListCommaWhitespaceChecker.js
1 "use strict";
2
3 const isStandardSyntaxDeclaration = require("../utils/isStandardSyntaxDeclaration");
4 const isStandardSyntaxProperty = require("../utils/isStandardSyntaxProperty");
5 const report = require("../utils/report");
6 const styleSearch = require("style-search");
7
8 module.exports = function(opts) {
9   opts.root.walkDecls(decl => {
10     if (
11       !isStandardSyntaxDeclaration(decl) ||
12       !isStandardSyntaxProperty(decl.prop)
13     ) {
14       return;
15     }
16     styleSearch(
17       {
18         source: decl.toString(),
19         target: ",",
20         functionArguments: "skip"
21       },
22       match => {
23         checkComma(decl.toString(), match.startIndex, decl);
24       }
25     );
26   });
27
28   function checkComma(source, index, node) {
29     opts.locationChecker({
30       source,
31       index,
32       err: m => {
33         report({
34           message: m,
35           node,
36           index,
37           result: opts.result,
38           ruleName: opts.checkedRuleName
39         });
40       }
41     });
42   }
43 };