Skip to content

Commit

Permalink
fix PropTypes warnings, fix react-addons-test-utils deprecation, fix …
Browse files Browse the repository at this point in the history
…eslint to work with test/
  • Loading branch information
modosc committed Jul 14, 2017
1 parent 9957f24 commit 49919d0
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 181 deletions.
6 changes: 3 additions & 3 deletions dist/react-responsive.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/react-responsive.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-responsive.min.js

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
"cross-env": "^5.0.1",
"eslint": "^3.9.0",
"eslint-config-rackt": "^1.1.1",
"eslint-plugin-react": "^7.1.0",
"github-changes": "^1.0.4",
"jsdom": "^8.4.0",
"mocha": "^2.4.5",
"react": "^15.0.1",
"react-addons-test-utils": "^15.0.1",
"react-dom": "^0.14.0 || ^15.0.0",
"should": "^8.0.2",
"sinon": "^1.17.3",
Expand All @@ -70,7 +70,7 @@
"build": "npm run build:umd && npm run build:umd-min",
"build:watch": "npm run build -- --watch",
"clean": "rimraf dist",
"lint": "eslint src",
"lint": "eslint src test",
"test": "cross-env NODE_PATH=$NODE_PATH:$PWD/src mocha -R spec --compilers js:babel-register --require ./test/setup.js test/*_test.js",
"changelog": "github-changes -o contra -r react-responsive -b master -f ./CHANGELOG.md --order-semver --use-commit-body",
"docs": "npm run docs:pre && npm run docs:build && npm run docs:publish",
Expand All @@ -90,21 +90,28 @@
},
"eslintConfig": {
"parser": "babel-eslint",
"extends": "rackt",
"extends": ["rackt","plugin:react/recommended"],
"env": {
"browser": true,
"node": true,
"es6": true
"es6": true,
"mocha": true
},
"ecmaFeatures": {
"modules": true
"modules": true,
"ecmaVersion": 7,
"jsx": true
},
"rules": {
"semi": [
2,
"never"
]
}
],
"react/prop-types": 0
},
"plugins": [
"react"
]
},
"engines": {
"node": ">= 0.10"
Expand Down
16 changes: 8 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const defaultTypes = {
component: PropTypes.node,
query: PropTypes.string,
values: PropTypes.shape(mediaQuery.matchers),
children: PropTypes.oneOfType([ PropTypes.node, PropTypes.function ]),
onChange: PropTypes.function,
onBeforeChange: PropTypes.function,
children: PropTypes.oneOfType([ PropTypes.node, PropTypes.func ]),
onChange: PropTypes.func,
onBeforeChange: PropTypes.func
}
const mediaKeys = Object.keys(mediaQuery.all)
const excludedQueryKeys = Object.keys(defaultTypes)
Expand Down Expand Up @@ -62,7 +62,7 @@ export default class MediaQuery extends React.Component {

if (this._mql) {
this._mql.removeListener(this.updateMatches)
this._mql.dispose();
this._mql.dispose()
}

this._mql = matchMedia(this.query, values)
Expand All @@ -77,14 +77,14 @@ export default class MediaQuery extends React.Component {
}

componentDidUpdate(_, prevState) {
if(this.props.onChange && prevState.matches !== this.state.matches) {
this.props.onChange(this.state.matches)
}
if(this.props.onChange && prevState.matches !== this.state.matches) {
this.props.onChange(this.state.matches)
}
}

componentWillUnmount() {
this._mql.removeListener(this.updateMatches)
this._mql.dispose();
this._mql.dispose()
}

updateMatches = () => {
Expand Down

0 comments on commit 49919d0

Please sign in to comment.