From 0d35afe4cff97c020ad1f3767903e793db686992 Mon Sep 17 00:00:00 2001
From: ido <idok@wix.com>
Date: Sun, 22 Nov 2015 12:22:01 +0200
Subject: [PATCH] fixed #72

---
 .eslintrc             |  8 ++++++--
 Gruntfile.js          |  2 +-
 package.json          | 12 ++++++------
 src/reactTemplates.js |  5 ++---
 src/utils.js          |  4 ++--
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index 0f96b32..870f9ce 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -6,6 +6,7 @@
         "no-restricted-syntax": [2, "WithStatement"],
         "no-negated-condition": 1,
         "lodash3/prop-shorthand": 2,
+        "lodash3/matches-shorthand": 2,
         "lodash3/matches-prop-shorthand": 2,
         "lodash3/prefer-chain": 2,
         "lodash3/preferred-alias": 2,
@@ -21,9 +22,12 @@
         "lodash3/prefer-invoke": 2,
         "lodash3/prefer-thru": 2,
         "lodash3/prefer-lodash-method": 0,
-        "lodash3/prefer-lodash-typecheck": 1,
-        "lodash3/no-commit": 1,
+        "lodash3/prefer-lodash-typecheck": 2,
+        "lodash3/no-commit": 2,
         "lodash3/prefer-get": [2, 3],
+        "lodash3/collection-return": 2,
+        "lodash3/prefer-matches": 2,
+        "lodash3/prefer-times": 2,
 
         "wix-editor/augmented-assignment": 1,
         "wix-editor/no-not-not": 1,
diff --git a/Gruntfile.js b/Gruntfile.js
index 8fff0d1..7020eb2 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -98,7 +98,6 @@ module.exports = function (grunt) {
         return eval(require('fs').readFileSync(file).toString()); // eslint-disable-line no-eval
     }
 
-    grunt.task.loadTasks('./internalTasks');
     grunt.loadNpmTasks('grunt-browserify');
     grunt.loadNpmTasks('grunt-contrib-watch');
     grunt.loadNpmTasks('grunt-contrib-requirejs');
@@ -107,6 +106,7 @@ module.exports = function (grunt) {
     grunt.loadNpmTasks('grunt-contrib-uglify');
 
     grunt.registerTask('default', ['eslint:all']);
+    grunt.registerTask('lint', ['eslint:all']);
     grunt.registerTask('test', ['node_tap']);
 
     grunt.registerTask('rt', function () {
diff --git a/package.json b/package.json
index 7aee8ca..604b8fb 100644
--- a/package.json
+++ b/package.json
@@ -31,24 +31,25 @@
     "cheerio": "^0.19.0",
     "css": "^2.2.1",
     "escodegen": "^1.7.0",
-    "esprima-harmony": "^7001.1.0-dev-harmony-fb",
+    "esprima-fb": "^15001.1001.0-dev-harmony-fb",
     "lodash": "^3.10.1",
     "optionator": "^0.6.0",
     "text-table": "^0.2.0"
   },
   "devDependencies": {
+    "babel-eslint": "^4.1.5",
     "brace": "^0.5.1",
     "brfs": "^1.4.1",
     "coveralls": "^2.11.4",
-    "eslint": "^1.9.0",
+    "eslint": "^1.10.1",
     "eslint-config-wix-editor": "0.0.1",
-    "eslint-plugin-lodash3": "^0.1.13",
-    "eslint-plugin-react": "^3.6.3",
+    "eslint-plugin-lodash3": "^0.2.0",
+    "eslint-plugin-react": "^3.10.0",
     "eslint-plugin-wix-editor": "^1.0.1",
     "grunt": "^0.4.5",
     "grunt-browserify": "^4.0.0",
     "grunt-contrib-requirejs": "^0.4.4",
-    "grunt-contrib-uglify": "^0.10.0",
+    "grunt-contrib-uglify": "^0.11.0",
     "grunt-contrib-watch": "^0.6.1",
     "grunt-eslint": "^17.3.1",
     "grunt-node-tap": "^0.1.61",
@@ -56,7 +57,6 @@
     "react": "^0.14.2",
     "react-dom": "^0.14.2",
     "react-native": "^0.11.4",
-    "react-templates": "^0.1.22",
     "tape": "^4.2.1"
   },
   "keywords": [
diff --git a/src/reactTemplates.js b/src/reactTemplates.js
index afba93b..dd4e320 100644
--- a/src/reactTemplates.js
+++ b/src/reactTemplates.js
@@ -1,7 +1,7 @@
 'use strict';
 var cheerio = require('cheerio');
 var _ = require('lodash');
-var esprima = require('esprima-harmony');
+var esprima = require('esprima-fb');
 var escodegen = require('escodegen');
 var reactDOMSupport = require('./reactDOMSupport');
 var reactNativeSupport = require('./reactNativeSupport');
@@ -505,7 +505,6 @@ function convertRT(html, reportContext, options) {
     var requirePaths = _(defines)
         .keys()
         .map(function (reqName) { return '"' + reqName + '"'; })
-        .value()
         .join(',');
     var requireVars = _.values(defines).join(',');
     var buildImport;
@@ -538,7 +537,7 @@ function convertRT(html, reportContext, options) {
 
 function parseJS(code) {
     try {
-        var tree = esprima.parse(code, {range: true, tokens: true, comment: true});
+        var tree = esprima.parse(code, {range: true, tokens: true, comment: true, sourceType: 'module'});
         tree = escodegen.attachComments(tree, tree.comments, tree.tokens);
         return escodegen.generate(tree, {comment: true});
     } catch (e) {
diff --git a/src/utils.js b/src/utils.js
index 2b07dde..acb0242 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -1,6 +1,6 @@
 'use strict';
 var _ = require('lodash');
-var esprima = require('esprima-harmony');
+var esprima = require('esprima-fb');
 var rtError = require('./RTCodeError');
 var RTCodeError = rtError.RTCodeError;
 
@@ -73,4 +73,4 @@ module.exports = {
     isStringOnlyCode: isStringOnlyCode,
     concatChildren: concatChildren,
     validate: validate
-};
\ No newline at end of file
+};