Skip to content

Commit

Permalink
Enforce the newline-before-return rule
Browse files Browse the repository at this point in the history
  • Loading branch information
filipefigcorreia committed Jan 18, 2017
1 parent e7490c8 commit 2e561d1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ module.exports = {
'new-cap': 'error',
'new-parens': 'error',
'newline-after-var': 'error',
'newline-before-return': 'error',
'no-alert': 'error',
'no-array-constructor': 'error',
'no-bitwise': 'error',
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/correct.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ const newLineAfterVar = 'foo';

noop(newLineAfterVar);

// `newline-before-return`.
function funcThatReturns(bar) {
if (!bar) {
return;
}

return bar;
}

funcThatReturns('foo');

// `no-class-assign`.
class NoClassAssign { }

Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/incorrect.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ const newCap = new cap();
const newLineAfterVar = 'foo';
noop(newLineAfterVar);

// `newline-before-return`.
function funcThatReturns(bar) {
if (!bar) {
return;
}
return bar;
}

// `no-class-assign`.
class NoClassAssign { }

Expand Down
1 change: 1 addition & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('eslint-config-seegno', () => {
'mocha/no-exclusive-tests',
'new-cap',
'newline-after-var',
'newline-before-return',
'no-class-assign',
'no-const-assign',
'no-constant-condition',
Expand Down

0 comments on commit 2e561d1

Please sign in to comment.