Intellicode / eslint-plugin-react-native

React Native plugin for ESLint
MIT License
722 stars 130 forks source link

split-platform-components not allowing another extensions #238

Open burtek opened 5 years ago

burtek commented 5 years ago

Right now split-platform-components has false-positives if file extension is different than js, i.e. jsx or tsx. This rule should be either extension-agnostic or at least allow providing option (regex?) so that .ios.jsx, .ios.tsx etc are considered correct.

image

burtek commented 5 years ago

I just found iosPathRegex and androidPathRegex in https://github.com/Intellicode/eslint-plugin-react-native/blob/master/lib/rules/split-platform-components.js. Too bad it's not documented in docs

Bekaxp commented 5 years ago

Thank you @burtek

I added a rule like this: rules: { 'react-native/split-platform-components': [ 2, { androidPathRegex: '\\.android.(js|jsx|ts|tsx)$', iosPathRegex: '\\.ios.(js|jsx|ts|tsx)$', }, ], }

This is now working for me. Maybe we should create a PR to update the documentation.

burtek commented 5 years ago

@Bekaxp feel free, I'm seriously short of time so I'm not going to do that in next few days

Bekaxp commented 4 years ago

@burtek sorry for the very loooong delay in creating this documentation update. The PR is open now. Thank you.