tslint-immutable
Version:
TSLint rules to disable mutation in TypeScript.
19 lines • 809 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
var check_node_1 = require("./shared/check-node");
// tslint:disable-next-line:variable-name
exports.Rule = check_node_1.createCheckNodeRule(checkNode, "Unexpected loop, use map or reduce instead.");
function checkNode(node, _ctx) {
return node &&
(node.kind === ts.SyntaxKind.ForStatement ||
node.kind === ts.SyntaxKind.ForInStatement ||
node.kind === ts.SyntaxKind.ForOfStatement ||
node.kind === ts.SyntaxKind.WhileStatement ||
node.kind === ts.SyntaxKind.DoStatement)
? { invalidNodes: [check_node_1.createInvalidNode(node)] }
: {
invalidNodes: []
};
}
//# sourceMappingURL=noLoopStatementRule.js.map