Skip to content

Commit 586a9a5

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
[eslint] Adopt ESLint Rule Naming Conventions.
Update our custom ESLint rules to follow the official naming conventions[^1], in particular the rule names need to 1. consistently use dashes to separate words (rather a mix of underscores and dashes), and 1. consistently use `no-` prefix for rules that disallow something. Drive-by-fix: Also remove the `fixable` setting from rules that don't provide a fix. This is a functionally neutral change. [^1]: https://eslint.org/docs/latest/contribute/core-rules#rule-naming-conventions Fixed: 386319581 Change-Id: Ifcb6c0e4ca8334a263be6534596c30b3bcca243b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6110726 Reviewed-by: Samiya Caur <[email protected]> Commit-Queue: Samiya Caur <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]> Auto-Submit: Benedikt Meurer <[email protected]>
1 parent 3b94868 commit 586a9a5

File tree

205 files changed

+298
-286
lines changed

Some content is hidden

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

205 files changed

+298
-286
lines changed

.eslintrc.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ module.exports = {
131131
'import/no-duplicates': 'error',
132132

133133
// Try to spot '// console.log()' left over from debugging
134-
'rulesdir/commented_out_console': 'error',
134+
'rulesdir/no-commented-out-console': 'error',
135135

136136
// Prevent imports being commented out rather than deleted.
137-
'rulesdir/commented_out_import': 'error',
137+
'rulesdir/no-commented-out-import': 'error',
138138

139139
// DevTools specific rules
140-
'rulesdir/es_modules_import': 'error',
141-
'rulesdir/check_license_header': 'error',
142-
'rulesdir/html_tagged_template': 'error',
140+
'rulesdir/es-modules-import': 'error',
141+
'rulesdir/check-license-header': 'error',
142+
'rulesdir/html-tagged-template': 'error',
143143
/**
144144
* Ensures that JS Doc comments are properly aligned - all the starting
145145
* `*` are in the right place.
@@ -195,10 +195,10 @@ module.exports = {
195195
*/
196196
'@typescript-eslint/no-non-null-assertion': 'error',
197197
'@typescript-eslint/consistent-type-imports': 'error',
198-
'rulesdir/no_underscored_properties': 'error',
199-
'rulesdir/prefer_readonly_keyword': 'error',
200-
'rulesdir/inline_type_imports': 'error',
201-
'rulesdir/enforce_default_import_name': ['error', {
198+
'rulesdir/no-underscored-properties': 'error',
199+
'rulesdir/prefer-readonly-keyword': 'error',
200+
'rulesdir/inline-type-imports': 'error',
201+
'rulesdir/enforce-default-import-name': ['error', {
202202
// Enforce that any import of models/trace/trace.js names the import Trace.
203203
modulePath: path.join(__dirname, 'front_end', 'models', 'trace', 'trace.js'),
204204
importName: 'Trace'
@@ -291,12 +291,12 @@ module.exports = {
291291
'mocha/no-global-tests': 'error',
292292
'mocha/no-nested-tests': 'error',
293293

294-
'rulesdir/check_test_definitions' : 'error',
295-
'rulesdir/avoid_assert_equal' : 'error',
296-
'rulesdir/no_repeated_tests' : 'error',
297-
'rulesdir/compare_arrays_with_assert_deepequal' : 'error',
298-
'rulesdir/ban_screenshot_test_outside_perf_panel' : 'error',
299-
'rulesdir/trace_engine_test_timeouts' : 'error',
294+
'rulesdir/check-test-definitions' : 'error',
295+
'rulesdir/no-assert-equal' : 'error',
296+
'rulesdir/no-repeated-tests' : 'error',
297+
'rulesdir/compare-arrays-with-assert-deepequal' : 'error',
298+
'rulesdir/no-screenshot-test-outside-perf-panel' : 'error',
299+
'rulesdir/trace-engine-test-timeouts' : 'error',
300300
'@typescript-eslint/no-non-null-assertion' : 'off',
301301
},
302302
settings: {

PRESUBMIT.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def _CheckDevToolsRunESLintTests(input_api, output_api):
209209

210210
mocha_path = devtools_paths.mocha_path()
211211
eslint_tests_path = input_api.os_path.join(eslint_rules_dir_path, 'tests',
212-
'*_test.js')
212+
'*.test.js')
213213

214214
results = [output_api.PresubmitNotifyResult('ESLint rules unit tests')]
215215
results.extend(

extensions/cxx_debugging/src/CreditsItem.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-
/* eslint-disable rulesdir/check_component_naming, rulesdir/no_underscored_properties, rulesdir/ban_style_tags_in_lit_html, rulesdir/ban_a_tags_in_lit_html, rulesdir/lit_html_host_this */
5+
/* eslint-disable rulesdir/check-component-naming, rulesdir/no-underscored-properties, rulesdir/no-style-tags-in-lit-html, rulesdir/no-a-tags-in-lit-html, rulesdir/lit-html-host-this */
66
import {html, render} from 'lit-html';
77

88
export type CreditsItemData = {

extensions/cxx_debugging/src/ExtensionOptions.ts

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

5-
/* eslint-disable rulesdir/check_component_naming */
6-
/* eslint-disable rulesdir/inject_checkbox_styles */
7-
/* eslint-disable rulesdir/lit_html_host_this */
5+
/* eslint-disable rulesdir/check-component-naming */
6+
/* eslint-disable rulesdir/inject-checkbox-styles */
7+
/* eslint-disable rulesdir/lit-html-host-this */
88

99
import './CreditsItem.js';
1010
import './ModuleConfigurationList.js';
1111

1212
import {html, render} from 'lit-html';
13-
import {until} from 'lit-html/directives/until.js'; // eslint-disable-line rulesdir/es_modules_import
13+
import {until} from 'lit-html/directives/until.js'; // eslint-disable-line rulesdir/es-modules-import
1414

1515
import {type CreditsItemData} from './CreditsItem.js';
1616
import {type Storage} from './DevToolsPluginHost.js';

extensions/cxx_debugging/src/ModuleConfigurationList.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-
/* eslint-disable rulesdir/check_component_naming, rulesdir/no_underscored_properties, rulesdir/ban_style_tags_in_lit_html, rulesdir/ban_a_tags_in_lit_html, rulesdir/lit_html_host_this, @typescript-eslint/naming-convention, @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-unused-vars */
5+
/* eslint-disable rulesdir/check-component-naming, rulesdir/no-underscored-properties, rulesdir/no-style-tags-in-lit-html, rulesdir/no-a-tags-in-lit-html, rulesdir/lit-html-host-this, @typescript-eslint/naming-convention, @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-unused-vars */
66

77
import {html, nothing, render} from 'lit-html';
88

extensions/cxx_debugging/tests/Formatters_test.ts

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

55
import {CustomFormatters, type TypeInfo} from '../src/CustomFormatters.js';
6-
import * as Formatters from '../src/Formatters.js'; // eslint-disable-line rulesdir/es_modules_import
6+
import * as Formatters from '../src/Formatters.js'; // eslint-disable-line rulesdir/es-modules-import
7+
78
import {TestValue, TestWasmInterface} from './TestUtils.js';
89

910
describe('Formatters', () => {

front_end/.eslintrc.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'scripts', 'eslint_rules',
1010
module.exports = {
1111
rules: {
1212
// L10n rules are only relevant in 'front_end'.
13-
'rulesdir/l10n_filename_matches': [
13+
'rulesdir/l10n-filename-matches': [
1414
'error', {
1515
rootFrontendDirectory: __dirname,
1616
}
1717
],
18-
'rulesdir/l10n_i18nString_call_only_with_uistrings': 'error',
19-
'rulesdir/l10n_no_i18nString_calls_module_instantiation': 'error',
20-
'rulesdir/l10n_no_locked_or_placeholder_only_phrase': 'error',
21-
'rulesdir/l10n_no_uistrings_export': 'error',
22-
'rulesdir/l10n_no_unused_message': 'error',
18+
'rulesdir/l10n-i18nString-call-only-with-uistrings': 'error',
19+
'rulesdir/l10n-no-i18nString-calls-module-instantiation': 'error',
20+
'rulesdir/l10n-no-locked-or-placeholder-only-phrase': 'error',
21+
'rulesdir/l10n-no-uistrings-export': 'error',
22+
'rulesdir/l10n-no-unused-message': 'error',
2323
},
2424
overrides: [
2525
{
@@ -32,25 +32,25 @@ module.exports = {
3232
allowIIFEs:true,
3333
},
3434
],
35-
'rulesdir/no_importing_images_from_src': 'error',
36-
'rulesdir/enforce_bound_render_for_schedule_render': 'error',
37-
'rulesdir/enforce_custom_event_names': 'error',
38-
'rulesdir/set_data_type_reference': 'error',
39-
'rulesdir/no_bound_component_methods': 'error',
40-
'rulesdir/lit_no_style_interpolation': 'error',
41-
'rulesdir/ban_self_closing_custom_element_tagnames': 'error',
42-
'rulesdir/ban_style_tags_in_lit_html': 'error',
43-
'rulesdir/ban_a_tags_in_lit_html': 'error',
44-
'rulesdir/check_css_import': 'error',
35+
'rulesdir/no-importing-images-from-src': 'error',
36+
'rulesdir/enforce-bound-render-for-schedule-render': 'error',
37+
'rulesdir/enforce-custom-event-names': 'error',
38+
'rulesdir/set-data-type-reference': 'error',
39+
'rulesdir/no-bound-component-methods': 'error',
40+
'rulesdir/lit-no-style-interpolation': 'error',
41+
'rulesdir/no-self-closing-custom-element-tagnames': 'error',
42+
'rulesdir/no-style-tags-in-lit-html': 'error',
43+
'rulesdir/no-a-tags-in-lit-html': 'error',
44+
'rulesdir/check-css-import': 'error',
4545
'rulesdir/enforce-optional-properties-last': 'error',
46-
'rulesdir/check_enumerated_histograms': 'error',
47-
'rulesdir/check_was_shown_methods': 'error',
48-
'rulesdir/static_custom_event_names': 'error',
49-
'rulesdir/lit_html_host_this': 'error',
50-
'rulesdir/lit_html_no_attribute_quotes': 'error',
51-
'rulesdir/lit_template_result_or_nothing': 'error',
52-
'rulesdir/inject_checkbox_styles': 'error',
53-
'rulesdir/jslog_context_list': 'error',
46+
'rulesdir/check-enumerated-histograms': 'error',
47+
'rulesdir/check-was-shown-methods': 'error',
48+
'rulesdir/static-custom-event-names': 'error',
49+
'rulesdir/lit-html-host-this': 'error',
50+
'rulesdir/lit-html-no-attribute-quotes': 'error',
51+
'rulesdir/lit-template-result-or-nothing': 'error',
52+
'rulesdir/inject-checkbox-styles': 'error',
53+
'rulesdir/jslog-context-list': 'error',
5454
}
5555
},
5656
{
@@ -74,21 +74,21 @@ module.exports = {
7474
{
7575
files: ['panels/**/components/*.ts', 'ui/components/**/*.ts', 'entrypoints/**/*.ts'],
7676
rules: {
77-
'rulesdir/use_private_class_members': 'error',
77+
'rulesdir/prefer-private-class-members': 'error',
7878
}
7979
},
8080
// TODO(crbug/1402569): Remove once LitElement is fully adopted.
8181
{
8282
files: ['panels/recorder/**/*.ts', 'panels/protocol_monitor/**/*.ts', 'ui/components/suggestion_input/*.ts'],
8383
rules: {
8484
// TODO(crbug/1402569): Reenable once https://github.com/microsoft/TypeScript/issues/48885 is closed.
85-
'rulesdir/use_private_class_members': 'off',
85+
'rulesdir/prefer-private-class-members': 'off',
8686
}
8787
},
8888
{
8989
files: ['generated/SupportedCSSProperties.js'],
9090
rules: {
91-
'rulesdir/jslog_context_list': 'error',
91+
'rulesdir/jslog-context-list': 'error',
9292
}
9393
}
9494
]

front_end/Images/rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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
4+
// eslint-disable-next-line rulesdir/es-modules-import
55
import {importMetaAssets} from '@web/rollup-plugin-import-meta-assets';
66
import {optimize} from 'svgo';
77

front_end/core/sdk/NetworkManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ export class ConditionsSerializer implements Serializer<Conditions, Conditions>
19721972
const parsed = JSON.parse(serialized);
19731973
return {
19741974
...parsed,
1975-
// eslint-disable-next-line rulesdir/l10n_i18nString_call_only_with_uistrings
1975+
// eslint-disable-next-line rulesdir/l10n-i18nString-call-only-with-uistrings
19761976
title: parsed.i18nTitleKey ? i18nLazyString(parsed.i18nTitleKey) : parsed.title,
19771977
};
19781978
}

front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
*/
3030

31-
/* eslint-disable rulesdir/use_private_class_members */
31+
/* eslint-disable rulesdir/prefer-private-class-members */
3232

3333
import * as i18n from '../../core/i18n/i18n.js';
3434
import * as Platform from '../../core/platform/platform.js';

0 commit comments

Comments
 (0)