Skip to content

Commit c79be8d

Browse files
committed
Merge branch 'master' into v3-dev
2 parents 6951a65 + 1ec25a9 commit c79be8d

File tree

10 files changed

+370
-244
lines changed

10 files changed

+370
-244
lines changed

.eslintrc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"parser": "babel-eslint",
3+
"extends": "eslint:recommended",
34
"rules": {
4-
"comma-dangle": [1, "always-multiline"],
5+
"comma-dangle": ["error", "always-multiline"],
56
"no-underscore-dangle": 0,
6-
"quotes": [2, "single", "avoid-escape"],
7+
"quotes": ["error", "single", "avoid-escape"],
78
"strict": 0,
8-
"no-unused-vars": 2,
9-
"no-undef": 2
9+
"no-unused-vars": "error",
10+
"no-undef": "error"
1011
},
1112
"env": {
1213
"node": true,

.travis.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
sudo: required
1+
sudo: false
22
language: node_js
33
node_js:
44
- "4"
55
- "6"
6-
- "7"
76
- "8"
8-
script: npm run check
7+
before_install:
8+
- curl -o- -L https://yarnpkg.com/install.sh | bash
9+
- export PATH="$HOME/.yarn/bin:$PATH"
10+
cache:
11+
yarn: true
12+
directories:
13+
- ".eslintcache"
14+
- "node_modules"
15+
script: yarn test:ci

README.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -119,42 +119,41 @@ For example, while the `propTypesHandler` expects the prop types definition to b
119119
For the following component
120120

121121
```js
122-
var React = require('react');
122+
import React, { Component } from 'react';
123+
import PropTypes from 'prop-types';
123124

124125
/**
125126
* General component description.
126127
*/
127-
var Component = React.createClass({
128-
propTypes: {
129-
/**
130-
* Description of prop "foo".
131-
*/
132-
foo: React.PropTypes.number,
133-
/**
134-
* Description of prop "bar" (a custom validation function).
135-
*/
136-
bar: function(props, propName, componentName) {
137-
// ...
138-
},
139-
baz: React.PropTypes.oneOfType([
140-
React.PropTypes.number,
141-
React.PropTypes.string
142-
]),
143-
},
144-
145-
getDefaultProps: function() {
146-
return {
147-
foo: 42,
148-
bar: 21
149-
};
150-
},
151-
128+
class MyComponent extends Component {
152129
render: function() {
153130
// ...
154131
}
155-
});
132+
}
156133

157-
module.exports = Component;
134+
MyComponent.propTypes = {
135+
/**
136+
* Description of prop "foo".
137+
*/
138+
foo: PropTypes.number,
139+
/**
140+
* Description of prop "bar" (a custom validation function).
141+
*/
142+
bar: function(props, propName, componentName) {
143+
// ...
144+
},
145+
baz: PropTypes.oneOfType([
146+
PropTypes.number,
147+
PropTypes.string
148+
]),
149+
};
150+
151+
MyComponent.defaultProps = {
152+
foo: 42,
153+
bar: 21
154+
};
155+
156+
export default Component;
158157
```
159158

160159
we are getting this output:

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717
],
1818
"main": "dist/main.js",
1919
"scripts": {
20-
"check": "npm run lint && npm run flow && npm test",
21-
"flow": "flow",
22-
"lint": "eslint src/",
23-
"watch": "babel src/ --out-dir dist/ --watch",
2420
"build": "rimraf dist/ && babel src/ --out-dir dist/ --ignore __tests__,__mocks__",
25-
"prepublish": "npm run build",
26-
"preversion": "npm run lint",
27-
"test": "jest"
21+
"lint": "eslint src/ bin/",
22+
"prepublish": "yarn run build",
23+
"preversion": "yarn run lint",
24+
"test": "jest",
25+
"test:ci": "yarn lint && yarn flow && yarn test --runInBand",
26+
"watch": "yarn build --watch"
2827
},
2928
"keywords": [
3029
"react",
@@ -42,16 +41,17 @@
4241
"recast": "^0.12.6"
4342
},
4443
"devDependencies": {
45-
"babel-cli": "^6.9.0",
44+
"babel-cli": "^6.26.0",
45+
"babel-core": "^6.26.0",
4646
"babel-eslint": "^8.0.1",
4747
"babel-jest": "^21.2.0",
48-
"babel-plugin-transform-object-rest-spread": "^6.23.0",
49-
"babel-plugin-transform-runtime": "^6.9.0",
50-
"babel-preset-env": "^1.1.8",
48+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
49+
"babel-plugin-transform-runtime": "^6.23.0",
50+
"babel-preset-env": "^1.6.1",
5151
"babel-preset-flow": "^6.23.0",
5252
"cross-spawn": "^5.0.0",
5353
"eslint": "^4.3.0",
54-
"flow-bin": "^0.57.3",
54+
"flow-bin": "^0.59.0",
5555
"jest": "^21.2.1",
5656
"jest-diff": "^21.2.1",
5757
"jest-matcher-utils": "^21.2.1",

0 commit comments

Comments
 (0)