From 7dd1bb8858c749ab184fd0d2aee419c5cd4d8341 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Tue, 6 Sep 2016 18:11:37 -0700 Subject: [PATCH] Enable react linting rules, fix linting errors Also fix lint command in `package.json` --- .eslintrc | 5 +++++ js/__tests__/EqGraph--test.js | 3 +-- package.json | 2 +- webpack.production.config.js | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.eslintrc b/.eslintrc index 335241ae..0d81ccc5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -110,6 +110,9 @@ "quote-props": ["warn", "consistent-as-needed"], "quotes": ["error", "single", "avoid-escape"], "radix": "error", + "react/wrap-multilines": "error", + "react/no-string-refs": "error", + "react/jsx-boolean-value": "error", "react/jsx-closing-bracket-location": ["error", "line-aligned"], "react/jsx-curly-spacing": "error", "react/jsx-equals-spacing": "error", @@ -119,6 +122,8 @@ "react/jsx-uses-react": "error", "react/jsx-uses-vars": "error", "react/prefer-stateless-function": "error", + "react/prefer-es6-class": "error", + "react/jsx-pascal-case": "error", "react/require-render-return": "error", "react/self-closing-comp": "error", "semi": "error", diff --git a/js/__tests__/EqGraph--test.js b/js/__tests__/EqGraph--test.js index 9b7d0b3b..98d9f549 100644 --- a/js/__tests__/EqGraph--test.js +++ b/js/__tests__/EqGraph--test.js @@ -1,8 +1,7 @@ jest.unmock('../components/EqGraph.jsx'); import { - roundToEven, - getY + roundToEven } from '../components/EqGraph.jsx'; describe('roundToEven', () => { diff --git a/package.json b/package.json index 9ebfa0f6..d13fdfe8 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Winamp 2 implemented in HTML5 and JavaScript", "main": "index.html", "scripts": { - "lint": "eslint js/*.js js/*.jsx", + "lint": "eslint js/*.js js/*.jsx .", "build": "webpack --config=webpack.production.config.js", "serve": "webpack-dev-server", "weight": "npm run build && gzip-size built/winamp.js | pretty-bytes", diff --git a/webpack.production.config.js b/webpack.production.config.js index 349838a6..90d5d110 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -11,7 +11,7 @@ config.plugins = (config.plugins || []).concat([ ]); config.entry = (config.entry || []).concat([ - './js/googleAnalytics.min.js' + './js/googleAnalytics.min.js' ]); module.exports = config;