From c5d640fe1c96aeaf27d5bccf22c6d6bceade05ad Mon Sep 17 00:00:00 2001 From: Bohdan L Date: Tue, 7 Apr 2015 17:17:45 +0300 Subject: [PATCH 1/2] Update Babel and ESLint to the latest versions --- .babelrc | 3 +++ package.json | 12 ++++++------ webpack.config.js | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..ce840ab86 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "stage": 0 +} \ No newline at end of file diff --git a/package.json b/package.json index c52fa49fc..17e10f6db 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "npm": ">= 2.1" }, "dependencies": { - "babel": "4.7.16", + "babel": "5.1.10", "bootstrap": "3.3.4", "eventemitter3": "0.1.6", "express": "4.12.3", @@ -24,14 +24,14 @@ }, "devDependencies": { "autoprefixer-loader": "^1.2.0", - "babel-core": "^4.7.16", - "babel-eslint": "^2.0.2", - "babel-loader": "^4.3.0", + "babel-core": "^5.1.10", + "babel-eslint": "^3.0.1", + "babel-loader": "^5.0.0", "browser-sync": "^2.5.3", "css-loader": "^0.10.1", "del": "^1.1.1", - "eslint": "^0.18.0", - "eslint-loader": "^0.9.0", + "eslint": "^0.19.0", + "eslint-loader": "^0.10.0", "git-push": "^0.1.0", "gulp": "^3.8.11", "gulp-autoprefixer": "^2.1.0", diff --git a/webpack.config.js b/webpack.config.js index fb2eaa3ab..2e5130cd6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -87,7 +87,7 @@ var config = { { test: /\.jsx?$/, exclude: /node_modules/, - loader: 'babel-loader?playground' + loader: 'babel-loader' } ] } From 58af610f1f8287991419a604e2ccd1124dbb13e4 Mon Sep 17 00:00:00 2001 From: Konstantin Tarkus Date: Thu, 16 Apr 2015 13:12:28 +0300 Subject: [PATCH 2/2] Update ESLint settings --- .eslintrc | 9 ++++++++- package.json | 1 + src/components/App/setViewport.js | 8 +++++--- src/components/ContentPage/ContentPage.js | 2 +- src/components/Navbar/Navbar.js | 4 ++-- src/components/NotFoundPage/NotFoundPage.js | 4 ++-- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.eslintrc b/.eslintrc index 43a2a517d..da85c8816 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,13 +1,20 @@ { "parser": "babel-eslint", + "plugins": [ + "react" + ], "env": { "browser": true, - "node": true + "node": true, + "es6": true }, "globals": { "__DEV__": true, "__SERVER__": true }, + "ecmaFeatures": { + "jsx": true + }, "rules": { // Strict mode "strict": [2, "never"], diff --git a/package.json b/package.json index 17e10f6db..7e95ac090 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "del": "^1.1.1", "eslint": "^0.19.0", "eslint-loader": "^0.10.0", + "eslint-plugin-react": "^2.1.0", "git-push": "^0.1.0", "gulp": "^3.8.11", "gulp-autoprefixer": "^2.1.0", diff --git a/src/components/App/setViewport.js b/src/components/App/setViewport.js index b2895feb7..67f025561 100644 --- a/src/components/App/setViewport.js +++ b/src/components/App/setViewport.js @@ -6,10 +6,10 @@ * LICENSE.txt file in the root directory of this source tree. */ -import React, { Component } from 'react'; +import React, { Component } from 'react'; // eslint-disable-line no-unused-vars import { canUseDOM } from 'react/lib/ExecutionEnvironment'; -export default function setViewport(ComposedComponent) { +function setViewport(ComposedComponent) { return class AppViewport extends Component { constructor() { @@ -45,4 +45,6 @@ export default function setViewport(ComposedComponent) { } }; -}; +} + +export default setViewport; diff --git a/src/components/ContentPage/ContentPage.js b/src/components/ContentPage/ContentPage.js index 2e87e4bc6..86ab94d3d 100644 --- a/src/components/ContentPage/ContentPage.js +++ b/src/components/ContentPage/ContentPage.js @@ -7,7 +7,7 @@ */ import './ContentPage.less'; -import React, { PropTypes } from 'react'; +import React, { PropTypes } from 'react'; // eslint-disable-line no-unused-vars class ContentPage { diff --git a/src/components/Navbar/Navbar.js b/src/components/Navbar/Navbar.js index c8bba43d2..4ac92b4c6 100644 --- a/src/components/Navbar/Navbar.js +++ b/src/components/Navbar/Navbar.js @@ -6,9 +6,9 @@ * LICENSE.txt file in the root directory of this source tree. */ -import React, { Component } from 'react'; +import React from 'react'; // eslint-disable-line no-unused-vars -class Navbar extends Component { +class Navbar { render() { return ( diff --git a/src/components/NotFoundPage/NotFoundPage.js b/src/components/NotFoundPage/NotFoundPage.js index 2b0a22df5..38cbc934d 100644 --- a/src/components/NotFoundPage/NotFoundPage.js +++ b/src/components/NotFoundPage/NotFoundPage.js @@ -7,9 +7,9 @@ */ //import './NotFoundPage.less'; -import React, { Component } from 'react'; +import React from 'react'; // eslint-disable-line no-unused-vars -class NotFoundPage extends Component { +class NotFoundPage { render() { return (