jaredly / stylecleanup

Find & fix unused styles in react native and aphrodite
MIT License
112 stars 11 forks source link

Ignore StyleSheets that are destructured #4

Closed jeresig closed 7 years ago

jeresig commented 7 years ago

There was a StyleSheet that was immediately destructured, like so:

const {dimensions} = StyleSheet.create({
    dimensions: {
        height: ...,
        width: ....,
    },
});

This caused stylecleanup to crash as it has no valid binding for the file.

Test Plan: I tested my change against a file that had this syntax in it and it didn't crash (it also didn't analyze the StyleSheet, but I think that's ok since this is a pretty non-traditional situation).

jaredly commented 7 years ago

Awesome, this looks great for now. Thanks!