WebUI: Disallow usages of obsolete Polymer() syntax via ESLint checks.
The class based "extends PolymerElement" syntax has been the preferred
way for a very long time and the vast majority of the codebase is
already using it.
Added a couple exceptions for a few CrOS folders that still use the old
syntax, and otherwise disallowing any new usages via ESLint's
no-restricted-imports rule.
All violations discovered with the following command should have been
fixed or suppressed already.
git cl presubmit --files "*.js;*.ts"
Bug: 720034
Change-Id: I630dfbcfdbd1cab066e2faf145e6685ecb4693ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4412401
Reviewed-by: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: Cole Horvitz <colehorvitz@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128705}
diff --git a/.eslintrc.js b/.eslintrc.js
index 5eb65153..8ceccc2 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -27,6 +27,18 @@
'no-extra-boolean-cast': 'error',
'no-extra-semi': 'error',
'no-new-wrappers': 'error',
+ 'no-restricted-imports': ['error', {
+ 'paths': [{
+ 'name': 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js',
+ 'importNames': ['Polymer'],
+ 'message': 'Use PolymerElement instead.',
+ },
+ {
+ 'name': '//resources/polymer/v3_0/polymer/polymer_bundled.min.js',
+ 'importNames': ['Polymer'],
+ 'message': 'Use PolymerElement instead.',
+ }],
+ }],
'no-restricted-properties': [
'error',
{