Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4434)

Unified Diff: chrome/browser/web_dev_style/js_checker.py

Issue 2209053002: Add a presubmit check for element.$.localId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stricter Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/web_dev_style/js_checker_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_dev_style/js_checker.py
diff --git a/chrome/browser/web_dev_style/js_checker.py b/chrome/browser/web_dev_style/js_checker.py
index a32821727729842c69b53182c329e5c5850d7189..d3306a946722d182f989b75aef833ab34a2b45ea 100644
--- a/chrome/browser/web_dev_style/js_checker.py
+++ b/chrome/browser/web_dev_style/js_checker.py
@@ -55,6 +55,11 @@ class JSChecker(object):
return self.RegexCheck(i, line, r"\* (@inheritDoc)",
"@inheritDoc is deprecated, use @override instead")
+ def PolymerLocalIdCheck(self, i, line):
+ """Checks for use of element.$.localId."""
+ return self.RegexCheck(i, line, r"(?<!this)(\.\$)[\[\.]",
+ "Please only use this.$.localId, not element.$.localId")
+
def WrapperTypeCheck(self, i, line):
"""Check for wrappers (new String()) instead of builtins (string)."""
return self.RegexCheck(i, line,
@@ -228,6 +233,7 @@ class JSChecker(object):
self.EndJsDocCommentCheck(i, line),
self.ExtraDotInGenericCheck(i, line),
self.InheritDocCheck(i, line),
+ self.PolymerLocalIdCheck(i, line),
self.WrapperTypeCheck(i, line),
self.VarNameCheck(i, line),
])
« no previous file with comments | « no previous file | chrome/browser/web_dev_style/js_checker_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698