mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-06 12:01:40 +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>
34 lines
1.0 KiB
JavaScript
34 lines
1.0 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';
|
|
|
|
const rule = require('../lib/custom_element_component_definition.js');
|
|
const ruleTester = new (require('eslint').RuleTester)({
|
|
parserOptions: {ecmaVersion: 9, sourceType: 'module'},
|
|
});
|
|
|
|
ruleTester.run('custom_element_component_definition', rule, {
|
|
valid: [
|
|
{
|
|
code: `
|
|
ComponentHelpers.CustomElements.defineComponent('devtools-resources-frame-details-view', FrameDetailsReportView);
|
|
`,
|
|
filename: 'front_end/ui/components/component/file.ts',
|
|
},
|
|
],
|
|
|
|
invalid: [
|
|
{
|
|
code: `
|
|
customElements.define('devtools-data-grid', DataGrid);
|
|
`,
|
|
filename: 'front_end/ui/components/component/file.ts',
|
|
errors: [{
|
|
message:
|
|
'do not use customElements.define() to define a component. Use the CustomElements.defineComponent() function in front_end/ui/components/helper instead.'
|
|
}],
|
|
},
|
|
]
|
|
});
|