File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import { convertNoConstantCondition } from "./converters/no-constant-condition";
3838import { convertNoConstruct } from "./converters/no-construct" ;
3939import { convertNoControlRegex } from "./converters/no-control-regex" ;
4040import { convertNoDebugger } from "./converters/no-debugger" ;
41+ import { convertNoDuplicateImports } from "./converters/no-duplicate-imports" ;
4142import { convertNoDuplicateSuper } from "./converters/no-duplicate-super" ;
4243import { convertNoDuplicateSwitchCase } from "./converters/no-duplicate-switch-case" ;
4344import { convertNoEmpty } from "./converters/no-empty" ;
@@ -140,6 +141,7 @@ export const converters = new Map([
140141 [ "no-conditional-assignment" , convertNoConditionalAssignment ] ,
141142 [ "no-construct" , convertNoConstruct ] ,
142143 [ "no-debugger" , convertNoDebugger ] ,
144+ [ "no-duplicate-imports" , convertNoDuplicateImports ] ,
143145 [ "no-duplicate-super" , convertNoDuplicateSuper ] ,
144146 [ "no-duplicate-switch-case" , convertNoDuplicateSwitchCase ] ,
145147 [ "no-empty-interface" , convertNoEmptyInterface ] ,
Original file line number Diff line number Diff line change 1+ import { RuleConverter } from "../converter" ;
2+
3+ export const convertNoDuplicateImports : RuleConverter = tslintRule => {
4+ return {
5+ rules : [
6+ {
7+ ...( tslintRule . ruleArguments . includes ( "allow-namespace-imports" ) && {
8+ notices : [ "ESLint does not support optional config allow-namespace-imports." ] ,
9+ } ) ,
10+ ruleName : "no-duplicate-imports" ,
11+ } ,
12+ ] ,
13+ } ;
14+ } ;
Original file line number Diff line number Diff line change 1+ import { convertNoDuplicateImports } from "../no-duplicate-imports" ;
2+
3+ describe ( convertNoDuplicateImports , ( ) => {
4+ test ( "conversion without arguments" , ( ) => {
5+ const result = convertNoDuplicateImports ( {
6+ ruleArguments : [ ] ,
7+ } ) ;
8+
9+ expect ( result ) . toEqual ( {
10+ rules : [
11+ {
12+ ruleName : "no-duplicate-imports" ,
13+ } ,
14+ ] ,
15+ } ) ;
16+ } ) ;
17+
18+ test ( "conversion with allow-namespace-imports argument" , ( ) => {
19+ const result = convertNoDuplicateImports ( {
20+ ruleArguments : [ "allow-namespace-imports" ] ,
21+ } ) ;
22+
23+ expect ( result ) . toEqual ( {
24+ rules : [
25+ {
26+ notices : [ "ESLint does not support optional config allow-namespace-imports." ] ,
27+ ruleName : "no-duplicate-imports" ,
28+ } ,
29+ ] ,
30+ } ) ;
31+ } ) ;
32+ } ) ;
You can’t perform that action at this time.
0 commit comments