1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | module.exports = function(context) {
|
13 |
|
14 | return {
|
15 |
|
16 | "Literal": function(node) {
|
17 | var token = context.getFirstToken(node),
|
18 | nodeType = token.type,
|
19 | nodeValue = token.value,
|
20 | multipleSpacesRegex = /( {2,})+?/,
|
21 | regexResults;
|
22 |
|
23 | if (nodeType === "RegularExpression") {
|
24 | regexResults = multipleSpacesRegex.exec(nodeValue);
|
25 |
|
26 | if (regexResults !== null) {
|
27 | context.report(node, "Spaces are hard to count. Use {" + regexResults[0].length + "}.");
|
28 | }
|
29 | }
|
30 | }
|
31 | };
|
32 |
|
33 | };
|
34 |
|
35 | module.exports.schema = [];
|