Skip to content
Snippets Groups Projects
Commit 485ab232 authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[linter] Warn on console.* and debugger statements

parent 8ba3a664
No related branches found
No related tags found
No related merge requests found
......@@ -176,7 +176,7 @@
function sendDoc(ts, doc) {
ts.server.request({files: [{type: "full", name: doc.name, text: docValue(ts, doc)}]}, function(error) {
if (error) console.error(error);
if (error) window.console.error(error);
else doc.changed = null;
});
}
......@@ -642,7 +642,7 @@
send({type: "getFile", err: String(err), text: text, id: data.id});
});
} else if (data.type == "debug") {
console.log(data.message);
window.console.log(data.message);
} else if (data.id && pending[data.id]) {
pending[data.id](data.err, data.body);
delete pending[data.id];
......
......@@ -99,6 +99,13 @@ function checkFile(fileName) {
},
ForStatement: function(node) {
checkReusedIndex(node);
},
MemberExpression: function(node) {
if (node.object.type == "Identifier" && node.object.name == "console" && !node.computed)
fail("Found console." + node.property.name, node.loc);
},
DebuggerStatement: function(node) {
fail("Found debugger statement", node.loc);
}
}, scopePasser);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment