We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ddfd1c commit fc06f85Copy full SHA for fc06f85
lib/rules/no-typos.js
@@ -151,11 +151,14 @@ module.exports = {
151
} else if (node.source && node.source.value === 'react') { // import { PropTypes } from "react"
152
reactPackageName = node.specifiers[0].local.name;
153
154
- propTypesPackageName = node.specifiers.length >= 1 ? (
155
- node.specifiers
156
- .filter(specifier => specifier.imported && specifier.imported.name === 'PropTypes')
157
- .map(specifier => specifier.local.name)
158
- )[0] : null;
+ if (node.specifiers.length >= 1) {
+ const propTypesSpecifier = node.specifiers.find(specifier => (
+ specifier.imported && specifier.imported.name === 'PropTypes'
+ ));
+ if (propTypesSpecifier) {
159
+ propTypesPackageName = propTypesSpecifier.local.name;
160
+ }
161
162
}
163
},
164
0 commit comments