Skip to content

Fix unused style fragment shorthand #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

marneborn
Copy link
Contributor

Components with shorthand Fragments (<></>) weren't being traversed in no-unused-styles.

Using these styles:

const styles = StyleSheet.create({
  used: {},
  unused: {},
});

const CorrectlyFails1 = () => {
  return (<Text style={styles.used}>Hello</Text>);
}
const CorrectlyFails1 = () => {
  return (<React.Fragment><Text style={styles.used}>Hello</Text></React.Fragment>);
}
const IncorrectlyPasses = () => {
  return (<><Text style={styles.used}>Hello</Text></>);
}

@Intellicode Intellicode merged commit c3781a3 into Intellicode:master Nov 29, 2020
@Intellicode
Copy link
Owner

thanks @marneborn!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants