Skip to content

Commit

Permalink
eslint: Add missing space-before-keywords rule
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
adrienverge committed Oct 23, 2015
1 parent 89d1e07 commit ab0a6ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/eslint-config-airbnb/rules/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ module.exports = {
'semi': [2, 'always'],
// sort variables within the same declaration block
'sort-vars': 0,
// require a space before certain keywords
'space-before-keywords': [2, 'always'],
// require a space after certain keywords
'space-after-keywords': 2,
'space-after-keywords': [2, 'always'],
// require or disallow space before blocks
'space-before-blocks': 2,
// require or disallow space before function opening parenthesis
Expand Down

0 comments on commit ab0a6ca

Please sign in to comment.