Commit 3dde0f67 authored by Mark Banner's avatar Mark Banner
Browse files

Bug 1768031 - Add .mjs to ESLint rules. r=Gijs

parent 5fc5617a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ eslint:
    # ESLint infra handles its own path filtering, so just include cwd
    include: ['.']
    exclude: []
    extensions: ['js', 'jsm', 'jsx', 'html', 'xhtml', 'sjs']
    extensions: ['mjs', 'js', 'jsm', 'jsx', 'html', 'sjs', 'xhtml']
    support-files:
        - '**/.eslintrc.js'
        - '.eslintignore'
+7 −7
Original line number Diff line number Diff line
@@ -47,14 +47,8 @@ module.exports = {
        browser: false,
        "mozilla/jsm": true,
      },
      files: ["**/*.jsm", "**/*.jsm.js"],
      globals: {
        // Intl is defined in the browser environment, but that's disabled
        // for jsms, add it here manually.
        Intl: false,
      },
      files: ["**/*.mjs", "**/*.jsm", "**/*.jsm.js"],
      rules: {
        "mozilla/mark-exported-symbols-as-used": "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, and then include more directories elsewhere.
@@ -73,6 +67,12 @@ module.exports = {
        ],
      },
    },
    {
      files: ["**/*.jsm", "**/*.jsm.js"],
      rules: {
        "mozilla/mark-exported-symbols-as-used": "error",
      },
    },
    {
      env: {
        browser: false,
+3 −1
Original line number Diff line number Diff line
@@ -12,10 +12,12 @@ module.exports = {
  globals: {
    // These globals are hard-coded and available in .jsm scopes.
    // https://searchfox.org/mozilla-central/rev/ed212c79cfe86357e9a5740082b9364e7f6e526f/js/xpconnect/loader/mozJSComponentLoader.cpp#134-140
    // Although `debug` is allowed for jsm files, this is non-standard and something
    // we don't want to allow in mjs files. Hence it is not included here.
    atob: false,
    btoa: false,
    debug: false,
    dump: false,
    Intl: false,
    // The WebAssembly global is available in most (if not all) contexts where
    // JS can run. It's definitely available in JSMs. So even if this is not
    // the perfect place to add it, it's not wrong, and we can move it later.