-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Use TypeScript build mode + ESLint #6897
Conversation
8363870
to
57d2da6
Compare
@marechal-p that's cool, could you have a look at windows build please |
While reviewing i skip ts file, i assume only tslint annotations are replaced by eslint. Is it correct? @marechal-p Or there are some code changes related to semantics? |
Should not be |
Have you tried to use the latest typescript and see whether it gives better perf results? There is |
watching is tremendously slow :( try to run |
The about dialog lives in Maybe I can add a
It did for me on VS Code, using the ESLint extension.
Yes, this is correct. I did change a few
I might have an idea why, I will experiment a bit with this. |
484304b
to
05ad6de
Compare
Let's finish first #6883 and then work on this PR with typescript extension from VS Code. Maybe it resolves some editing issues. Not having cross package navigation (in both direction) and content assist will be a blocker. |
It makes sense only if api are changed, don't get why ts recompiles everything when i replace some string in render method. Probably they will optimize it later. For now keeping the ability to watch individual packages as before will be good.
just keeping |
I've tried 3.8-beta for #6903 (comment), but it still has a regression for |
850fdac
to
50c8458
Compare
Done.
Fixed, this was due to some kind of issue with Please tell me if you find any other quirks. |
I will try after we land built-in extensions PR and rebase this PR. Otherwise it does not make sense to test against Theia extensions. Hopefully It happens tomorrow. |
@marechal-p Please rebase and I will try again. |
e3e8a09
to
6b512d0
Compare
Rebased. |
package.json
Outdated
"build": "run build", | ||
"build:clean": "run prepare", | ||
"clean": "yarn lint:clean && node scripts/run-reverse-topo.js yarn clean", | ||
"build": "tsc -b compile.tsconfig.json --verbose", |
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.
Could we move compile.tsconfig.json under config? Generally any config which does not has to be in the root has to be moved to config.
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.
Unfortunately, I don't think we can. Something to do with rootDir
and outDir
.
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.
Unless you mean only the root one.
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.
Yes, only keeping root clean from many config files
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 checked that:
- one can use as existing Theia distribution (current version of Gitpod Theia for instance) and Theia from sources and still get good editor support
- that build and watch scripts are still working, for watching it is better to use individual watches as before
That's unfortunate that we cannot run eslint over all files once yet, but it for sure going in the right direction. Thank you @marechal-p! Great job!
@marechal-p please mark relevant issues as to fix |
@marechal-p Have you tried this advice for linting in one go: typescript-eslint/typescript-eslint#1192 (comment) so instead of using compile.tsconfig.json, use tsconfig.json from the root which we use for editing as well then everything should be compiled as one program |
@akosyakov I will try your idea tomorrow and check if there are any issue :) |
1. use tsc build mode Packages are built in topological order, one after the other. Typescript recently added a "build" mode, that allows us to somewhat link all the packages together into one compilation step, speeding up compilation time. This commit makes use of this by rewiring the monorepo to use tsc build and incremental mode. Reworked a few scripts to accomodate with the new build method. 2. replace tslint with eslint Convert most tslint rules to eslint, changed most inline comments in the sources as well. Some tslint rules still work, hence why you will be able to see `// tslint` comments. Unfortunately, there is an outstanding issue regarding eslint performance on large typescript monorepos, so we should fallback to linting all packages individually until this is fixed. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
6b512d0
to
5353b33
Compare
Will merge on monday. |
What it does
Modified our tsconfigs to use TypeScript build mode. This means we can use incremental builds, and that tsc will be able to build a package dependencies if required. Build is faster.
Replaced tslint by eslint. This is the reason this patch is so heavy, had to rewritte most of our in-source comments that disabled rules for some lines/files.
I modified some of our build script so that it wouldn't clean everything anymore, but rather make use of caches (both tsc and eslint). You can still run the clean script, building will just not destroy caches by default now.
There is an issue with typescript-eslint where you cannot lint a whole project with too many packages. I did add a
lint:oneshot
script in our root package, but it tries to allocate 8GB of memory so that it doesn't crash.Until the issue is fixed, we will lint per package using lerna, like we used to do.
Full build time before: ~450s.
Build time now: ~310s first time, ~60s if nothing to do.
TypeScript is actually super fast with 1s execution time for tsc if there is nothing new. Linting + webpack bundling is what takes the most time, so it is still better to try and only trigger those when required, and not every time.
Fixes #4442
Fixes #2077
How to test
Build should still pass, you should be able to watch packages. Be worry that watching will also look at our workspace dependencies: If you watch
@theia/debug
and modify@theia/core
, the latter will get recompiled by the watcher. I think this is actually a good thing, but it used to not work that way.Linting should pass.
Review checklist
Reminder for reviewers