Bug 1357702 - Make eslint-plugin-spidermonkey-js handle paths correct on Windows to avoid Unexpected character issues on ESLint. r=mossop
authorMark Banner <standard8@mozilla.com>
Wed, 19 Apr 2017 12:17:14 +0100
changeset 354027 368a60db302d15951ca884732014f947dacadf4a
parent 354026 7ce95e24c0110c93ec1e4971922be456007bbc27
child 354028 3864467a616c7ac6e4801b8860ec38177f0d09f7
push id31685
push userkwierso@gmail.com
push dateThu, 20 Apr 2017 21:45:29 +0000
treeherdermozilla-central@5e3dc7e1288a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1357702
milestone55.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 1357702 - Make eslint-plugin-spidermonkey-js handle paths correct on Windows to avoid Unexpected character issues on ESLint. r=mossop MozReview-Commit-ID: LsQCgBOgceY
tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/processors/self-hosted.js
tools/lint/eslint/eslint-plugin-spidermonkey-js/package.json
--- a/tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/processors/self-hosted.js
+++ b/tools/lint/eslint/eslint-plugin-spidermonkey-js/lib/processors/self-hosted.js
@@ -3,21 +3,26 @@
  *
  * 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";
 
+var path = require("path");
+
 const selfHostedRegex = /js\/src\/(?:builtin|shell)\/.*?\.js$/;
 const macroRegex = /\s*\#(if|ifdef|else|elif|endif|include|define|undef).*/;
 
 module.exports = {
   preprocess(text, filename) {
+    if (path.win32) {
+      filename = filename.split(path.sep).join("/");
+    }
     if (!selfHostedRegex.test(filename)) {
       return [text];
     }
 
     let lines = text.split(/\n/);
     for (let i = 0; i < lines.length; i++) {
       if (!macroRegex.test(lines[i])) {
         // No macro here, nothing to do.
--- a/tools/lint/eslint/eslint-plugin-spidermonkey-js/package.json
+++ b/tools/lint/eslint/eslint-plugin-spidermonkey-js/package.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-spidermonkey-js",
-  "version": "0.1.0",
+  "version": "0.1.1",
   "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla SpiderMonkey project.",
   "keywords": [
     "eslint",
     "eslintplugin",
     "eslint-plugin",
     "mozilla",
     "spidermonkey"
   ],