Skip to content

Commit

Permalink
[Tests] no-duplicates: add passing test
Browse files Browse the repository at this point in the history
Closes #2840
  • Loading branch information
ljharb committed Nov 25, 2023
1 parent 12f0300 commit 9fd3c42
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/src/rules/no-duplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,68 @@ import {x,y} from './foo'
errors: ["'../constants' imported multiple times.", "'../constants' imported multiple times."],
...jsxConfig,
}),

test({
code: `
import {A1,} from 'foo';
import {B1,} from 'foo';
import {C1,} from 'foo';
import {
A2,
} from 'bar';
import {
B2,
} from 'bar';
import {
C2,
} from 'bar';
`,
output: `
import {A1,B1,C1} from 'foo';
${''}
import {
A2,
${''}
B2,
C2} from 'bar';
${''}
`,
errors: [
{
message: "'foo' imported multiple times.",
line: 2,
column: 27,
},
{
message: "'foo' imported multiple times.",
line: 3,
column: 27,
},
{
message: "'foo' imported multiple times.",
line: 4,
column: 27,
},
{
message: "'bar' imported multiple times.",
line: 8,
column: 16,
},
{
message: "'bar' imported multiple times.",
line: 11,
column: 16,
},
{
message: "'bar' imported multiple times.",
line: 14,
column: 16,
},
],
...jsxConfig,
}),
],
});

Expand Down

0 comments on commit 9fd3c42

Please sign in to comment.