eslint-plugin-react-with-styles
Version:
ESLint plugin for react-with-styles
51 lines (40 loc) • 916 B
Markdown
The following patterns are considered warnings:
``` jsx
function MyComponent({ styles }) {
return (
<div {...css(styles.foo)}>
Foo
</div>
);
}
export default withStyles(() => ({
foo: {
backgroundColor: 'red',
},
bar: { // <--- this style is not used
backgroundColor: 'green',
},
}))(MyComponent);
```
The following patterns are not warnings:
``` jsx
function MyComponent({ styles }) {
return (
<div {...css(styles.foo)}>
Foo
</div>
);
}
export default withStyles(() => ({
foo: {
backgroundColor: 'red',
},
}))(MyComponent);
```
- Will not detect styles defined by computed properties.
- Will not detect styles defined by object spread.
- Will not handle files that contain multiple styled components very well.
- Will not handle `styles` prop that has been renamed to something else.