-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add TypeScript tooling and configs #2360
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8210bea:
|
Nice! I rebased (locally) my PR off your branch. It looks like there is a conflict between ESLint and Prettier when defining types and interfaces: ESLint will complain about commas and semicolons: While prettier seems to think we have bad syntax when there is neither: |
@rjdestigter Yeah, I noticed that as well! I think it has to do with |
I made a few changes that moved this forward:
This puts us at 38 errors and 61 warnings. The warnings are all for |
Hoping to take a look at the review comments later today. |
I made a few more changes this morning. If I add an Thoughts? |
@@ -0,0 +1,4 @@ | |||
{ |
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.
Can't leave a comment on the diff but packages/babel-plugin-jsx-pragmatic/tsconfig.json
being empty looks to be the cause for the Flow CI issue.
yarn.lock
Outdated
version "4.2.4" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961" | ||
integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg== | ||
|
||
typescript@next: |
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.
I think you'll want to combine these typescript
versions. Eventually the project will use TypeScript language features post-3.6.0 and dtslint might break on them if it's using the old version.
typescript@next, typescript@^4.2.4:
tsconfig.json
Outdated
"target": "es5" | ||
}, | ||
"include": ["packages", "scripts", "site", "test", "playgrounds"], | ||
"exclude": ["node_modules"] |
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.
I've found myself doing this in my own integration branch to get TypeScript to not complain about all the $ExpectError
dts tests:
"exclude": ["node_modules"] | |
"exclude": ["node_modules", "packages/*/types/test*"] |
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.
I guess, more broadly, what is the strategy for .d.ts
generation? Should a build step like build:types
be added that runs tsc --declaration
into types/
folders?
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.
I guess, more broadly, what is the strategy for .d.ts generation? Should a build step like build:types be added that runs tsc --declaration into types/ folders?
This one is covered by Preconstruct which we are using to build all packages. You can check out example output containing TS declarations here:
https://unpkg.com/browse/@changesets/cli@2.14.0/dist/
@with-heart I got a passing build on this separate PR: JoshuaKGoldberg#1 Now that the Prettier update is in |
fd4e065
to
feafd8e
Compare
Welp, I've updated the branch but I was being mindless and rebased. My bad for throwing a wrench into things, wasn't really thinking. |
This all looks good either way 😄 , I'll get my branch updated hopefully end of this week! @with-heart, other than updating JoshuaKGoldberg#1, is there anything you'd like me to do to help? I think once that's updated it would be ready to be merged in here? |
@with-heart friendly 🏓 would you mind taking a look at what's up with CI? |
I fixed the issue with the |
@with-heart thank you for this! ❤️ |
What:
This PR is an attempt to add TypeScript-related tooling and config required to complete the conversion from Flow to TypeScript.
First step was getting
eslint
to run without any configuration errors (which @rjdestigter was running into in #2359), which seems to working for the most part. Also created a roottsconfig.json
and tsconfig files for each package which extend from the root, since all of the existing were already duplicating the same config.Why:
#2358
How:
tsconfig.json
which specifies thecompilerOptions
shared by all of the existingtsconfig.json
filesinclude
to["packages", "scripts", "site", "test", "playgrounds"]
"strict": true
tsconfig.json
files at root of each packageextends
for each to roottsconfig.json
compilerOptions
from all as they now inherit these from the rootinclude
for each to"src"
eslint
to support ts@typescript-eslint/parser
&@typescript-eslint/eslint-config
eslint-config-standard
toeslint-config-standard-with-typescript
parserOptions.project
to roottsconfig.json
no-use-before-define
and enabled@typescript-eslint/no-use-before-define
aswarn
@babel/preset-typescript
package and added topresets
inbabel.config.js
Checklist:
I haven't even attempted to build anything yet or actually convert files to ts. It seems like a lot of the base tooling- and config-related stuff probably needs to be dealt with first in order to support the conversion of actual packages.
I'd like to expand the checklist to include remaining items to handle, but I need some feedback and to explore a little more to determine what else there is to do.