-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: add the ability to configure typescript to javascript file extension conversion #112
Conversation
This is draft because I am not sure how to add the mapping to n/file-extension-in-import, any suggestions? 🤔 |
@aladdin-add Do you want me to make the tsconfig detection mechanism PR now, or wait for you to review this PR? 👀 |
sorry, haven't gotten time to review. will try to do it in the week. :)
Yes, please feel free to. You can rebase this change when it's been merged. |
@@ -69,13 +69,30 @@ If a path is relative, it will be resolved from CWD. | |||
|
|||
Default is `[]` | |||
|
|||
#### typescriptExtensionMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid duplication, I'm just wondering whether we could add a section to the readme that describes the shared settings. In the rule docs we can add a link to that. (surely not blocking merging this PR. 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! 👍
option && | ||
option.typescriptExtensionMap && | ||
Array.isArray(option.typescriptExtensionMap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: can be simply rewritten to Array.isArray(option?.typescriptExtensionMap)
, as the package has dropped node.js < v16.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I am totally going to fix this in another PR!
I just followed what was there 👀
Reference #108
This adds the ability to configure the ts<>js extension mapping.
This is configured using the following:
typescriptExtensionMap
node.typescriptExtensionMap
.ts
<=>.js
,.cts
<=>.cjs
,.mts
<=>.mjs
,.tsx
<=>.js