Bug 1881701 - Move ESLint ignores and test paths to be module files as well. r=frontend-codestyle-reviewers,devtools-reviewers,Gijs,nchevobbe

This completes the moving of all the top-level configuration files to be ES modules, and named similarily.

Differential Revision: https://phabricator.services.mozilla.com/D250403
This commit is contained in:
Mark Banner
2025-05-24 17:08:35 +00:00
committed by mbanner@mozilla.com
parent 05fa2d5325
commit 8bf730ccd9
7 changed files with 14 additions and 18 deletions

View File

@@ -987,8 +987,8 @@ tools/jprof/README.html
uriloader/exthandler/tests/mochitest/save_filenames.html uriloader/exthandler/tests/mochitest/save_filenames.html
############################################################################## ##############################################################################
# The list below is copied from .eslintrc-ignores.js. Prettier doesn't currently # The list below is copied from eslint-ignores.config.mjs. Prettier doesn't
# support multiple ignore files or dynamic ignore configurations. # currently support multiple ignore files or dynamic ignore configurations.
# When this is implemented, we'll update the configuration below (bug 1825508) # When this is implemented, we'll update the configuration below (bug 1825508)
############################################################################## ##############################################################################

View File

@@ -80,7 +80,7 @@ You should see errors and warnings in the gutter as shown in the screenshot belo
(when (string-match "^\\([a-z]+_\\)" base) (when (string-match "^\\([a-z]+_\\)" base)
(setq-local flycheck-temp-prefix (match-string 1 base)))) (setq-local flycheck-temp-prefix (match-string 1 base))))
(let ((base-dir (locate-dominating-file (buffer-file-name) (let ((base-dir (locate-dominating-file (buffer-file-name)
".eslintrc-ignores.js"))) "eslint-ignores.config.mjs")))
(when base-dir (when base-dir
(let ((eslint (expand-file-name (let ((eslint (expand-file-name
"tools/lint/eslint/node_modules/.bin/eslint" base-dir))) "tools/lint/eslint/node_modules/.bin/eslint" base-dir)))

View File

@@ -102,7 +102,7 @@ cycle.
* If you really can't match the directory name, e.g. like the * If you really can't match the directory name, e.g. like the
``browser/base/content/tests/*``, then you'll need to add a new entry in ``browser/base/content/tests/*``, then you'll need to add a new entry in
:searchfox:`.eslintrc-test-paths.js <.eslintrc-test-paths.js>`. :searchfox:`eslint-test-paths.config.mjs <eslint-test-paths.config.mjs>`.
Please do not add new cases of multiple types of tests within a single directory, Please do not add new cases of multiple types of tests within a single directory,
this is `difficult for ESLint to handle`_. Currently this may cause: this is `difficult for ESLint to handle`_. Currently this may cause:
@@ -116,7 +116,7 @@ This code should neither be linted nor formatted
* If it is a third-party piece of code, please add it to :searchfox:`ThirdPartyPaths.txt <tools/rewriting/ThirdPartyPaths.txt>`. * If it is a third-party piece of code, please add it to :searchfox:`ThirdPartyPaths.txt <tools/rewriting/ThirdPartyPaths.txt>`.
* If it is a generated file, please add it to :searchfox:`Generated.txt <tools/rewriting/Generated.txt>`. * If it is a generated file, please add it to :searchfox:`Generated.txt <tools/rewriting/Generated.txt>`.
* If intentionally invalid, please add it to :searchfox:`.eslintrc-ignores.js <.eslintrc-ignores.js>`. * If intentionally invalid, please add it to :searchfox:`eslint-ignores.config.mjs <eslint-ignores.config.mjs>`.
This code shouldn't be formatted This code shouldn't be formatted
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -134,7 +134,7 @@ See the `prettier ignore docs`_ for more information.
I have valid code that is failing the ``no-undef`` rule or can't be parsed I have valid code that is failing the ``no-undef`` rule or can't be parsed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Please do not add this to :searchfox:`.eslintrc-ignores.js <.eslintrc-ignores.js>`. Generally * Please do not add this to :searchfox:`eslint-ignores.config.mjs <eslint-ignores.config.mjs>`. Generally
this can be fixed, if the following tips don't help, please `seek help`_. this can be fixed, if the following tips don't help, please `seek help`_.
* If you are adding a new test directory, see the :ref:`section above <adding-tests>` * If you are adding a new test directory, see the :ref:`section above <adding-tests>`

View File

@@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* Files to exclude from ESLint. * Files to exclude from ESLint.
* *
@@ -20,7 +18,7 @@
* *
* @type {string[]} * @type {string[]}
*/ */
module.exports = [ export default [
// Include all js dot files. // Include all js dot files.
"!.*.js", "!.*.js",

View File

@@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// The `*testPaths` defined below for test paths are the main path formats we // The `*testPaths` defined below for test paths are the main path formats we
// prefer to support for tests as they are commonly used across the tree. // prefer to support for tests as they are commonly used across the tree.
@@ -469,7 +467,7 @@ incorrectly applied.
paths.add(path); paths.add(path);
} }
module.exports = { export default {
testPaths: { testPaths: {
browser: [...browserTestPaths, ...extraBrowserTestPaths], browser: [...browserTestPaths, ...extraBrowserTestPaths],
chrome: [...chromeTestPaths, ...extraChromeTestPaths], chrome: [...chromeTestPaths, ...extraChromeTestPaths],

View File

@@ -16,8 +16,8 @@ import globals from "globals";
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import globalIgnores from "./.eslintrc-ignores.js"; import globalIgnores from "./eslint-ignores.config.mjs";
import testPathsConfig from "./.eslintrc-test-paths.js"; import testPathsConfig from "./eslint-test-paths.config.mjs";
import repositoryGlobals from "./eslint-file-globals.config.mjs"; import repositoryGlobals from "./eslint-file-globals.config.mjs";
import rollouts from "./eslint-rollouts.config.mjs"; import rollouts from "./eslint-rollouts.config.mjs";
import subdirConfigs from "./eslint-subdirs.config.mjs"; import subdirConfigs from "./eslint-subdirs.config.mjs";

View File

@@ -8,7 +8,7 @@
# documentation and how to modify this file. # documentation and how to modify this file.
repo: mozilla-central repo: mozilla-central
created_at: '2021-10-14T12:50:40.073465' created_at: '2021-10-14T12:50:40.073465'
updated_at: '2025-05-07T01:05:49.262826+00:00' updated_at: '2025-05-21T09:20:14.661913+00:00'
export: export:
path: ./docs/mots/index.rst path: ./docs/mots/index.rst
format: rst format: rst
@@ -3997,7 +3997,7 @@ modules:
description: Aspects of JavaScript use such as language feature usage, tooling description: Aspects of JavaScript use such as language feature usage, tooling
such as lint configurations, formatting and naming style. such as lint configurations, formatting and naming style.
includes: includes:
- .eslintrc-test-paths.js - eslint*.config.mjs
- '**/.eslintrc*.js' - '**/.eslintrc*.js'
- tools/lint/eslint/**/* - tools/lint/eslint/**/*
- .prettier* - .prettier*
@@ -4567,5 +4567,5 @@ modules:
- Ryan Tilder - Ryan Tilder
group: dev-platform group: dev-platform
hashes: hashes:
config: 3825a00753e2baaf500e62ea796ece96149e6937 config: 417f5aa3364f94e036f02a3612a733ab3cc9884a
export: e1e1829b45285c4e3a60c73a99e323a033d64945 export: f91f79309801aa730bc99a9a1f2bc64db1e64718