diff --git a/.eslintrc.js b/.eslintrc.js index a1de2408a80489..f0b7056a95d9f2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -47,6 +47,8 @@ module.exports = { 'react/jsx-no-duplicate-props': 'error', 'react/no-danger': 'error', 'react/no-direct-mutation-state': 'error', + 'react/no-set-state': 'off', + 'react/no-string-refs': 'error', 'react/prefer-stateless-function': 'off', // wishlist, one day 'react/sort-comp': [2, { order: [ @@ -60,7 +62,6 @@ module.exports = { 'render' ], }], - 'react/no-set-state': 'off', 'material-ui/docgen-ignore-before-comment': 'error', 'mocha/handle-done-callback': 'error', 'mocha/no-exclusive-tests': 'error', diff --git a/package.json b/package.json index b8b880068bc991..145afa84327ace 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "clean:build": "rimraf build", "docs:start": "(cd docs/site; npm start)", "lint": "eslint src docs/site/src test/integration && echo \"eslint: no lint errors\"", + "lint:find-rules": "eslint-find-rules -u .eslintrc.js", "prebuild": "npm run clean:build", "test": "cross-env NODE_ENV=test babel-node test/index.js", "test:watch": "cross-env NODE_ENV=test babel-node test/watch.js", @@ -88,6 +89,7 @@ "enzyme": "^2.2.0", "eslint": "^2.13.1", "eslint-config-airbnb": "^9.0.1", + "eslint-find-rules": "^1.11.1", "eslint-plugin-babel": "^3.2.0", "eslint-plugin-flowtype": "^2.3.1", "eslint-plugin-import": "^1.10.3", diff --git a/src/internal/Transition.js b/src/internal/Transition.js index 3f1449a522c633..b53615b973e92b 100644 --- a/src/internal/Transition.js +++ b/src/internal/Transition.js @@ -273,8 +273,12 @@ class Transition extends Component { return null; } - const { children, className, ...childProps } = this.props; - Object.keys(Transition.propTypes).forEach((key) => delete childProps[key]); + const { + children, + className, + ...other, + } = this.props; + Object.keys(Transition.propTypes).forEach((key) => delete other[key]); let transitionClassName; if (status === EXITED) { @@ -291,7 +295,7 @@ class Transition extends Component { return React.cloneElement( child, { - ...childProps, + ...other, className: ClassNames( child.props.className, className, diff --git a/src/internal/Transition.spec.js b/src/internal/Transition.spec.js index 05c4ccae65dd88..31acb26db95678 100644 --- a/src/internal/Transition.spec.js +++ b/src/internal/Transition.spec.js @@ -252,8 +252,10 @@ describe('', () => { }); } + transition = null; + getStatus() { - return this.refs.transition.state.status; + return this.transition.state.status; } render() { @@ -264,7 +266,11 @@ describe('', () => { return ( { + if (c !== null) { + this.transition = c; + } + }} unmountOnExit in={this.state.in} timeout={10}