Skip to content

Commit

Permalink
requireSpaceBeforeKeywords: hotfix for predefined list of keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
qfox committed Feb 15, 2016
1 parent c695048 commit 381496f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/require-space-before-keywords.js
Expand Up @@ -55,7 +55,7 @@ module.exports.prototype = {
excludedKeywords = keywords.allExcept;
}

keywords = defaultKeywords.filter(function(keyword) {
keywords = (keywords === true ? defaultKeywords : keywords).filter(function(keyword) {
return (excludedKeywords.indexOf(keyword) === -1);
});

Expand Down
10 changes: 10 additions & 0 deletions test/specs/rules/require-space-before-keywords.js
Expand Up @@ -121,4 +121,14 @@ describe('rules/require-space-before-keywords', function() {
expect(errors).to.have.one.validation.error.from('requireSpaceBeforeKeywords');
expect(errors.explainError(error)).to.have.string('Missing space before "function" keyword');
});

it('should not report keyword not in list #2135', function() {
checker.configure({ requireSpaceBeforeKeywords: ['nottypeof'] })

expect(checker.checkString(
'module.exports = function() {\n' +
' if (typeof value !== \'function\') { return false; }\n' +
'};\n'
)).to.have.no.errors()
});
});

0 comments on commit 381496f

Please sign in to comment.