eslint-plugin-react-native icon indicating copy to clipboard operation
eslint-plugin-react-native copied to clipboard

split-platform-components not allowing another extensions

Open burtek opened this issue 6 years ago • 4 comments

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 avatar Aug 08 '19 10:08 burtek

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

burtek avatar Aug 08 '19 10:08 burtek

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.

Bekaxp avatar Aug 14 '19 20:08 Bekaxp

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

burtek avatar Aug 20 '19 09:08 burtek

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

Bekaxp avatar Mar 28 '20 19:03 Bekaxp