Eslint-plugin-react: ViewPropTypes can't be used with react/no-typos

Created on 22 Aug 2018  路  4Comments  路  Source: yannickcr/eslint-plugin-react

At this moment the way we can define View style propTypes is with helper ViewPropTypes which can be imported from 'react-native' package.

But eslint consider a typo here because of rule react/no-types:

AnyComponent = ({ style }) => (
  <View style={style}>
    <Text>Hi!</Text>
  </View>
);

AnyComponent.propTypes = {
  style: ViewPropTypes.style, // eslint-disable-line react/no-typos
};

Can be reproduced with extending .eslintrc with qlean-react-native config.

npm install -D eslint-config-qlean-react-native \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]
bug help wanted

Most helpful comment

This works well in the latest version, @vadimshvetsov would you be able to update?

All 4 comments

Is ViewPropTypes imported from somewhere?

@ljharb Yep, it's imported from react-native package:

import { ViewPropTypes } from 'react-native';

It's created for using in component PropTypes, when component extends View or using some of it props.

This works well in the latest version, @vadimshvetsov would you be able to update?

Yes, it's working in v7.11.1, thanks @alexzherdev

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CarlRosell picture CarlRosell  路  3Comments

mydearxym picture mydearxym  路  3Comments

strawbrary picture strawbrary  路  3Comments

inian picture inian  路  3Comments

otakustay picture otakustay  路  3Comments