Skip to content

Commit

Permalink
Fix TS 2.0 one-line rule bug (originally palantir#1429) (palantir#1746)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchen63 authored Nov 19, 2016
1 parent be864a1 commit fbe5fd4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/oneLineRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class OneLineWalker extends Lint.RuleWalker {
public visitModuleDeclaration(node: ts.ModuleDeclaration) {
const nameNode = node.name;
const body = node.body;
if (body.kind === ts.SyntaxKind.ModuleBlock) {
if (body != null && body.kind === ts.SyntaxKind.ModuleBlock) {
const openBraceToken = body.getChildAt(0);
this.handleOpeningBrace(nameNode, openBraceToken);
}
Expand Down
3 changes: 3 additions & 0 deletions test/rules/one-line/all/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,6 @@ let geoConfig: {
timeout: 5000,
enableHighAccuracy: false
};

declare module "*";
declare module "someLibrary/*";
3 changes: 3 additions & 0 deletions test/rules/one-line/none/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,6 @@ let geoConfig: {
timeout: 5000,
enableHighAccuracy: false
};

declare module "*";
declare module "someLibrary/*";

0 comments on commit fbe5fd4

Please sign in to comment.