Skip to content

Commit

Permalink
fix: doctor import checkups is not work for jsx and tsx files (#754)
Browse files Browse the repository at this point in the history
* fix: doctor import checkups is not work for jsx/tsx files

* test: add tsx case for imports checkup
  • Loading branch information
PeachScript committed May 9, 2024
1 parent a6ec5b9 commit 7b27d78
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/doctor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default async (api: IApi): Promise<IDoctorReport> => {
for (const file of sourceFiles) {
// skip non-javascript files
// TODO: support collect imports from style style pre-processor files
if (!/(?<!\.d)\.(j|t)s$/.test(file)) continue;
if (!/(?<!\.d)\.(j|t)sx?$/.test(file)) continue;

importsReport.push(
...(await api.applyPlugins({
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/doctor/errors/src/component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './CamelCase'
6 changes: 3 additions & 3 deletions tests/fixtures/doctor/errors/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,6 +17,6 @@ console.log(
externals,
orgExternals,
path,
BigCamelCase,
component,
esm,
);

0 comments on commit 7b27d78

Please sign in to comment.