Plugin version - 4.2.1
forEach is considered as a prop that I need to validate instead of being recognised as an inbuilt function.
Sample code below
import React, { PropTypes } from 'react';
function JobList(props) {
const jobs = [];
props
.jobs
.forEach(() => {}); // error here saying 'forEach missing in props validation'
return (
<div></div>
);
}
JobList.propTypes = {
jobs: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
})
),
};
Same thing for .map just fyi
Seems like any propType that is annotated as array or arrayOf should ignore all of the Array.prototype methods.
They are already ignored, but I seems there is a bug with line-breaks.
props
.jobs
.forEach(() => {}); // forEach missing in props validation
props.jobs.forEach(() => {}); // No warning
Most helpful comment
Same thing for
.mapjust fyi