Skip to content

Commit dda23cc

Browse files
be5invisljharb
authored andcommitted
[Tests] order/newline-after-import: Add unit tests for TypeScript's "export import"
1 parent 4a38ef4 commit dda23cc

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
1515

1616
### Changed
1717
- [`no-extraneous-dependencies`]: add tests for importing types ([#1824], thanks [@taye])
18+
- [`order`]/[`newline-after-import`]: Add unit tests for TypeScript's "export import" ([#1830], thanks [@be5invis])
1819

1920
## [2.21.2] - 2020-06-09
2021
### Fixed
@@ -712,6 +713,7 @@ for info on changes for earlier releases.
712713

713714
[`memo-parser`]: ./memo-parser/README.md
714715

716+
[#1830]: https://github.com/benmosher/eslint-plugin-import/pull/1830
715717
[#1824]: https://github.com/benmosher/eslint-plugin-import/pull/1824
716718
[#1823]: https://github.com/benmosher/eslint-plugin-import/pull/1823
717719
[#1822]: https://github.com/benmosher/eslint-plugin-import/pull/1822
@@ -1235,3 +1237,4 @@ for info on changes for earlier releases.
12351237
[@fernandopasik]: https://github.com/fernandopasik
12361238
[@taye]: https://github.com/taye
12371239
[@AndrewLeedham]: https://github.com/AndrewLeedham
1240+
[@be5invis]: https://github.com/be5invis

Diff for: tests/src/rules/newline-after-import.js

+18
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,24 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
213213
parser: parser,
214214
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
215215
},
216+
{
217+
code: `
218+
export import a = obj;\nf(a);
219+
`,
220+
parser: parser,
221+
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
222+
},
223+
{
224+
code: `
225+
import { a } from "./a";
226+
227+
export namespace SomeNamespace {
228+
export import a2 = a;
229+
f(a);
230+
}`,
231+
parser: parser,
232+
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
233+
},
216234
]),
217235
],
218236

Diff for: tests/src/rules/order.js

+15
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,21 @@ ruleTester.run('order', rule, {
753753
},
754754
],
755755
}),
756+
test({
757+
code: `
758+
import { a } from "./a";
759+
export namespace SomeNamespace {
760+
export import a2 = a;
761+
}
762+
`,
763+
parser,
764+
options: [
765+
{
766+
groups: ['external', 'index'],
767+
alphabetize: { order: 'asc' },
768+
},
769+
],
770+
}),
756771
]),
757772
],
758773
invalid: [

0 commit comments

Comments
 (0)