mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
Bug: 1205825 Change-Id: I78ce8199dc599be1f1121e65b72b83a8f73733c4 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2878729 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Kriti Sapra <kritisapra@google.com>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
// Copyright 2021 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
'use strict';
|
|
|
|
/**
|
|
* @fileoverview Prevent usage of customElements.define() and use the helper
|
|
* function instead
|
|
*/
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
// ------------------------------------------------------------------------------
|
|
|
|
module.exports = {
|
|
meta: {
|
|
type: 'problem',
|
|
|
|
docs: {
|
|
description: 'Usage of customElements.define',
|
|
category: 'Possible Errors',
|
|
},
|
|
fixable: 'code',
|
|
schema: [] // no options
|
|
},
|
|
create: function(context) {
|
|
return {
|
|
MemberExpression(node) {
|
|
if (node.object.name === 'customElements' && node.property.name === 'define') {
|
|
context.report({
|
|
node,
|
|
message:
|
|
'do not use customElements.define() to define a component. Use the CustomElements.defineComponent() function in front_end/ui/components/helper instead.'
|
|
});
|
|
}
|
|
}
|
|
};
|
|
}
|
|
};
|