lint: Add custom lint check for console.log statements.

This was previously checked for by jslint, and eslint doesn't seem to
have a nice exclude rule for it.
This commit is contained in:
Tim Abbott 2016-12-02 18:49:30 -08:00
parent 1fb9220354
commit 8259adaba5
1 changed files with 8 additions and 1 deletions

View File

@ -138,7 +138,7 @@ def build_custom_checkers(by_lang):
continue
for rule in rules:
exclude_list = rule.get('exclude', set())
if fn in exclude_list:
if fn in exclude_list or os.path.dirname(fn) in exclude_list:
continue
exclude_list = rule.get('exclude_line', set())
if (fn, line_fully_stripped) in exclude_list:
@ -208,6 +208,13 @@ def build_custom_checkers(by_lang):
'description': 'Write JS else statements on same line as }'},
{'pattern': '^else if',
'description': 'Write JS else statements on same line as }'},
{'pattern': 'console[.][a-z]',
'exclude': set(['static/js/blueslip.js',
'frontend_tests/zjsunit',
'frontend_tests/casper_lib/common.js',
'frontend_tests/node_tests',
'static/js/debug.js']),
'description': 'console.log and similar should not be used in webapp'},
{'pattern': 'button\.text\(["\']',
'exclude': set(['tools/lint-all',
'frontend_tests/node_tests/templates.js']),