@coffeelint/cli
Version:
Lint your CoffeeScript
38 lines (30 loc) • 1.01 kB
JavaScript
(function() {
var NoSpaces, indentationRegex,
indexOf = [].indexOf;
indentationRegex = /\S/;
module.exports = NoSpaces = (function() {
class NoSpaces {
lintLine(line, lineApi) {
var indentation;
// Only check lines that have compiled tokens. This helps
// us ignore spaces in the middle of multi line strings, heredocs, etc.
// since they are all reduced to a single token whose line number
// is the start of the expression.
indentation = line.split(indentationRegex)[0];
if (lineApi.lineHasToken() && indexOf.call(indentation, '\ ') >= 0) {
return true;
} else {
return null;
}
}
};
NoSpaces.prototype.rule = {
type: 'style',
name: 'no_spaces',
level: 'ignore',
message: 'Line contains space indentation',
description: `This rule forbids spaces in indentation. It is disabled by default.`
};
return NoSpaces;
}).call(this);
}).call(this);