diff --git a/.babelrc b/.babelrc index 8ceb659..60325ff 100644 --- a/.babelrc +++ b/.babelrc @@ -1,11 +1,11 @@ { "presets": [ "es2015-native-modules", - "stage-0", "react", "airbnb" ], "plugins": [ - "transform-decorators-legacy" + "transform-decorators-legacy", + "transform-object-rest-spread" ] } diff --git a/.eslintrc b/.eslintrc index 816dda2..04f44e0 100644 --- a/.eslintrc +++ b/.eslintrc @@ -10,9 +10,6 @@ "comma-dangle": 0, "padded-blocks": 0, "react/prefer-stateless-function": 0, - "react/jsx-no-bind": 0, - "strict": 0, - "no-unused-expressions": 0, "no-underscore-dangle": [ "error", { "allowAfterThis": true }], "import/no-unresolved": [ "error", "ignore": [ 'config', diff --git a/conf/webpack/Base.js b/conf/webpack/Base.js index eefebfe..ab6f3ba 100644 --- a/conf/webpack/Base.js +++ b/conf/webpack/Base.js @@ -1,8 +1,6 @@ /** * Webpack configuration base class */ -'use strict'; - const path = require('path'); const npmBase = path.join(__dirname, '../../node_modules'); @@ -69,7 +67,6 @@ class WebpackBaseConfig { */ get defaultSettings() { return { - cache: true, context: this.srcPathAbsolute, debug: false, devtool: 'eval', @@ -92,25 +89,24 @@ class WebpackBaseConfig { ], loaders: [ { - test: /\.css$/, + test: /\.cssmodule\.css$/, loaders: [ 'style', 'css?modules&importLoaders=1&localIdentName=[name]-[local]-[hash:base64:5]' ] }, { - test: /\.sass$/, + test: /^.((?!cssmodule).)*\.css$/, loaders: [ 'style', - 'css?modules&importLoaders=1&localIdentName=[name]-[local]-[hash:base64:5]', - 'sass' + 'css' ] }, { - test: /\.scss$/, + test: /\.(sass|scss)$/, loaders: [ 'style', - 'css?modules&importLoaders=1&localIdentName=[name]-[local]-[hash:base64:5]', + 'css', 'sass' ] }, @@ -118,7 +114,7 @@ class WebpackBaseConfig { test: /\.less$/, loaders: [ 'style', - 'css?modules&importLoaders=1&localIdentName=[name]-[local]-[hash:base64:5]', + 'css', 'less' ] }, @@ -126,7 +122,7 @@ class WebpackBaseConfig { test: /\.styl$/, loaders: [ 'style', - 'css?modules&importLoaders=1&localIdentName=[name]-[local]-[hash:base64:5]', + 'css', 'stylus' ] }, @@ -134,6 +130,10 @@ class WebpackBaseConfig { test: /\.(png|jpg|gif|mp4|ogg|svg|woff|woff2)$/, loaders: ['file'] }, + { + test: /\.json$/, + loaders: 'json' + }, { test: /\.(js|jsx)$/, include: [].concat( diff --git a/conf/webpack/Dev.js b/conf/webpack/Dev.js index 4ead5a0..018b113 100644 --- a/conf/webpack/Dev.js +++ b/conf/webpack/Dev.js @@ -1,8 +1,6 @@ /** * Default dev server configuration. */ -'use strict'; - const webpack = require('webpack'); const WebpackBaseConfig = require('./Base'); diff --git a/conf/webpack/Dist.js b/conf/webpack/Dist.js index 95850de..4f38b6d 100644 --- a/conf/webpack/Dist.js +++ b/conf/webpack/Dist.js @@ -2,8 +2,6 @@ * Dist configuration. Used to build the * final output when running npm run dist. */ -'use strict'; - const webpack = require('webpack'); const WebpackBaseConfig = require('./Base'); diff --git a/conf/webpack/Test.js b/conf/webpack/Test.js index 36cdf56..8773e36 100644 --- a/conf/webpack/Test.js +++ b/conf/webpack/Test.js @@ -1,7 +1,6 @@ /** * Default test configuration. */ -'use strict'; const WebpackBaseConfig = require('./Base'); const webpack = require('webpack'); diff --git a/conf/webpack/index.js b/conf/webpack/index.js index 1638ad9..0a6f36b 100644 --- a/conf/webpack/index.js +++ b/conf/webpack/index.js @@ -1,4 +1,3 @@ -'use strict'; const dev = require('./Dev'); const dist = require('./Dist'); const test = require('./Test'); diff --git a/karma.conf.js b/karma.conf.js index bf08b33..e1028d6 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,4 +1,3 @@ -'use strict'; const webpackCfg = require('./webpack.config')('test'); module.exports = function karmaConfig(config) { diff --git a/package.json b/package.json index d757c1b..e8e2077 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "posttest": "npm run lint", "test:watch": "karma start --autoWatch=true --singleRun=false --reporters=mocha,coverage", "serve:dev": "webpack-dev-server --open --env dev", - "serve:dist": "webpack-dev-server --hot --inline --open --progress --env dist -p", + "serve:dist": "webpack-dev-server --open --env dist -p --progress", "dist": "npm run clean && npm run copy && webpack --progress --bail --env dist -p", "lint": "eslint ./src", "clean": "rimraf dist/*", @@ -42,11 +42,11 @@ "babel-eslint": "^6.0.4", "babel-loader": "^6.2.4", "babel-plugin-transform-decorators-legacy": "^1.3.4", + "babel-plugin-transform-object-rest-spread": "^6.8.0", "babel-polyfill": "^6.9.0", "babel-preset-airbnb": "^2.0.0", "babel-preset-es2015-native-modules": "^6.6.0", "babel-preset-react": "^6.5.0", - "babel-preset-stage-0": "^6.5.0", "chai": "^3.5.0", "copyfiles": "^0.2.1", "css-loader": "^0.23.1", diff --git a/src/components/App.js b/src/components/App.js index 2bff7dc..22cb9b6 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -1,6 +1,6 @@ import React from 'react'; import cssmodules from 'react-css-modules'; -import styles from './app.css'; +import styles from './app.cssmodule.css'; const yeomanImage = require('../images/yeoman.png'); diff --git a/src/components/app.css b/src/components/app.cssmodule.css similarity index 100% rename from src/components/app.css rename to src/components/app.cssmodule.css diff --git a/src/config/base.js b/src/config/base.js index 2e355a2..a7959bc 100644 --- a/src/config/base.js +++ b/src/config/base.js @@ -1,5 +1,3 @@ -'use strict'; - // Settings configured here will be merged into the final config object. export default { }; diff --git a/src/config/dev.js b/src/config/dev.js index b21c0ac..7084748 100644 --- a/src/config/dev.js +++ b/src/config/dev.js @@ -1,9 +1,7 @@ -'use strict'; - import baseConfig from './base'; const config = { - appEnv: 'dev' + appEnv: 'dev', }; export default Object.freeze(Object.assign({}, baseConfig, config)); diff --git a/src/config/dist.js b/src/config/dist.js index a26f5bc..c15a095 100644 --- a/src/config/dist.js +++ b/src/config/dist.js @@ -1,9 +1,7 @@ -'use strict'; - import baseConfig from './base'; const config = { - appEnv: 'dist' + appEnv: 'dist', }; export default Object.freeze(Object.assign({}, baseConfig, config)); diff --git a/src/config/test.js b/src/config/test.js index 57d95c1..ee4bf1c 100644 --- a/src/config/test.js +++ b/src/config/test.js @@ -1,9 +1,7 @@ -'use strict'; - import baseConfig from './base'; const config = { - appEnv: 'test' + appEnv: 'test', }; export default Object.freeze(Object.assign({}, baseConfig, config)); diff --git a/test/config/ConfigTest.js b/test/config/ConfigTest.js index 541c7e1..4c0f99d 100644 --- a/test/config/ConfigTest.js +++ b/test/config/ConfigTest.js @@ -1,5 +1,3 @@ -'use strict'; - import config from 'config'; describe('Application Environment', () => { diff --git a/test/loadtests.js b/test/loadtests.js index 54c3952..1b83780 100644 --- a/test/loadtests.js +++ b/test/loadtests.js @@ -1,5 +1,3 @@ -'use strict'; - // Add support for Promise objects via polyfills import 'babel-polyfill'; diff --git a/webpack.config.js b/webpack.config.js index f018790..3284904 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,15 +1,18 @@ -'use strict'; +/* eslint no-console: "off" */ const webpackConfigs = require('./conf/webpack'); const defaultConfig = 'dev'; module.exports = (configName) => { + // If there was no configuration give, assume default + const requestedConfig = configName || defaultConfig; + // Return a new instance of the webpack config // or the default one if it cannot be found. let LoadedConfig = defaultConfig; - if (webpackConfigs[configName] !== undefined) { - LoadedConfig = webpackConfigs[configName]; + if (webpackConfigs[requestedConfig] !== undefined) { + LoadedConfig = webpackConfigs[requestedConfig]; } else { console.warn(` Provided environment "${configName}" was not found.