Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Change normalisation of ordered-imports
Browse files Browse the repository at this point in the history
This makes it consistent with TypeScript's Organize Imports command

Fixes #4063
  • Loading branch information
Andrew Boyton committed Oct 9, 2018
1 parent 237fd90 commit 1d0985f
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/orderedImportsRule.ts
Original file line number Diff line number Diff line change
@@ -127,7 +127,7 @@ export class Rule extends Lint.Rules.AbstractRule {
type Transform = (x: string) => string;
const TRANSFORMS = new Map<string, Transform>([
["any", () => ""],
["case-insensitive", (x) => x.toLowerCase()],
["case-insensitive", (x) => x.toUpperCase()],
["lowercase-first", flipCase],
["lowercase-last", (x) => x],
["full", (x) => x],
4 changes: 4 additions & 0 deletions test/rules/ordered-imports/case-insensitive/test.ts.fix
Original file line number Diff line number Diff line change
@@ -6,6 +6,10 @@ import {A, B} from 'foo'; // failure
import {A, bz, C} from 'foo'; // failure
import {A, b, C} from 'zfoo';

// Underscores come last.
import {A, C, _b} from 'zfoo'; // failure
import {A, C, _b} from 'zfoo';

import {g} from "y"; // failure
import {
a as d,
5 changes: 5 additions & 0 deletions test/rules/ordered-imports/case-insensitive/test.ts.lint
Original file line number Diff line number Diff line change
@@ -9,6 +9,11 @@ import {bz, A, C} from 'foo'; // failure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Import sources within a group must be alphabetized.]
~~~~~ [Named imports must be alphabetized.]

// Underscores come last.
import {A, _b, C} from 'zfoo'; // failure
~~~~~ [Named imports must be alphabetized.]
import {A, C, _b} from 'zfoo';

import {
b as c,
~~~~~~~

0 comments on commit 1d0985f

Please sign in to comment.