-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
no-duplicates
: Prefer combined type and regular imports when …
…using `prefer-inline`
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -711,6 +711,25 @@ context('TypeScript', function () { | |
}, | ||
], | ||
}), | ||
// #2834 Detect duplicates across type and regular imports | ||
test({ | ||
code: "import {AValue} from './foo'; import type {AType} from './foo'", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ljharb
Member
|
||
...parserConfig, | ||
options: [{ 'prefer-inline': true }], | ||
output: `import {AValue,type AType} from './foo'; `, | ||
errors: [ | ||
{ | ||
line: 1, | ||
column: 22, | ||
message: "'./foo' imported multiple times.", | ||
}, | ||
{ | ||
line: 1, | ||
column: 56, | ||
message: "'./foo' imported multiple times.", | ||
}, | ||
], | ||
}), | ||
]); | ||
|
||
ruleTester.run('no-duplicates', rule, { | ||
|
@benkrejci @ljharb Hi folks! There is one rule/step here that, if happens before this rule, makes this change not necessary. Once a type import is fixed to an inline type import, then the
no-duplicates
rule fixes it properly#2473