Bug 1897770 - Improve .sjs file environment definitions in ESLint. r=frontend-codestyle-reviewers,extension-reviewers,Gijs

This stops sjs files from picking up the test environments/configurations which means they get just the sjs environment
which is what we want.

Differential Revision: https://phabricator.services.mozilla.com/D210928
This commit is contained in:
Mark Banner 2024-05-20 13:49:44 +00:00
parent 2972287e22
commit 82ae63cedb
6 changed files with 4 additions and 14 deletions

View File

@ -173,7 +173,7 @@ module.exports = {
{
...removeOverrides(xpcshellTestConfig),
files: testPaths.xpcshell.map(path => `${path}**`),
excludedFiles: ["**/*.jsm", "**/*.mjs"],
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
},
{
// If it is an xpcshell head file, we turn off global unused variable checks, as it
@ -212,7 +212,7 @@ module.exports = {
{
...removeOverrides(browserTestConfig),
files: testPaths.browser.map(path => `${path}**`),
excludedFiles: ["**/*.jsm", "**/*.mjs"],
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
},
{
...removeOverrides(mochitestTestConfig),
@ -226,7 +226,7 @@ module.exports = {
{
...removeOverrides(chromeTestConfig),
files: testPaths.chrome.map(path => `${path}**`),
excludedFiles: ["**/*.jsm", "**/*.mjs"],
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
},
{
env: {
@ -239,6 +239,7 @@ module.exports = {
...testPaths.mochitest.map(path => `${path}/**/*.js`),
...testPaths.chrome.map(path => `${path}/**/*.js`),
],
excludedFiles: ["**/*.jsm", "**/*.mjs", "**/*.sjs"],
},
{
// Some directories have multiple kinds of tests, and some rules

View File

@ -3,7 +3,6 @@
"use strict";
// eslint-disable-next-line mozilla/no-redeclare-with-import-autofix
const { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs"
);

View File

@ -3,7 +3,6 @@
"use strict";
// eslint-disable-next-line mozilla/no-redeclare-with-import-autofix
const { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs"
);

View File

@ -1,8 +1,5 @@
"use strict";
// In an SJS file we need to get the setTimeout bits ourselves, despite
// what eslint might think applies for browser tests.
// eslint-disable-next-line mozilla/no-redeclare-with-import-autofix
let { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs"
);

View File

@ -6,9 +6,6 @@
const DELAY = 2 * 1000; // Delay two seconds before completing the request.
// In an SJS file we need to get the setTimeout bits ourselves, despite
// what eslint might think applies for browser tests.
// eslint-disable-next-line mozilla/no-redeclare-with-import-autofix
let { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs"
);

View File

@ -1,6 +1,3 @@
// In an SJS file we need to get NetUtil ourselves, despite
// what eslint might think applies for browser tests.
// eslint-disable-next-line mozilla/no-redeclare-with-import-autofix
let { NetUtil } = ChromeUtils.importESModule(
"resource://gre/modules/NetUtil.sys.mjs"
);