mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1771117 - Distingish between system (privileged) mjs files and non-system ones in ESLint. r=arai
Depends on D148754 Differential Revision: https://phabricator.services.mozilla.com/D148755
This commit is contained in:
parent
1bf65f3431
commit
3773d14fc7
@ -41,23 +41,29 @@ module.exports = {
|
||||
|
||||
overrides: [
|
||||
{
|
||||
// We don't have the general browser environment for jsm files, but we do
|
||||
// have our own special environments for them.
|
||||
// System mjs files and jsm files are not loaded in the browser scope,
|
||||
// so we turn that off for those. Though we do have our own special
|
||||
// environment for them.
|
||||
env: {
|
||||
browser: false,
|
||||
"mozilla/jsm": true,
|
||||
},
|
||||
files: ["**/*.mjs", "**/*.jsm", "**/*.jsm.js"],
|
||||
files: ["**/*.sys.mjs", "**/*.jsm", "**/*.jsm.js"],
|
||||
rules: {
|
||||
"mozilla/reject-top-level-await": "error",
|
||||
// Bug 1703953: We don't have a good way to check a file runs in a
|
||||
// privilieged context. Apply this for jsm files as we know those are
|
||||
// privilieged context. Apply this for these files as we know those are
|
||||
// privilieged, and then include more directories elsewhere.
|
||||
"mozilla/use-isInstance": "error",
|
||||
// TODO: Bug 1575506 turn `builtinGlobals` on here.
|
||||
// We can enable builtinGlobals for jsms due to their scopes.
|
||||
"no-redeclare": ["error", { builtinGlobals: false }],
|
||||
// JSM modules are far easier to check for no-unused-vars on a global scope,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["**/*.mjs", "**/*.jsm"],
|
||||
rules: {
|
||||
// Modules are far easier to check for no-unused-vars on a global scope,
|
||||
// than our content files. Hence we turn that on here.
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
|
Loading…
Reference in New Issue
Block a user