From 52f437b28a6b76133ef8951bac1077c14cf81d9d Mon Sep 17 00:00:00 2001 From: Jacob Walton Date: Thu, 27 Aug 2015 14:18:17 +0100 Subject: [PATCH 1/2] Add ESLint React plugin and remove inline rule overrides Conflicts: package.json spec/section_spec.js --- .eslintrc | 3 +++ package.json | 1 + spec/section_spec.js | 2 +- src/app.js | 2 +- src/book/section.jsx | 4 ++-- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.eslintrc b/.eslintrc index 47c548b..9557089 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,8 @@ root: true +plugins: + - react + env: browser: true es6: true diff --git a/package.json b/package.json index fbdb4ed..38967af 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "css-loader": "^0.15.6", "eslint": "^1.1.0", "eslint-loader": "^1.0.0", + "eslint-plugin-react": "^3.3.0", "http-server": "^0.8.0", "isparta-loader": "^0.2.0", "karma": "^0.13.9", diff --git a/spec/section_spec.js b/spec/section_spec.js index a509b5b..bb464ab 100644 --- a/spec/section_spec.js +++ b/spec/section_spec.js @@ -1,6 +1,6 @@ import 'core-js/es5'; import React from 'react/addons'; -import Section from '../src/book/section.jsx'; // eslint-disable-line no-unused-vars +import Section from '../src/book/section.jsx'; import Heading from '../src/book/heading.jsx'; import Description from '../src/book/description.jsx'; diff --git a/src/app.js b/src/app.js index 2424c01..e35a639 100644 --- a/src/app.js +++ b/src/app.js @@ -4,7 +4,7 @@ import './navigation/links.scss'; import React from 'react'; import Book from './book/book.js'; -import Section from './book/section.jsx'; // eslint-disable-line no-unused-vars +import Section from './book/section.jsx'; React.render(
, document.getElementById( 'heading-container' ) ); var book = new Book(); diff --git a/src/book/section.jsx b/src/book/section.jsx index 746a2da..cb88eb0 100644 --- a/src/book/section.jsx +++ b/src/book/section.jsx @@ -1,6 +1,6 @@ import React from 'react'; -import Heading from './heading.jsx'; // eslint-disable-line no-unused-vars -import Description from './description.jsx'; // eslint-disable-line no-unused-vars +import Heading from './heading.jsx'; +import Description from './description.jsx'; export default class extends React.Component { render() { From a22d9e4a38955c717e5cc0a9007501f698603653 Mon Sep 17 00:00:00 2001 From: Jacob Walton Date: Thu, 27 Aug 2015 16:32:40 +0100 Subject: [PATCH 2/2] Add .eslintignore file and modify npm lint script accordingly --- .eslintignore | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..2ebad6c --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +dist +tmp diff --git a/package.json b/package.json index 38967af..15be684 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "clean": "rm -fr tmp/coverage/javascript/* && rm -fr dist/*", "dev-server": "node webpack-dev-server.js", "start": "http-server -p 5001", - "lint": "eslint --ignore-pattern dist ./; exit 0", + "lint": "eslint ./; exit 0", "test": "karma start" }, "repository": {