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

Commit 5c66c2f

Browse files
committed
Fix: requirePaddingNewLineAfterVariableDeclaration - allow exported declarations
Fixes #1882
1 parent 1b37be5 commit 5c66c2f

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

lib/rules/require-padding-newline-after-variable-declaration.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ module.exports.prototype = {
6262
var endOfDeclaration = file.getLastNodeToken(node);
6363
var nextToken = file.getNextToken(endOfDeclaration);
6464

65+
// check export declaration
66+
if (nextToken.value === 'export') {
67+
nextToken = file.getNextToken(nextToken);
68+
}
69+
6570
if (nextToken.value in {'var': true, 'let': true, 'const': true}) {
6671
return;
6772
}

test/specs/rules/require-padding-newline-after-variable-declaration.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,10 @@ describe('rules/require-padding-newline-after-variable-declaration', function()
108108
'});'
109109
)).to.have.no.errors();
110110
});
111+
112+
it('should not error on es6 exports #1882', function() {
113+
expect(checker.checkString('export var a = 1;')).to.have.no.errors();
114+
expect(checker.checkString('export let a = 1;')).to.have.no.errors();
115+
expect(checker.checkString('export const a = 1;')).to.have.no.errors();
116+
});
111117
});

0 commit comments

Comments
 (0)