Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint: Add missing space-before-keywords rule #554

Merged
merged 1 commit into from
Oct 23, 2015

Conversation

adrienverge
Copy link
Contributor

All examples in README.md seem to agree on avoiding missing whitespaces before keywords such as:

if (cond) {
}else {       // no space before 'else'
}

try {
}catch (e) {  // no space before 'catch'
}

This patchs adds the space-before-keywords rule as an error (as is space-after-keywords already).

@ljharb
Copy link
Collaborator

ljharb commented Oct 23, 2015

LGTM 👍

(altho it might be nice to specify [2, "always"] on both keyword spacing rules to make it clear what behavior we want, even though it's the default)

@adrienverge adrienverge force-pushed the space-before-keywords branch from 4cf0015 to 3d4072a Compare October 23, 2015 08:51
@adrienverge
Copy link
Contributor Author

@ljharb Good idea, done! Also added "always" to space-after-keywords to be clear.

All examples in README.md seem to agree on avoiding missing whitespaces
before keywords such as:

    if (cond) {
    }else {       // no space before 'else'
    }

    try {
    }catch (e) {  // no space before 'catch'
    }

This patchs adds the `space-before-keywords` rule as an error (as is
`space-after-keywords` already).
@adrienverge adrienverge force-pushed the space-before-keywords branch from 3d4072a to ab0a6ca Compare October 23, 2015 08:57
@ljharb
Copy link
Collaborator

ljharb commented Oct 23, 2015

Thanks, this looks great! I'll defer merging this to @justjake.

@justjake
Copy link
Collaborator

👍

justjake added a commit that referenced this pull request Oct 23, 2015
eslint: Add missing `space-before-keywords` rule
@justjake justjake merged commit 01ba082 into airbnb:master Oct 23, 2015
@taion
Copy link
Contributor

taion commented Oct 25, 2015

Isn't the 'always' redundant here, given that it's the default?

@ljharb
Copy link
Collaborator

ljharb commented Oct 26, 2015

s/redundant/explicit. Just because it's the default doesn't mean we shouldn't explicitly specify it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants