Skip to content

Commit a2c0c44

Browse files
Merge pull request #5 from lumc-nested/react-14
[wip] Update to React 0.14
2 parents 4aa11b2 + 294ed81 commit a2c0c44

File tree

5 files changed

+67
-68
lines changed

5 files changed

+67
-68
lines changed

.eslintrc

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,45 @@
11
# ESLint has many default rules that are not listed in this file
22
# Documentation for all ESLint rules can be found at http://eslint.org/docs/rules/
33
parser: babel-eslint
4+
parserOptions:
5+
ecmaVersion: 6
6+
plugins:
7+
- react
8+
extends:
9+
- eslint:recommended
10+
- plugin:react/recommended
411
env:
512
browser: true
613
node: true
14+
es6: true
715
rules:
8-
strict: [2, never] # use strict is added by babel
9-
quote-props: [1, as-needed]
10-
vars-on-top: 1
11-
eqeqeq: 1
12-
radix: 1
13-
no-eq-null: 2
14-
no-self-compare: 2
15-
no-void: 2
16-
no-new-object: 2
17-
no-array-constructor: 1
18-
no-inner-declarations: [1, both]
19-
no-shadow-restricted-names: 1
20-
no-unused-vars: 1
21-
no-unreachable: 1
2216
brace-style: 1
23-
semi: [1, always]
2417
camelcase: 2
25-
new-cap:
26-
- 1
2718
comma-style: 2
28-
comma-dangle: [1, never]
2919
consistent-this: [2, self]
30-
no-underscore-dangle: 0
31-
quotes: [2, single]
3220
curly: 1
21+
eqeqeq: 1
3322
indent:
3423
- 2
3524
- 2
3625
- SwitchCase: 1
37-
no-mixed-spaces-and-tabs: 2
38-
space-after-keywords: 2
39-
space-before-blocks: 2
40-
object-curly-spacing: 2
41-
array-bracket-spacing: 2
42-
computed-property-spacing: 2
43-
space-in-parens: 2
44-
spaced-comment: 2
45-
eol-last: 1
4626
max-depth: [1, 4]
4727
max-len: [1, 120]
4828
max-params: [1, 4]
49-
react/jsx-uses-vars: 1
50-
ecmaFeatures:
51-
arrowFunctions: true
52-
destructuring: true
53-
objectLiteralComputedProperties: true
54-
objectLiteralShorthandProperties: true
55-
templateStrings: true
56-
jsx: true
57-
plugins:
58-
- react
29+
new-cap: 1
30+
no-array-constructor: 1
31+
no-console: 0
32+
no-eq-null: 2
33+
no-new-object: 2
34+
no-self-compare: 2
35+
no-shadow-restricted-names: 1
36+
no-underscore-dangle: 0
37+
no-void: 2
38+
quote-props: [1, as-needed]
39+
quotes: [2, single, avoid-escape]
40+
# TODO: Enable the react/prop-types rule.
41+
react/prop-types: 0
42+
radix: 1
43+
spaced-comment: 2
44+
strict: [2, never]
45+
vars-on-top: 1

package.json

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,40 @@
1414
"url": "https://github.com/lumc-nested/nested-website.git"
1515
},
1616
"dependencies": {
17-
"babel-core": "~6.3.15",
18-
"babel-polyfill": "~6.3.14",
19-
"babel-runtime": "~5.2.17",
20-
"bootstrap": "~3.3.4",
21-
"nested-editor": "git+https://github.com/lumc-nested/nested-editor.git#12af0b1",
22-
"react": "~0.13.1",
23-
"react-bootstrap": "~0.20.0",
24-
"react-fa": "~3.2.0"
17+
"babel-core": "~6.5.2",
18+
"babel-polyfill": "~6.5.0",
19+
"babel-runtime": "~6.5.0",
20+
"bootstrap": "~3.3.6",
21+
"nested-editor": "git+https://github.com/lumc-nested/nested-editor.git#20ae56a",
22+
"react": "~0.14.7",
23+
"react-bootstrap": "~0.28.3",
24+
"react-dom": "~0.14.7",
25+
"react-fa": "~4.0.0"
2526
},
2627
"devDependencies": {
27-
"babel-eslint": "~4.1.3",
28-
"babel-loader": "~5.0.0",
28+
"babel-eslint": "~5.0.0",
29+
"babel-loader": "~6.2.3",
30+
"babel-plugin-transform-runtime": "~6.5.2",
31+
"babel-preset-es2015": "~6.5.0",
32+
"babel-preset-react": "~6.5.0",
33+
"babel-preset-stage-1": "~6.5.0",
2934
"binary-loader": "~0.0.1",
3035
"css-loader": "~0.23.1",
31-
"eslint": "~1.10.3",
32-
"eslint-loader": "~1.1.1",
33-
"eslint-plugin-react": "~3.11.3",
36+
"eslint": "~2.2.0",
37+
"eslint-loader": "~1.3.0",
38+
"eslint-plugin-react": "~4.1.0",
3439
"extract-text-webpack-plugin": "~1.0.1",
3540
"file-loader": "~0.8.5",
36-
"json-loader": "~0.5.1",
41+
"json-loader": "~0.5.4",
3742
"less": "~2.6.0",
3843
"less-loader": "~2.2.2",
39-
"pegjs-loader": "0.1.1",
44+
"pegjs": "~0.9.0",
45+
"pegjs-loader": "0.4.0",
4046
"raw-loader": "~0.5.1",
41-
"react-hot-loader": "~1.2.4",
47+
"react-hot-loader": "~1.3.0",
4248
"style-loader": "~0.13.0",
4349
"url-loader": "~0.5.7",
44-
"webpack": "~1.12.12",
50+
"webpack": "~1.12.14",
4551
"webpack-dev-server": "~1.14.1"
4652
}
4753
}

scripts/Website.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var EventListener = require('react-bootstrap/lib/utils/EventListener');
22
var React = require('react');
3+
var ReactDOM = require('react-dom');
34
var ReactBootstrap = require('react-bootstrap');
45

56
var Nested = require('nested-editor');
@@ -94,7 +95,7 @@ var Website = React.createClass({
9495

9596
getSize: function() {
9697
return parseInt(
97-
document.defaultView.getComputedStyle(React.findDOMNode(this.refs.panel), null).height,
98+
document.defaultView.getComputedStyle(ReactDOM.findDOMNode(this.refs.panel), null).height,
9899
10
99100
);
100101
},

scripts/init.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var React = require('react');
2+
var ReactDOM = require('react');
23
var Website = require('./Website');
34

45

@@ -12,7 +13,7 @@ require('../styles/main.less');
1213
(window !== window.top ? window.top : window).React = React;
1314

1415

15-
React.render(<Website />, document.getElementById('content'));
16+
ReactDOM.render(<Website />, document.getElementById('content'));
1617

1718

1819
module.exports = {};

webpack.config.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,37 +34,41 @@ var config = {
3434
preLoaders: [{
3535
test: /\.jsx?$/,
3636
exclude: /node_modules/,
37-
loader: 'eslint-loader'
37+
loader: 'eslint'
3838
}],
3939

4040
loaders: [{
4141
test: /\.jsx?$/,
4242
exclude: /node_modules(?!\/nested-editor)/,
43-
loader: 'babel-loader?stage=1&optional=runtime'
43+
loaders: ['babel?' + JSON.stringify({
44+
presets: ['es2015', 'react', 'stage-1'],
45+
plugins: ['transform-runtime'],
46+
cacheDirectory: true
47+
})]
4448
}, {
4549
test: /\.css$/,
46-
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
50+
loader: ExtractTextPlugin.extract('style', 'css')
4751
}, {
4852
test: /\.less$/,
49-
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!less-loader')
53+
loader: ExtractTextPlugin.extract('style', ['css', 'less'])
5054
}, {
5155
test: /\.(png|jpg)$/,
52-
loader: 'url-loader?limit=8192'
56+
loader: 'url?limit=8192'
5357
}, {
5458
test: /\.json$/,
5559
loader: 'json'
5660
}, {
5761
test: /\.pegjs$/,
58-
loader: 'pegjs-loader'
62+
loader: 'pegjs'
5963
}, {
6064
test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/,
61-
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
65+
loader: 'url?limit=10000&mimetype=application/font-woff'
6266
}, {
6367
test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/,
64-
loader: 'url-loader?limit=10000&mimetype=application/font-woff2'
68+
loader: 'url?limit=10000&mimetype=application/font-woff2'
6569
}, {
6670
test: /\.(otf|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
67-
loader: 'file-loader'
71+
loader: 'file'
6872
}]
6973
},
7074

@@ -88,7 +92,7 @@ if (devServer) {
8892
hot: true
8993
};
9094
config.output.publicPath = '/dist/';
91-
config.module.loaders[0].loader = 'react-hot!babel-loader?stage=1&optional=runtime';
95+
config.module.loaders[0].loaders.unshift('react-hot');
9296
config.cache = true;
9397
config.debug = true;
9498
config.devtool = 'eval';

0 commit comments

Comments
 (0)