From 90ae1835a898205f0e9e3b3dc5f44e65bbd236bc Mon Sep 17 00:00:00 2001 From: Scott Newcomer Date: Sat, 12 Nov 2022 21:30:30 -0600 Subject: [PATCH] add some testes --- tests/src/rules/no-duplicates.js | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/src/rules/no-duplicates.js b/tests/src/rules/no-duplicates.js index 1530f9da3d..8191c493d0 100644 --- a/tests/src/rules/no-duplicates.js +++ b/tests/src/rules/no-duplicates.js @@ -572,6 +572,41 @@ context('TypeScript', function () { }, ], }), + test({ + code: "import {type x} from 'foo'; import type {y} from 'foo'", + ...parserConfig, + output: `import {type x,y} from 'foo'; `, + errors: [ + { + line: 1, + column: 22, + message: "'foo' imported multiple times.", + }, + { + line: 1, + column: 50, + message: "'foo' imported multiple times.", + }, + ], + }), + test({ + code: "import {type x} from './foo'; import {type y} from './foo'", + ...parserConfig, + options: [{ 'prefer-inline': true }], + output: `import {type x,type y} from './foo'; `, + errors: [ + { + line: 1, + column: 22, + message: "'./foo' imported multiple times.", + }, + { + line: 1, + column: 52, + message: "'./foo' imported multiple times.", + }, + ], + }), test({ code: "import {type x} from './foo'; import {type y} from './foo'", ...parserConfig,