Intellicode / eslint-plugin-react-native

React Native plugin for ESLint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Convert inline-styes into independent styles?

alamenai opened this issue · comments

Description

In react-native, eslint warns us to avoid inline-style in our components but it provides one solution by disabling the rule.
However, I'd recommend to add an option that let's convert inline-styles into independent styles.

Screenshot

Screen Shot 2021-03-31 at 10 41 30 AM

Example

 <Text style={{backgroundColor: 'green'}}>{section.title}</Text>

In the above snippet, eslint will have the ability to transform that rule into:

<Text style={styles.text}>{section.title}</Text>

const styles = StyleSheet.create({
  text: {
    backgroundColor: 'green'
  },
});