airbnb / airbnb/eslint-plugin-react-with-styles
Rule proposal: no raw media queries
- Dominant language
- JavaScript
- Stars
- 48
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
It is good for media queries to be in sync for an entire application. It would be nice to have a rule that prevented raw, one-off media queries in favor of supplying them by the theme.
Bad:
``` js
export default withStyles(() => ({
'@media (max-width: 600px)': {
backgroundColor: 'red',
},
}))(MyComponent);
```
Good:
``` js
export default withStyles(({ breakpoint }) => ({
[breakpoint.small]: {
backgroundColor: 'red',
},
}))(MyComponent);
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the repository's existing ESLint rules and tests, then compare the issue's Bad and Good examples. Add coverage showing that raw media-query keys are rejected while theme-provided breakpoint keys are accepted; done means the rule reports the former and allows the latter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100