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

no-unused-styles does not support destructuring assignment

Open safaiyeh opened this issue 7 years ago • 9 comments

The styles are are marked as errors when the styles are destructed. Destructuring Assignment

class App extends Component {
  render() {
    const { container, welcome, instructions } = styles;

    return (
      <View style={container}>
        <Text style={welcome}>
          Welcome to React Native!
        </Text>
        <Text style={instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

safaiyeh avatar Feb 07 '17 06:02 safaiyeh

Thanks for the issue, that should definitely be supported.

Intellicode avatar Feb 07 '17 19:02 Intellicode

+1

jbreuer95 avatar Mar 29 '17 13:03 jbreuer95

+1

linnett avatar Jan 21 '19 11:01 linnett

+1

MrSucik avatar Apr 05 '19 15:04 MrSucik

+1

zchryst avatar Jul 02 '19 00:07 zchryst

Hello, unfortunately the problem still persists

SusulAdam avatar Apr 19 '21 10:04 SusulAdam

Any solution / workaround / alternative to this ?

jgutierrez11 avatar Apr 19 '21 18:04 jgutierrez11

#300

Added the support

Approve if you want to use it

tulitheprogrammer avatar Nov 01 '21 15:11 tulitheprogrammer

+1

Noitham avatar Sep 22 '22 09:09 Noitham