Skip to content

Commit

Permalink
fix whitespace rule in importClause with 'as' statement (palantir#4249)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyosukeFukushima authored and Josh Goldberg committed Nov 5, 2018
1 parent 0172fab commit ba0ed60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/whitespaceRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function walk(ctx: Lint.WalkContext<Options>) {
checkForTrailingWhitespace(token.getFullStart());
}
if (idx === 0) {
const startPos = internalName.getStart() - 1;
const startPos = element.getStart() - 1;
checkForTrailingWhitespace(startPos, startPos + 1);
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/rules/whitespace/all/test.ts.fix
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ import { importB } from "libB";
import { importC } from "libC";
import moduleD, { importD } from "libD";
import { importD, importE } from "libD";
import { importF as F } from "libF";
import { importF as F, importG as G } from "libF";

import {
importA,
Expand Down
7 changes: 7 additions & 0 deletions test/rules/whitespace/all/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ import moduleD, {importD}from "libD";
import {importD, importE} from "libD";
~ [missing whitespace]
~ [missing whitespace]
import {importF as F} from "libF";
~ [missing whitespace]
~ [missing whitespace]
import {importF as F,importG as G} from "libF";
~ [missing whitespace]
~ [missing whitespace]
~ [missing whitespace]

import {
importA,
Expand Down

0 comments on commit ba0ed60

Please sign in to comment.