-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import-x/no-default-export
does not work in typescript
#144
Comments
Yeah I got the same error. no-default-export does not work in my project as well but import-x/prefer-default-export works correctly |
Just ran into this issue yesterday as well after converting from the forked import plugin to import-x. |
I am to re-produce the issue w/ the minimum re-production, but I can't re-produce within the unit test cases. |
Update: I have located the issue, I will create a PR to fix this. |
##### [v4.4.2](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#442) ##### Patch Changes - [#181](un-ts/eslint-plugin-import-x#181) [`cc4ee65`](un-ts/eslint-plugin-import-x@cc4ee65) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix [#144](un-ts/eslint-plugin-import-x#144), read proper `sourceType` for both eslint flat config and legacy eslintrc config.
Lets say we have simple (flat) config file
eslint.config.js
with only one rule'import-x/no-default-export': 'error',
and two files with identical content:
foo.js
foo.ts
eslint shows correctly
![js](https://private-user-images.githubusercontent.com/24324754/363444064-a40a42d4-cf8d-41df-a2a0-adf2cf1be923.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjczMDUsIm5iZiI6MTczOTYyNzAwNSwicGF0aCI6Ii8yNDMyNDc1NC8zNjM0NDQwNjQtYTQwYTQyZDQtY2Y4ZC00MWRmLWEyYTAtYWRmMmNmMWJlOTIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDEzNDMyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThiNThlZjI3MjgxZDYwMWQ3MmFkNGFlY2E4NDJkNjZkMTM0MDg5NGUxNWUzMTNiNzdjMTY3MTk3ZTUyNmJiY2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.N2LPEJIeRd6WDfDyc9dv6R34WG20udUWjh8DMd99_T0)
'import-x/no-default-export': 'error'
infoo.js
filewhile in
![ts](https://private-user-images.githubusercontent.com/24324754/363444524-a9caaea6-1bae-4d5c-a6f3-ba32683702e2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjczMDUsIm5iZiI6MTczOTYyNzAwNSwicGF0aCI6Ii8yNDMyNDc1NC8zNjM0NDQ1MjQtYTljYWFlYTYtMWJhZS00ZDVjLWE2ZjMtYmEzMjY4MzcwMmUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDEzNDMyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA2OGY4YjYxYzhjM2M3Njg5YjRjYmU0N2ZiZmUxOWRkM2U3Y2RmNDMwZWY3NzQ3YzU3NTk5Zjg2MGE2NDVhNTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.TP8Vk6DqAXeEklXXgDbpHBFlz9B2ATfDDuCxEB4ZfdQ)
foo.ts
it shows nothing:Here is a repo with replicated problem https://github.com/M-51/default-export-bug
Worth mentioning, other rules, for example opposite rule -
![named](https://private-user-images.githubusercontent.com/24324754/363445571-f256b09c-4704-4870-a2fd-ecb41a5f7be8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjczMDUsIm5iZiI6MTczOTYyNzAwNSwicGF0aCI6Ii8yNDMyNDc1NC8zNjM0NDU1NzEtZjI1NmIwOWMtNDcwNC00ODcwLWEyZmQtZWNiNDFhNWY3YmU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDEzNDMyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNjZjY3ZmJmNzE0YWQ1MWVkNmM1OGM1MTYxMDU1YzU3OTNjZmY0MTYwMzI4YzEzMmIzNGEwMjMzY2M0MjExYTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.J1PttwDIx1j_Seh2B2vPlWKyXixVM7Rf1USpRTg_mxE)
import-x/prefer-default-export
works correctly (when added) in the same environment in both JavaScript and Typescript.So it seems, it is only problem with
import-x/no-default-export'
The text was updated successfully, but these errors were encountered: