diff --git a/src/rules/whitespaceRule.ts b/src/rules/whitespaceRule.ts index 6872b3d3ce4..bb71127c55c 100644 --- a/src/rules/whitespaceRule.ts +++ b/src/rules/whitespaceRule.ts @@ -170,6 +170,22 @@ function walk(ctx: Lint.WalkContext) { } break; + case ts.SyntaxKind.ExportDeclaration: + const { exportClause } = node as ts.ExportDeclaration; + if (options.module && exportClause !== undefined) { + exportClause.elements.forEach((element, idx, arr) => { + if (idx === arr.length - 1) { + const token = exportClause.getLastToken()!; + checkForTrailingWhitespace(token.getFullStart()); + } + if (idx === 0) { + const startPos = element.getStart() - 1; + checkForTrailingWhitespace(startPos, startPos + 1); + } + }); + } + break; + case ts.SyntaxKind.FunctionType: checkEqualsGreaterThanTokenInNode(node); break; diff --git a/test/rules/whitespace/all/test.ts.fix b/test/rules/whitespace/all/test.ts.fix index d0f66104ac0..d5cc53cab29 100644 --- a/test/rules/whitespace/all/test.ts.fix +++ b/test/rules/whitespace/all/test.ts.fix @@ -84,9 +84,13 @@ export function each(obj, iterator, context) { // } -export {each as forEach}; +export { each as forEach }; import "libE"; +const E = 123; +const F = 123; +export { E, F }; + function foobar() {} function foorbar() diff --git a/test/rules/whitespace/all/test.ts.lint b/test/rules/whitespace/all/test.ts.lint index e28ba491892..62af54f9064 100644 --- a/test/rules/whitespace/all/test.ts.lint +++ b/test/rules/whitespace/all/test.ts.lint @@ -144,8 +144,17 @@ export function each(obj, iterator, context) { } export {each as forEach}; + ~ [missing whitespace] + ~ [missing whitespace] import "libE"; +const E = 123; +const F = 123; +export {E,F}; + ~ [missing whitespace] + ~ [missing whitespace] + ~ [missing whitespace] + function foobar(){} ~ [missing whitespace]