зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1917532 - Remove overrides sections from *-test configurations in eslint-plugin-mozilla. r=frontend-codestyle-reviewers,mossop
ESLint v9 doesn't support overrides/file specification in the configurations, so we don't want these now. The top-level configuration already strips out the overrides for these and handles them separately, so there's nothing to add - simply remove the 'removeOverrides' function. Differential Revision: https://phabricator.services.mozilla.com/D221447
This commit is contained in:
Родитель
533bbce8a6
Коммит
2387ca3533
23
.eslintrc.js
23
.eslintrc.js
|
@ -14,21 +14,6 @@ const { rollouts } = require("./.eslintrc-rollouts.js");
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
/**
|
||||
* Some configurations have overrides, which can't be specified within overrides,
|
||||
* so we need to remove them.
|
||||
*
|
||||
* @param {object} config
|
||||
* The configuration to remove overrides from.
|
||||
* @returns {object}
|
||||
* The new configuration.
|
||||
*/
|
||||
function removeOverrides(config) {
|
||||
config = { ...config };
|
||||
delete config.overrides;
|
||||
return config;
|
||||
}
|
||||
|
||||
function readFile(filePath) {
|
||||
return fs
|
||||
.readFileSync(filePath, { encoding: "utf-8" })
|
||||
|
@ -153,7 +138,7 @@ module.exports = {
|
|||
extends: ["plugin:mozilla/general-test"],
|
||||
},
|
||||
{
|
||||
...removeOverrides(xpcshellTestConfig),
|
||||
...xpcshellTestConfig,
|
||||
files: testPaths.xpcshell.map(filePath => `${filePath}**`),
|
||||
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
|
||||
},
|
||||
|
@ -192,12 +177,12 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
{
|
||||
...removeOverrides(browserTestConfig),
|
||||
...browserTestConfig,
|
||||
files: testPaths.browser.map(filePath => `${filePath}**`),
|
||||
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
|
||||
},
|
||||
{
|
||||
...removeOverrides(mochitestTestConfig),
|
||||
...mochitestTestConfig,
|
||||
files: testPaths.mochitest.map(filePath => `${filePath}**`),
|
||||
excludedFiles: [
|
||||
"**/*.jsm",
|
||||
|
@ -206,7 +191,7 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
{
|
||||
...removeOverrides(chromeTestConfig),
|
||||
...chromeTestConfig,
|
||||
files: testPaths.chrome.map(filePath => `${filePath}**`),
|
||||
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
|
||||
},
|
||||
|
|
|
@ -6,7 +6,6 @@ module.exports = {
|
|||
browser: true,
|
||||
"mozilla/browser-window": true,
|
||||
"mozilla/simpletest": true,
|
||||
// "node": true
|
||||
},
|
||||
|
||||
// All globals made available in the test environment.
|
||||
|
@ -57,19 +56,6 @@ module.exports = {
|
|||
waitForFocus: false,
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{
|
||||
// Some directories have multiple kinds of tests, and some rules
|
||||
// don't work well for plain mochitests, so disable those.
|
||||
files: ["*.html", "*.xhtml"],
|
||||
// plain/chrome mochitests don't automatically include Assert, so
|
||||
// autofixing `ok()` to Assert.something is bad.
|
||||
rules: {
|
||||
"mozilla/no-comparison-or-assignment-inside-ok": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
|
|
|
@ -18,18 +18,6 @@ module.exports = {
|
|||
getRootDirectory: false,
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{
|
||||
env: {
|
||||
// Ideally we wouldn't be using the simpletest env here, but our uses of
|
||||
// js files mean we pick up everything from the global scope, which could
|
||||
// be any one of a number of html files. So we just allow the basics...
|
||||
"mozilla/simpletest": true,
|
||||
},
|
||||
files: ["*.js"],
|
||||
},
|
||||
],
|
||||
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
|
|
|
@ -12,17 +12,6 @@ module.exports = {
|
|||
SpecialPowers: false,
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{
|
||||
env: {
|
||||
// Ideally we wouldn't be using the simpletest env here, but our uses of
|
||||
// js files mean we pick up everything from the global scope, which could
|
||||
// be any one of a number of html files. So we just allow the basics...
|
||||
"mozilla/simpletest": true,
|
||||
},
|
||||
files: ["*.js"],
|
||||
},
|
||||
],
|
||||
plugins: ["mozilla"],
|
||||
|
||||
rules: {
|
||||
|
|
|
@ -8,47 +8,6 @@ module.exports = {
|
|||
"mozilla/xpcshell": true,
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{
|
||||
// Some directories have multiple kinds of tests, and some rules
|
||||
// don't work well for plain mochitests, so disable those.
|
||||
files: ["*.html", "*.xhtml"],
|
||||
// plain/chrome mochitests don't automatically include Assert, so
|
||||
// autofixing `ok()` to Assert.something is bad.
|
||||
rules: {
|
||||
"mozilla/no-comparison-or-assignment-inside-ok": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
// If it is a head file, we turn off global unused variable checks, as it
|
||||
// would require searching the other test files to know if they are used or not.
|
||||
// This would be expensive and slow, and it isn't worth it for head files.
|
||||
// We could get developers to declare as exported, but that doesn't seem worth it.
|
||||
files: "head*.js",
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "local",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
// No declaring variables that are never used
|
||||
files: "test*.js",
|
||||
rules: {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
vars: "all",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
plugins: ["mozilla", "@microsoft/sdl"],
|
||||
|
||||
rules: {
|
||||
|
|
Загрузка…
Ссылка в новой задаче