Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
requirePaddingNewLinesAfterBlocks: consider IIFE case
Browse files Browse the repository at this point in the history
Fixes #1555
  • Loading branch information
markelog committed Jul 24, 2015
1 parent c617a58 commit 512caa0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 1 addition & 5 deletions lib/rules/require-padding-newlines-after-blocks.js
Expand Up @@ -130,11 +130,7 @@ function isException(parent, exceptions) {

// Check if this block is used in call or array expression
if (exceptions[grandpa.type]) {
if (grandpa.arguments) {
return grandpa.arguments.indexOf(parent) > -1;
} else {
return true;
}
return true;
}

return false;
Expand Down
12 changes: 12 additions & 0 deletions test/specs/rules/require-padding-newlines-after-blocks.js
Expand Up @@ -178,6 +178,18 @@ describe('rules/require-padding-newlines-after-blocks', function() {
it('should not report missing padding when function is middle argument', function() {
assert(checker.checkString('func(\n3,\nfunction() {\n},\n2\n)').isEmpty());
});

it('should not report for IIFE', function() {
assert(checker.checkString('(function() {})\n(1,2,3)').isEmpty());
});

it('should report missing padding when function is last in array', function() {
assert(checker.checkString('[\n2,\n3,\nfunction() {\n}\n]').getErrorCount() === 1);
});

it('should report missing padding when function is middle in array', function() {
assert(checker.checkString('[\n3,\nfunction() {\n},\n2\n]').getErrorCount() === 1);
});
});

describe('value allExcept: inNewExpressions', function() {
Expand Down

0 comments on commit 512caa0

Please sign in to comment.