From aebcde0cfb320a32ee707e7883d64588d552c0d1 Mon Sep 17 00:00:00 2001 From: PeachScript Date: Wed, 8 May 2024 19:17:50 +0800 Subject: [PATCH 1/2] fix: doctor import checkups is not work for jsx/tsx files --- src/doctor/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doctor/index.ts b/src/doctor/index.ts index 5a36f286..4d6a6394 100644 --- a/src/doctor/index.ts +++ b/src/doctor/index.ts @@ -139,7 +139,7 @@ export default async (api: IApi): Promise => { for (const file of sourceFiles) { // skip non-javascript files // TODO: support collect imports from style style pre-processor files - if (!/(? Date: Wed, 8 May 2024 19:22:32 +0800 Subject: [PATCH 2/2] test: add tsx case for imports checkup --- tests/fixtures/doctor/errors/src/component.tsx | 1 + tests/fixtures/doctor/errors/src/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/doctor/errors/src/component.tsx diff --git a/tests/fixtures/doctor/errors/src/component.tsx b/tests/fixtures/doctor/errors/src/component.tsx new file mode 100644 index 00000000..a222aa78 --- /dev/null +++ b/tests/fixtures/doctor/errors/src/component.tsx @@ -0,0 +1 @@ +export { default } from './CamelCase' diff --git a/tests/fixtures/doctor/errors/src/index.ts b/tests/fixtures/doctor/errors/src/index.ts index 4575d22f..d3501c0d 100644 --- a/tests/fixtures/doctor/errors/src/index.ts +++ b/tests/fixtures/doctor/errors/src/index.ts @@ -3,10 +3,10 @@ import orgAlias from '@org/alias'; import orgExternals from '@org/externals'; import alias from 'alias'; import path from 'child_process'; +import esm from 'esm'; import externals from 'externals'; import hello from 'hello'; -import BigCamelCase from './CamelCase'; -import esm from 'esm'; +import component from './component'; import './index.less'; // to avoid esbuild tree-shaking @@ -17,6 +17,6 @@ console.log( externals, orgExternals, path, - BigCamelCase, + component, esm, );