-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improvement: Set foundation to improve migrate-to-typescript efficiency #6248
Comments
Do you have some references for this? The last time I looked it seemed there was no real standard... The only reason we haven't enforced the change to not using relative imports really is that it would cause conflicts with the ~100 open PRs. There is a plan to focus on these types of improvements for the 10.11 release though so now is probably the best time to make such a change. |
"Standard" is certainly not the right word to use in this case. Coffee-brain and hyping my own ticket probably led to this 😄 I believe the issue with no prefix is that it isn't immediately clear to the developer (someone coming in fresh as i did) where the package lives—there's a need to check: "is it relative to my current directory?"; "why do some use The problem with allowing for
I believe the MR takes this into consideration since |
I just checked the Bulletproof React docs and they recommend using https://github.com/alan2207/bulletproof-react/blob/master/docs/project-standards.md#absolute-imports |
In order to migrate to Typescript efficiently, and more importantly with open source, iteratively, we need to be able to migrate one to a few js files to ts at a time. Until a JS file is migrated to TS, we need something like the following in place to avoid errors in the files that have been migrated to typescript.
The issue with the above declaration is that some files refer to
./scripts/,
while others refer toscripts/.
To support a typescript migration, we should add an alias to webpack and to tsconfig for our base directories insrc/
such as:"@scripts/*": ["scripts/*"],
The
@
serves as a standard indicator to future devs that it is an alias or that, at least, it is not a relative path to the current directory (for components requesting from a subdirectory).tl;dr:
eslint-import-resolver-typescript
declare module '@alias/...
. To help each file we migrate to ts to understand how their imported packages work.The above will help devs to efficiently and iteratively migrate JS files to typescript.
The text was updated successfully, but these errors were encountered: