mirror of https://github.com/zulip/zulip.git
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:
parent
1fb9220354
commit
8259adaba5
|
@ -138,7 +138,7 @@ def build_custom_checkers(by_lang):
|
||||||
continue
|
continue
|
||||||
for rule in rules:
|
for rule in rules:
|
||||||
exclude_list = rule.get('exclude', set())
|
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
|
continue
|
||||||
exclude_list = rule.get('exclude_line', set())
|
exclude_list = rule.get('exclude_line', set())
|
||||||
if (fn, line_fully_stripped) in exclude_list:
|
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 }'},
|
'description': 'Write JS else statements on same line as }'},
|
||||||
{'pattern': '^else if',
|
{'pattern': '^else if',
|
||||||
'description': 'Write JS else statements on same line as }'},
|
'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\(["\']',
|
{'pattern': 'button\.text\(["\']',
|
||||||
'exclude': set(['tools/lint-all',
|
'exclude': set(['tools/lint-all',
|
||||||
'frontend_tests/node_tests/templates.js']),
|
'frontend_tests/node_tests/templates.js']),
|
||||||
|
|
Loading…
Reference in New Issue