Sha256: c48f0dd546a4781c637509201cc0c412ac16eb2680fdbd80716895c541b6fcba
Contents?: true
Size: 988 Bytes
Versions: 2
Compression:
Stored size: 988 Bytes
Contents
/** * @fileoverview Rule to count multiple spaces in regular expressions * @author Matt DuVall <http://www.mattduvall.com/> */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = function(context) { return { "Literal": function(node) { var token = context.getFirstToken(node), nodeType = token.type, nodeValue = token.value, multipleSpacesRegex = /( {2,})+?/, regexResults; if (nodeType === "RegularExpression") { regexResults = multipleSpacesRegex.exec(nodeValue); if (regexResults !== null) { context.report(node, "Spaces are hard to count. Use {" + regexResults[0].length + "}."); } } } }; }; module.exports.schema = [];
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eslint_node_modules-1.6.0.1 | vendor/node_modules/eslint/lib/rules/no-regex-spaces.js |
eslint_node_modules-1.6.0 | vendor/node_modules/eslint/lib/rules/no-regex-spaces.js |