airbnb / airbnb/javascript

Exception for space-before-keywords?

Open
#713 2 comments 0 reactions 0 assignees View on GitHub
needs eslint rule change/addition
Dominant language
JavaScript
Stars
148k
Forks
26.6k
PR merge metrics
No merged PRs in 30d

Description

Writing a React/redux app, I am occasionally declaring anonymous classes inside function calls:

``` javascript
export default connect()(class extends Component {
// React component class definition
});
```

which gives this error: `Missing space before keyword "class". (space-before-keywords)`.

If I put a space there:

``` javascript
export default connect()( class extends Component {
// React component class definition
});
```

It fails another rule: `There should be no spaces inside this paren. (space-in-parens)`.

Was wondering if that was an unintended effect of the `space-before-keywords` or if everything is working as expected.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported anonymous class example with the project's ESLint rules, then inspect how space-before-keywords and space-in-parens are configured. Done means the project has a decided, documented behavior for this syntax and the corresponding rule configuration or test demonstrates it.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, react, redux
Domain
frontend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.