airbnb / airbnb/eslint-plugin-react-with-styles

Rule proposal: no undefined styles

Open
#3 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
48
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Similar to #2, it would be nice to have a rule that enforces the inverse: using styles that are not defined.

Bad:

``` jsx
function MyComponent({ styles }) {
return (


Foo

);
}

export default withStyles(() => ({
foo: {
backgroundColor: 'red',
},
}))(MyComponent);
```

Good:

``` jsx
function MyComponent({ styles }) {
return (


Foo

);
}

export default withStyles(() => ({
foo: {
backgroundColor: 'red',
},

bar: {
color: 'white',
},
}))(MyComponent);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the related issue #2 and the repository's existing rule structure and tests. Define the rule's handling of style references such as styles.foo and styles.bar, then add coverage showing that every referenced style is defined before considering the work complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.