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}
This commit is contained in:
12
.eslintrc.js
12
.eslintrc.js
@ -27,6 +27,18 @@ module.exports = {
|
||||
'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',
|
||||
{
|
||||
|
@ -6,5 +6,9 @@ module.exports = {
|
||||
'rules' : {
|
||||
'comma-dangle' : ['error', 'always-multiline'],
|
||||
'no-console' : 'off',
|
||||
|
||||
// Turn off since there are too many imports of 'Polymer'. Remove if/when
|
||||
// everything under this folder is migrated to PolymerElement.
|
||||
'no-restricted-imports' : 'off',
|
||||
},
|
||||
};
|
||||
|
@ -5,5 +5,9 @@
|
||||
module.exports = {
|
||||
'rules' : {
|
||||
'eqeqeq' : 'off',
|
||||
|
||||
// Turn off since there are too many imports of 'Polymer'. Remove if/when
|
||||
// everything under this folder is migrated to PolymerElement.
|
||||
'no-restricted-imports': 'off',
|
||||
},
|
||||
};
|
||||
|
11
chrome/browser/resources/nearby_internals/.eslintrc.js
Normal file
11
chrome/browser/resources/nearby_internals/.eslintrc.js
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
module.exports = {
|
||||
'rules' : {
|
||||
// Remove if/when everything under this folder is migrated to
|
||||
// PolymerElement.
|
||||
'no-restricted-imports': 'off',
|
||||
},
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
module.exports = {
|
||||
'rules' : {
|
||||
// Turn off since there are many imports of 'Polymer'. Remove if/when
|
||||
// everything under this folder is migrated to PolymerElement.
|
||||
'no-restricted-imports': 'off',
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user