Skip to content

Commit

Permalink
[Tests] order/newline-after-import: Add unit tests for TypeScript…
Browse files Browse the repository at this point in the history
…'s "export import"
  • Loading branch information
be5invis authored and ljharb committed Jun 19, 2020
1 parent 4a38ef4 commit dda23cc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

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

## [2.21.2] - 2020-06-09
### Fixed
Expand Down Expand Up @@ -712,6 +713,7 @@ for info on changes for earlier releases.

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

[#1830]: https://github.com/benmosher/eslint-plugin-import/pull/1830
[#1824]: https://github.com/benmosher/eslint-plugin-import/pull/1824
[#1823]: https://github.com/benmosher/eslint-plugin-import/pull/1823
[#1822]: https://github.com/benmosher/eslint-plugin-import/pull/1822
Expand Down Expand Up @@ -1235,3 +1237,4 @@ for info on changes for earlier releases.
[@fernandopasik]: https://github.com/fernandopasik
[@taye]: https://github.com/taye
[@AndrewLeedham]: https://github.com/AndrewLeedham
[@be5invis]: https://github.com/be5invis
18 changes: 18 additions & 0 deletions tests/src/rules/newline-after-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,24 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
parser: parser,
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
},
{
code: `
export import a = obj;\nf(a);
`,
parser: parser,
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
},
{
code: `
import { a } from "./a";
export namespace SomeNamespace {
export import a2 = a;
f(a);
}`,
parser: parser,
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
},
]),
],

Expand Down
15 changes: 15 additions & 0 deletions tests/src/rules/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,21 @@ ruleTester.run('order', rule, {
},
],
}),
test({
code: `
import { a } from "./a";
export namespace SomeNamespace {
export import a2 = a;
}
`,
parser,
options: [
{
groups: ['external', 'index'],
alphabetize: { order: 'asc' },
},
],
}),
]),
],
invalid: [
Expand Down

0 comments on commit dda23cc

Please sign in to comment.