Bug 1340146 - Process js/src/shell JavaScript files as self-hosted in eslint plugin. r=evilpie
☠☠ backed out by cf4daf78f479 ☠ ☠
authorAndré Bargull <andre.bargull@gmail.com>
Mon, 27 Feb 2017 09:55:21 -0800
changeset 394112 5556b171034ea8c0c458917bf4c4356c49ceda69
parent 394111 c355a0ffcb10bdc459e56dde715f4b2c3335c90c
child 394113 dbe72cd317e29cc7805cba0b7d8eca653a291dc6
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1340146
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1340146 - Process js/src/shell JavaScript files as self-hosted in eslint plugin. r=evilpie
js/src/shell/.eslintrc.js
js/src/shell/ModuleLoader.js
tools/lint/eslint/eslint-plugin-mozilla/lib/processors/self-hosted.js
new file mode 100644
--- /dev/null
+++ b/js/src/shell/.eslintrc.js
@@ -0,0 +1,12 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../toolkit/.eslintrc.js"
+  ],
+
+  "rules": {
+    // SpiderMonkey's style doesn't match any of the possible options.
+    "brace-style": "off",
+  }
+};
--- a/js/src/shell/ModuleLoader.js
+++ b/js/src/shell/ModuleLoader.js
@@ -1,12 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* global getModuleLoadPath setModuleResolveHook parseModule os */
+
 // A basic synchronous module loader for testing the shell.
 {
 // Save standard built-ins before scripts can modify them.
 const ArrayPrototypeJoin = Array.prototype.join;
 const MapPrototypeGet = Map.prototype.get;
 const MapPrototypeHas = Map.prototype.has;
 const MapPrototypeSet = Map.prototype.set;
 const ObjectDefineProperty = Object.defineProperty;
@@ -49,20 +51,23 @@ const ReflectLoader = new class {
 
         // Remove the drive letter, if present.
         let isalpha = c => ("A" <= c && c <= "Z") || ("a" <= c && c <= "z");
         let drive = "";
         if (path.length > 2 && isalpha(path[0]) && path[1] === ":" && path[2] === "\\") {
             drive = ReflectApply(StringPrototypeSubstring, path, [0, 2]);
             path = ReflectApply(StringPrototypeSubstring, path, [2]);
         }
+#endif
 
-        const pathsep = "\\";
+        const pathsep =
+#ifdef XP_WIN
+        "\\";
 #else
-        const pathsep = "/";
+        "/";
 #endif
 
         let n = 0;
         let components = [];
 
         // Normalize the path by removing redundant path components.
         // NB: See above for why we don't call String.prototype.split here.
         let lastSep = 0;
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/processors/self-hosted.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/processors/self-hosted.js
@@ -3,17 +3,17 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 "use strict";
 
-const selfHostedRegex = /js\/src\/builtin\/.*?\.js$/;
+const selfHostedRegex = /js\/src\/(?:builtin|shell)\/.*?\.js$/;
 const macroRegex = /\s*\#(if|ifdef|else|elif|endif|include|define|undef).*/;
 
 module.exports = {
   preprocess: function(text, filename) {
     if (!selfHostedRegex.test(filename)) {
       return [text];
     }