From e32dd53cd9f9388ffea45fd84a8f73b92ccea334 Mon Sep 17 00:00:00 2001 From: Shubham Padia Date: Mon, 4 Jun 2018 01:30:04 +0530 Subject: [PATCH] lint: Check for occurrences of `.includes` except in `frontend_tests/`. Adds a custom check to js_rules in `/tools/lint/lib/custom_check.py`. --- tools/linter_lib/custom_check.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py index 67e5178c75..33ad30e7e1 100644 --- a/tools/linter_lib/custom_check.py +++ b/tools/linter_lib/custom_check.py @@ -188,6 +188,9 @@ def build_custom_checkers(by_lang): 'description': 'Do not concatenate i18n strings'}, {'pattern': '\+.*i18n\.t\(.+\)', 'description': 'Do not concatenate i18n strings'}, + {'pattern': '[.]includes[(]', + 'exclude': ['frontend_tests/'], + 'description': '.includes() is incompatible with Internet Explorer. Use .indexOf() !== -1 instead.'}, {'pattern': '[.]html[(]', 'exclude_pattern': '[.]html[(]("|\'|templates|html|message.content|sub.rendered_description|i18n.t|rendered_|$|[)]|error_text|widget_elem|[$]error|[$][(]"

"[)])', 'exclude': ['static/js/portico', 'static/js/lightbox.js', 'static/js/ui_report.js',