From f874822d1750008f4c10f6079cf6aeddf1c1e6e5 Mon Sep 17 00:00:00 2001 From: be5invis Date: Thu, 18 Jun 2020 22:48:52 -0700 Subject: [PATCH] [Tests] `order`/`newline-after-import`: Add unit tests for TypeScript's "export import" --- CHANGELOG.md | 3 +++ tests/src/rules/newline-after-import.js | 17 +++++++++++++++++ tests/src/rules/order.js | 15 +++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dbb5376ff..fbcb0a577f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 @@ -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 diff --git a/tests/src/rules/newline-after-import.js b/tests/src/rules/newline-after-import.js index 626e6e0261..4832cee799 100644 --- a/tests/src/rules/newline-after-import.js +++ b/tests/src/rules/newline-after-import.js @@ -213,6 +213,23 @@ 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' }, + }, ]), ], diff --git a/tests/src/rules/order.js b/tests/src/rules/order.js index 281baa2c90..25d046b51d 100644 --- a/tests/src/rules/order.js +++ b/tests/src/rules/order.js @@ -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: [