-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bad propType warnings #3
base: master
Are you sure you want to change the base?
Conversation
@jacopotarantino Thanks for your PR and sorry so late, just now seeing this. Reviewing... |
import ReactPrecacheImg from './react-precache-img'; | ||
|
||
export { ReactPrecacheImg }; | ||
export default ReactPrecacheImg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to update the function name in src/react-precache-img.js
from PreCacheImg
to ReactPrecacheImg
instead?
@@ -50,9 +50,11 @@ | |||
"eslint-plugin-jsx-a11y": "^3.0.2", | |||
"eslint-plugin-react": "^6.9.0", | |||
"jest-cli": "^18.1.0", | |||
"prop-types": "^15.7.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved to dependencies
import ReactDOM from 'react-dom'; | ||
import TestUtils from 'react-addons-test-utils'; | ||
import ReactPreCacheImgDemo from '../src/ReactPreCacheImgDemo.jsx' | ||
import renderer from 'react-test-renderer'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting the following failures when running npm run test
:
| ~/projects/react-precache-img @ MacBook-Pro (mcarlucci)
| => npm run test
> [email protected] test /Users/mcarlucci/projects/react-precache-img
> BABEL_JEST_STAGE=0 jest
PASS __tests__/index-test.js
FAIL __tests__/ReactPreCacheImg-test.js
● Test suite failed to run
TypeError: Cannot read property 'hasOwnProperty' of undefined
at node_modules/react-test-renderer/cjs/react-test-renderer.development.js:151:27
at Object.<anonymous> (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13241:5)
at Object.<anonymous> (node_modules/react-test-renderer/index.js:6:20)
at Object.<anonymous> (__tests__/ReactPreCacheImg-test.js:4:52)
at process._tickCallback (internal/process/next_tick.js:68:7)
FAIL __tests__/ReactPreCacheImgDemo-test.js
● Test suite failed to run
TypeError: Cannot read property 'hasOwnProperty' of undefined
at node_modules/react-test-renderer/cjs/react-test-renderer.development.js:151:27
at Object.<anonymous> (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13241:5)
at Object.<anonymous> (node_modules/react-test-renderer/index.js:6:20)
at Object.<anonymous> (__tests__/ReactPreCacheImgDemo-test.js:4:52)
at process._tickCallback (internal/process/next_tick.js:68:7)
Test Suites: 2 failed, 1 passed, 3 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 1.071s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `BABEL_JEST_STAGE=0 jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mcarlucci/.npm/_logs/2019-05-09T05_40_55_956Z-debug.log
"semi": true, | ||
"singleQuote": true, | ||
"arrowParens": "always" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file an oversight? I don't see any packages installed or npm scripts that would leverage this file. I'm certainly not opposed to adding it, although eslint already supports prettier formatting that can be installed using the ESLint ecosystem. See https://prettier.io/docs/en/integrating-with-linters.html
This work fixes an issue where propTypes was specifying
arrayOf.isRequired
where#arrayOf
is actually a method and should have been fed an argument as such:arrayOf(propTypes.string).isRequired
.While working on this I also took the liberty of updating some tests and imports to further enhance future compatibility.