Bug 1951365 - Add names to the unnamed configurations sections in eslint-plugin-mozilla. r=frontend-codestyle-reviewers,mossop
These make debugging configuration issues easier to handle. The top-level .eslintrc.js change is so that we use the configuration handling system in index.js to be able to filter out the name for the legacy configuration set-ups. Differential Revision: https://phabricator.services.mozilla.com/D240138
This commit is contained in:
13
.eslintrc.js
13
.eslintrc.js
@@ -4,10 +4,7 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const xpcshellTestConfig = require("eslint-plugin-mozilla/lib/configs/xpcshell-test.js");
|
||||
const browserTestConfig = require("eslint-plugin-mozilla/lib/configs/browser-test.js");
|
||||
const mochitestTestConfig = require("eslint-plugin-mozilla/lib/configs/mochitest-test.js");
|
||||
const chromeTestConfig = require("eslint-plugin-mozilla/lib/configs/chrome-test.js");
|
||||
const mozilla = require("eslint-plugin-mozilla");
|
||||
const globalIgnores = require("./.eslintrc-ignores.js");
|
||||
const { testPaths } = require("./.eslintrc-test-paths.js");
|
||||
const { rollouts } = require("./.eslintrc-rollouts.js");
|
||||
@@ -183,7 +180,7 @@ module.exports = {
|
||||
extends: ["plugin:mozilla/general-test"],
|
||||
},
|
||||
{
|
||||
...xpcshellTestConfig,
|
||||
...mozilla.configs["xpcshell-test"],
|
||||
files: testPaths.xpcshell.map(filePath => `${filePath}**`),
|
||||
excludedFiles: ["**/*.mjs", "**/*.sjs"],
|
||||
},
|
||||
@@ -222,12 +219,12 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
{
|
||||
...browserTestConfig,
|
||||
...mozilla.configs["browser-test"],
|
||||
files: testPaths.browser.map(filePath => `${filePath}**`),
|
||||
excludedFiles: ["**/*.mjs", "**/*.sjs"],
|
||||
},
|
||||
{
|
||||
...mochitestTestConfig,
|
||||
...mozilla.configs["mochitest-test"],
|
||||
files: testPaths.mochitest.map(filePath => `${filePath}**`),
|
||||
excludedFiles: [
|
||||
"**/*.mjs",
|
||||
@@ -235,7 +232,7 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
{
|
||||
...chromeTestConfig,
|
||||
...mozilla.configs["chrome-test"],
|
||||
files: testPaths.chrome.map(filePath => `${filePath}**`),
|
||||
excludedFiles: ["**/*.mjs", "**/*.sjs"],
|
||||
},
|
||||
|
||||
@@ -56,6 +56,7 @@ module.exports = {
|
||||
waitForFocus: false,
|
||||
},
|
||||
|
||||
name: "mozilla/browser-test",
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
|
||||
@@ -18,6 +18,7 @@ module.exports = {
|
||||
getRootDirectory: false,
|
||||
},
|
||||
|
||||
name: "mozilla/chrome-test",
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
name: "mozilla/general-test",
|
||||
plugins: ["mozilla", "@microsoft/sdl", "no-unsanitized"],
|
||||
|
||||
rules: {
|
||||
|
||||
@@ -12,6 +12,7 @@ module.exports = {
|
||||
SpecialPowers: false,
|
||||
},
|
||||
|
||||
name: "mozilla/mochitest-test",
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
|
||||
@@ -320,6 +320,7 @@ const extraRules = [
|
||||
// "worker" as well.
|
||||
"**/?(*.)worker.?(m)js",
|
||||
],
|
||||
name: "mozilla/recommended/worker",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
name: "mozilla/require-jsdoc",
|
||||
plugins: ["jsdoc"],
|
||||
|
||||
rules: {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
name: "mozilla/valid-jsdoc",
|
||||
plugins: ["jsdoc"],
|
||||
|
||||
rules: {
|
||||
|
||||
@@ -7,6 +7,7 @@ module.exports = {
|
||||
"mozilla/xpcshell": true,
|
||||
},
|
||||
|
||||
name: "mozilla/xpcshell-test",
|
||||
plugins: ["mozilla", "@microsoft/sdl"],
|
||||
|
||||
rules: {
|
||||
|
||||
@@ -115,6 +115,9 @@ const configurations = [
|
||||
function cloneLegacySection(section) {
|
||||
let config = structuredClone(section);
|
||||
|
||||
// The legacy config doesn't support names, so get rid of those.
|
||||
delete config.name;
|
||||
|
||||
if (config.overrides) {
|
||||
for (let overridesSection of config.overrides) {
|
||||
// The legacy config doesn't support names in sections, so get rid of those.
|
||||
@@ -155,6 +158,11 @@ function cloneFlatSection(section) {
|
||||
config.languageOptions = {};
|
||||
}
|
||||
|
||||
if (config.globals) {
|
||||
config.languageOptions.globals = { ...config.globals };
|
||||
delete config.globals;
|
||||
}
|
||||
|
||||
// Handle changing the location of the sourceType.
|
||||
if (config.parserOptions?.sourceType) {
|
||||
config.languageOptions.sourceType = config.parserOptions.sourceType;
|
||||
|
||||
Reference in New Issue
Block a user