Skip to content

Commit de07efa

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[eslint] Update lint to include .mjs files
EsLint support .mjs file by default now. But we exclude them from running previously in our script. Disabled the `es-modules-import` rule for our script folder as it's not relevant there. Added types comment to the EsLint rules. This should make it easier to build and understand the current rules. Bug: none Change-Id: I448efdb055c9cc107e3bced9b3febe5eb226bcf6 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6177719 Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]>
1 parent 8813805 commit de07efa

File tree

61 files changed

+202
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+202
-54
lines changed

eslint.config.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2025 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
26
import mochaPlugin from 'eslint-plugin-mocha';
37
import rulesdirPlugin from 'eslint-plugin-rulesdir';
@@ -248,10 +252,7 @@ export default [
248252
'rulesdir/no-commented-out-console': 'error',
249253
// Prevent imports being commented out rather than deleted.
250254
'rulesdir/no-commented-out-import': 'error',
251-
// DevTools specific rules
252-
'rulesdir/es-modules-import': 'error',
253255
'rulesdir/check-license-header': 'error',
254-
'rulesdir/html-tagged-template': 'error',
255256
/**
256257
* Ensures that JS Doc comments are properly aligned - all the starting
257258
* `*` are in the right place.
@@ -480,6 +481,7 @@ export default [
480481
files: ['scripts/**/*'],
481482
rules: {
482483
'no-console': 'off',
484+
'rulesdir/es-modules-import': 'off',
483485
},
484486
},
485487
{
@@ -531,6 +533,8 @@ export default [
531533
'rulesdir/lit-template-result-or-nothing': 'error',
532534
'rulesdir/inject-checkbox-styles': 'error',
533535
'rulesdir/jslog-context-list': 'error',
536+
'rulesdir/es-modules-import': 'error',
537+
'rulesdir/html-tagged-template': 'error',
534538
},
535539
},
536540
{

front_end/Images/rollup.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2021 The Chromium Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
// eslint-disable-next-line rulesdir/es-modules-import
54
import {importMetaAssets} from '@web/rollup-plugin-import-meta-assets';
65
import {optimize} from 'svgo';
76

inspector_overlay/css_grid_label_helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import {luminance} from '../front_end/core/common/ColorUtils.js'; // eslint-disable-line rulesdir/es-modules-import
5+
import {luminance} from '../front_end/core/common/ColorUtils.js';
66

77
import {type AreaBounds, type Bounds, createChild, type Position} from './common.js';
88
import {applyMatrixToPoint, parseHexa} from './highlight_common.js';

inspector_overlay/highlight_common.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2929
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

31-
// eslint-disable-next-line rulesdir/es-modules-import
3231
import {
3332
type Color4D,
3433
rgbaToHsla,

inspector_overlay/main.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
// found in the LICENSE file.
44

55
// @ts-ignore Importing CSS is handled in Rollup.
6-
import commonStyle from './common.css'; // eslint-disable-line rulesdir/es-modules-import
6+
import commonStyle from './common.css';
77
import {adoptStyleSheet} from './common.js';
88
import {gridStyle} from './highlight_grid_common.js';
99
import {DistancesOverlay} from './tool_distances.js';
1010
// @ts-ignore Importing CSS is handled in Rollup.
11-
import highlightGridStyle from './tool_grid.css'; // eslint-disable-line rulesdir/es-modules-import
11+
import highlightGridStyle from './tool_grid.css';
1212
// @ts-ignore Importing CSS is handled in Rollup.
13-
import highlightStyle from './tool_highlight.css'; // eslint-disable-line rulesdir/es-modules-import
13+
import highlightStyle from './tool_highlight.css';
1414
import {HighlightOverlay} from './tool_highlight.js';
1515
// @ts-ignore Importing CSS is handled in Rollup.
16-
import pausedStyle from './tool_paused.css'; // eslint-disable-line rulesdir/es-modules-import
16+
import pausedStyle from './tool_paused.css';
1717
import {PausedOverlay, type PausedToolMessage} from './tool_paused.js';
1818
import {PersistentOverlay, type PersistentToolMessage} from './tool_persistent.js';
1919
// @ts-ignore Importing CSS is handled in Rollup.
20-
import screenshotStyle from './tool_screenshot.css'; // eslint-disable-line rulesdir/es-modules-import
20+
import screenshotStyle from './tool_screenshot.css';
2121
import {ScreenshotOverlay, type ScreenshotToolMessage} from './tool_screenshot.js';
2222
// @ts-ignore Importing CSS is handled in Rollup.
23-
import sourceOrderStyle from './tool_source_order.css'; // eslint-disable-line rulesdir/es-modules-import
23+
import sourceOrderStyle from './tool_source_order.css';
2424
import {SourceOrderOverlay} from './tool_source_order.js';
2525
import {ViewportSizeOverlay} from './tool_viewport_size.js';
2626
// @ts-ignore Importing CSS is handled in Rollup.
27-
import wcoStyle from './tool_window_controls.css'; // eslint-disable-line rulesdir/es-modules-import
27+
import wcoStyle from './tool_window_controls.css';
2828
import {WindowControlsOverlay} from './tool_window_controls.js';
2929

3030
// @ts-ignore Importing CSS is handled in Rollup.

inspector_overlay/tool_highlight.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2929
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

31-
// eslint-disable-next-line rulesdir/es-modules-import
3231
import {
3332
contrastRatio,
3433
contrastRatioAPCA,

scripts/ai_assistance/to_tsv.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
65
// Converts a JSON results file into two TSV files: queries and responses.
76
// Usage: node to_tsv.mjs path/to/file.json
87

@@ -22,7 +21,7 @@ function formatRequest(request) {
2221
const lines = [
2322
...(request.chat_history || []).map(item => item.text),
2423
request.input,
25-
]
24+
];
2625
return lines.join('\n\n===\n\n');
2726
}
2827

scripts/eslint_rules/lib/canvas-context-tracking.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
'use strict';
66

7+
/**
8+
* @type {import('eslint').Rule.RuleModule}
9+
*/
710
module.exports = {
811
meta: {
912
type: 'problem',

scripts/eslint_rules/lib/check-css-import.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
const fs = require('fs');
1616
const path = require('path');
1717

18+
/**
19+
* @type {import('eslint').Rule.RuleModule}
20+
*/
1821
module.exports = {
1922
meta: {
2023
type: 'problem',

scripts/eslint_rules/lib/check-enumerated-histograms.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// found in the LICENSE file.
44
'use strict';
55

6+
/**
7+
* @type {import('eslint').Rule.RuleModule}
8+
*/
69
module.exports = {
710
meta: {
811
type: 'problem',

0 commit comments

Comments
 (0)