Skip to content

Commit 8a01070

Browse files
author
Ives van Hoorne
committed
Add babili
1 parent 1536e9b commit 8a01070

File tree

4 files changed

+211
-20
lines changed

4 files changed

+211
-20
lines changed

config/webpack.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const path = require('path');
33
const paths = require('./paths');
44
const HtmlWebpackPlugin = require('html-webpack-plugin');
55
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
6+
const BabiliPlugin = require('babili-webpack-plugin');
67
const childProcess = require('child_process');
78
const WatchMissingNodeModulesPlugin = require('../scripts/utils/WatchMissingNodeModulesPlugin');
89
const env = require('./env');
@@ -234,10 +235,11 @@ if (__PROD__) {
234235
minimize: true,
235236
debug: false,
236237
}),
238+
new BabiliPlugin(),
237239
new webpack.optimize.UglifyJsPlugin({
238240
beautify: false,
239241
compress: {
240-
warnings: false,
242+
warnings: true,
241243
screw_ie8: true,
242244
conditionals: true,
243245
unused: true,

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"babel-preset-latest": "^6.16.0",
1818
"babel-preset-react": "^6.16.0",
1919
"babel-runtime": "^6.20.0",
20+
"babili-webpack-plugin": "^0.0.11",
2021
"case-sensitive-paths-webpack-plugin": "^1.1.4",
2122
"chalk": "1.1.3",
2223
"connect-history-api-fallback": "1.3.0",
@@ -106,7 +107,7 @@
106107
},
107108
"scripts": {
108109
"start": "node scripts/start.js",
109-
"build": "node scripts/build.js && gulp",
110+
"build": "NODE_ENV=production node scripts/build.js && gulp",
110111
"test": "jest --env=jsdom",
111112
"test:watch": "jest --watch --env=jsdom",
112113
"lint": "eslint src"

src/app/utils/codemirror/eslint-lint.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'codemirror/addon/lint/lint.css';
33
import 'codemirror/addon/lint/lint';
44
import fixer from 'eslint/lib/util/source-code-fixer';
55
import './eslint';
6+
import error from '../error';
67

78
const allRules = {
89
'react/jsx-uses-react': require('eslint-plugin-react/lib/rules/jsx-uses-react'),
@@ -69,8 +70,10 @@ const allRules = {
6970
};
7071

7172
try {
72-
eslint.defineRules(allRules);
73-
} catch (e) {}
73+
window.eslint.defineRules(allRules);
74+
} catch (e) {
75+
error(e);
76+
}
7477

7578
const defaultConfig = {
7679
extends: ['prettier', 'prettier/react', 'prettier/flowtype'],
@@ -1589,7 +1592,7 @@ function getSeverity(error) {
15891592

15901593
function eslintValidate(text) {
15911594
if (!window.eslint) return [];
1592-
return eslint.verify(text, defaultConfig);
1595+
return window.eslint.verify(text, defaultConfig);
15931596
}
15941597

15951598
export function validator(text, options) {
@@ -1603,7 +1606,7 @@ export function validator(text, options) {
16031606

16041607
export function fix(source) {
16051608
const errors = eslintValidate(source);
1606-
return fixer.applyFixes(eslint.getSourceCode(), errors);
1609+
return fixer.applyFixes(window.eslint.getSourceCode(), errors);
16071610
}
16081611

16091612
CodeMirror.registerHelper('lint', 'javascript', validator);

0 commit comments

Comments
 (0)