From 8733a60acb18a584ea04221ca3a60a7998b22c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Wed, 26 Oct 2016 10:51:06 +0100 Subject: [PATCH] use some common joyent lint rules --- frontend/.eslintrc | 31 ++++++++++++++++++++++++++-- frontend/webpack/base.js | 7 ++++++- frontend/webpack/test.js | 7 ++++++- ui/.eslintrc | 30 +++++++++++++++++++++++++-- ui/src/components/column/index.js | 2 +- ui/src/components/container/index.js | 2 +- ui/src/components/row/index.js | 2 +- ui/webpack/base.js | 7 ++++++- ui/webpack/test.js | 7 ++++++- 9 files changed, 84 insertions(+), 11 deletions(-) diff --git a/frontend/.eslintrc b/frontend/.eslintrc index 0f6b9fe1..ebbf4972 100644 --- a/frontend/.eslintrc +++ b/frontend/.eslintrc @@ -1,5 +1,8 @@ { - "extends": "semistandard", + "extends": [ + "semistandard", + "eslint:recommended" + ], "parser": "babel-eslint", "parserOptions": { "ecmaVersion": 7, @@ -13,6 +16,11 @@ "react", "jsx-a11y" ], + "env": { + "node": true, + "browser": true, + "es6": true + }, "rules": { "react/jsx-no-undef": 2, "react/jsx-uses-react": 2, @@ -95,6 +103,25 @@ }], "sort-vars": [2, { "ignoreCase": true - }] + }], + "prefer-const": 2, + "no-mixed-spaces-and-tabs": 2, + "new-cap": 2, + "no-use-before-define": [2, "nofunc"], + "semi": [2, "always"], + "camelcase": 2, + "curly": 2, + "eqeqeq": 2, + "no-extend-native": 2, + "indent": [2, 2, { + "SwitchCase": 1 + }], + "quotes": [2, "single"], + "max-depth": [2, 3], + "max-statements": [2, 60], + "max-len": [2, 80], + "no-eq-null": 2, + "block-scoped-var": 2, + "no-console": 0 } } diff --git a/frontend/webpack/base.js b/frontend/webpack/base.js index 4fe01b16..22c57dd7 100644 --- a/frontend/webpack/base.js +++ b/frontend/webpack/base.js @@ -69,7 +69,12 @@ exports.config = { ], loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', - loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader' + loader: [ + 'css-loader?', + 'modules&importLoaders=1&', + 'localIdentName=[name]__[local]___[hash:base64:5]!', + 'postcss-loader' + ].join('') }) }] } diff --git a/frontend/webpack/test.js b/frontend/webpack/test.js index aad175cc..f7ff55c5 100644 --- a/frontend/webpack/test.js +++ b/frontend/webpack/test.js @@ -12,7 +12,12 @@ module.exports = { module: { loaders: [{ test: /\.css?$/, - loader: 'style-loader!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader' + loader: [ + 'css-loader?', + 'modules&importLoaders=1&', + 'localIdentName=[name]__[local]___[hash:base64:5]!', + 'postcss-loader' + ].join('') }] } }; diff --git a/ui/.eslintrc b/ui/.eslintrc index 0f6b9fe1..101a9bb8 100644 --- a/ui/.eslintrc +++ b/ui/.eslintrc @@ -1,5 +1,8 @@ { - "extends": "semistandard", + "extends": [ + "semistandard", + "eslint:recommended" + ], "parser": "babel-eslint", "parserOptions": { "ecmaVersion": 7, @@ -13,6 +16,11 @@ "react", "jsx-a11y" ], + "env": { + "node": true, + "browser": true, + "es6": true + }, "rules": { "react/jsx-no-undef": 2, "react/jsx-uses-react": 2, @@ -95,6 +103,24 @@ }], "sort-vars": [2, { "ignoreCase": true - }] + }], + "prefer-const": 2, + "no-mixed-spaces-and-tabs": 2, + "new-cap": 2, + "no-use-before-define": [2, "nofunc"], + "semi": [2, "always"], + "camelcase": 2, + "curly": 2, + "eqeqeq": 2, + "no-extend-native": 2, + "indent": [2, 2, { + "SwitchCase": 1 + }], + "quotes": [2, "single"], + "max-depth": [2, 3], + "max-statements": [2, 60], + "max-len": [2, 80], + "no-eq-null": 2, + "block-scoped-var": 2 } } diff --git a/ui/src/components/column/index.js b/ui/src/components/column/index.js index 22985c24..3a2564ae 100644 --- a/ui/src/components/column/index.js +++ b/ui/src/components/column/index.js @@ -1,6 +1,6 @@ /* * based on - * https://github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Col.js + * github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Col.js */ const flatten = require('lodash.flatten'); diff --git a/ui/src/components/container/index.js b/ui/src/components/container/index.js index 53258846..ffd5535d 100644 --- a/ui/src/components/container/index.js +++ b/ui/src/components/container/index.js @@ -1,6 +1,6 @@ /* * based on - * https://github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Grid.js + * github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Grid.js */ const React = require('react'); diff --git a/ui/src/components/row/index.js b/ui/src/components/row/index.js index 52042aef..46a060c4 100644 --- a/ui/src/components/row/index.js +++ b/ui/src/components/row/index.js @@ -1,6 +1,6 @@ /* * based on - * https://github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Row.js + * github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Row.js */ const flatten = require('lodash.flatten'); diff --git a/ui/webpack/base.js b/ui/webpack/base.js index 309f08d1..29c35d45 100644 --- a/ui/webpack/base.js +++ b/ui/webpack/base.js @@ -75,7 +75,12 @@ exports.config = { ], loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', - loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader' + loader: [ + 'css-loader?', + 'modules&importLoaders=1&', + 'localIdentName=[name]__[local]___[hash:base64:5]!', + 'postcss-loader' + ].join('') }) }] } diff --git a/ui/webpack/test.js b/ui/webpack/test.js index af6bef85..a4f6e954 100644 --- a/ui/webpack/test.js +++ b/ui/webpack/test.js @@ -11,7 +11,12 @@ module.exports = { module: { loaders: [{ test: /\.css?$/, - loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader' + loader: [ + 'css-loader?', + 'modules&importLoaders=1&', + 'localIdentName=[name]__[local]___[hash:base64:5]!', + 'postcss-loader' + ].join('') }] } };