coffeelint-never-use-strict
Version:
CoffeeLint rule that enforces usage of strict mode
36 lines (28 loc) • 1.11 kB
JavaScript
// Generated by CoffeeScript 1.12.7
(function() {
var NeverUseStrict;
NeverUseStrict = (function() {
function NeverUseStrict() {}
NeverUseStrict.prototype.rule = {
name: "strict",
level: "error",
message: "Missing \"use strict\" statement",
description: "This rule triggers for each file that begins with \"use strict\"\n\nSee also https://www.npmjs.com/package/coffeelint-always-use-strict"
};
NeverUseStrict.prototype.lintAST = function(arg, arg1) {
var createError, expressions, first, ref;
expressions = arg.expressions;
createError = arg1.createError;
first = expressions[0];
if (first.constructor.name === "Value" && first.base.constructor.name === "StringLiteral" && ((ref = first.base.value) === '"use strict"' || ref === "'use strict'")) {
this.errors.push(createError({
lineNumber: first.locationData.first_line + 1,
message: "\"use strict\" is not allowed"
}));
}
return void 0;
};
return NeverUseStrict;
})();
module.exports = NeverUseStrict;
}).call(this);