Skip to content

Commit eb95dc5

Browse files
committed
Babel 6 + flow
1 parent 30cd59b commit eb95dc5

7 files changed

+51
-27
lines changed

.babelrc

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
2-
"stage": 0,
3-
"env": {
4-
"test": {
5-
"plugins": [
6-
"typecheck"
7-
]
8-
}
9-
}
2+
"presets": [
3+
"es2015",
4+
"stage-1",
5+
"react"
6+
]
107
}

.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,10 @@
2626
},
2727
"ecmaFeatures": {
2828
"jsx": true
29+
},
30+
"globals": {
31+
// For Flow
32+
"ReactElement",
33+
"ReactClass"
2934
}
3035
}

.flowconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[ignore]
2+
.*/node_modules/react/.*
3+
.*/node_modules/babel.*
4+
.*/node_modules/fbjs/.*
5+
.*test
6+
7+
[include]
8+
./lib
9+
index.js
10+
11+
[libs]
12+
13+
[options]
14+
suppress_comment=.*\\\\s*$FlowFixMe.*
15+
suppress_comment=.*\\\\s*$FlowBug.*
16+
suppress_comment=.*\\\\s*$FlowIgnore.*
17+
suppress_comment=\\(.\\|\n\\)*\\$FlowNewLine.*
18+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
19+
esproposal.class_instance_fields=ignore
20+
esproposal.class_static_fields=ignore

lib/ResizableBox.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default class ResizableBox extends React.Component {
5959
height = Math.min(max[1], height);
6060
}
6161
return [width, height];
62-
}
62+
};
6363

6464
render() {
6565
// Basic wrapper around a Resizable instance.

package.json

+18-16
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"description": "A component that is resizable with handles.",
55
"main": "index.js",
66
"scripts": {
7-
"lint": "eslint lib/ test/",
7+
"lint": "eslint --ext .js,.jsx lib/ test/; flow",
88
"test": "echo \"Error: no test specified\" && exit 1",
99
"build": "bash build.sh",
1010
"build-example": "webpack",
11-
"dev": "echo 'Open http://localhost:4002/examples/1.html' && cross-env NODE_ENV=test webpack-dev-server --config webpack-dev-server.config.js --hot --progress --colors --port 4002 --content-base .",
11+
"dev": "echo 'Open http://localhost:4003/examples/1.html' && cross-env NODE_ENV=test webpack-dev-server --config webpack-dev-server.config.js --hot --progress --colors --port 4003 --content-base .",
1212
"prepublish": "npm run build",
1313
"validate": "npm ls"
1414
},
@@ -28,26 +28,28 @@
2828
},
2929
"homepage": "https://github.com/STRML/react-resizable",
3030
"devDependencies": {
31-
"babel": "^5.8.29",
32-
"babel-core": "^5.8.29",
33-
"babel-eslint": "^4.1.3",
34-
"babel-loader": "^5.3.2",
35-
"babel-plugin-typecheck": "^1.3.0",
31+
"babel-cli": "^6.5.1",
32+
"babel-core": "^6.5.1",
33+
"babel-eslint": "^4.1.8",
34+
"babel-loader": "^6.2.2",
35+
"babel-preset-es2015": "^6.5.0",
36+
"babel-preset-react": "^6.5.0",
37+
"babel-preset-stage-1": "^6.5.0",
3638
"cross-env": "^1.0.7",
37-
"css-loader": "^0.23.0",
38-
"eslint": "^1.9.0",
39-
"eslint-plugin-react": "^3.8.0",
40-
"lodash": "^3.10.1",
39+
"css-loader": "^0.23.1",
40+
"eslint": "^1.10.3",
41+
"eslint-plugin-react": "^3.16.1",
42+
"lodash": "^4.3.0",
4143
"pre-commit": "^1.1.2",
42-
"react": "^0.14.2",
44+
"react": "^0.14.7",
4345
"style-loader": "^0.13.0",
44-
"webpack": "^1.12.6",
45-
"webpack-dev-server": "^1.12.1"
46+
"webpack": "^1.12.13",
47+
"webpack-dev-server": "^1.14.1"
4648
},
4749
"dependencies": {
48-
"react-dom": "^0.14.2",
50+
"react-dom": "^0.14.7",
4951
"object-assign": "^4.0.1",
50-
"react-draggable": "^1.1.0"
52+
"react-draggable": "^1.2.0"
5153
},
5254
"publishConfig": {
5355
"registry": "https://registry.npmjs.org"

webpack-dev-server.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
},
1313
module: {
1414
loaders: [
15-
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader'}
15+
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?cacheDirectory=true'}
1616
]
1717
},
1818
debug: true,

webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
},
1111
module: {
1212
loaders: [
13-
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?stage=0'},
13+
{test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?cacheDirectory=true'},
1414
]
1515
},
1616
resolve: {

0 commit comments

Comments
 (0)