-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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 JSDoc enforcement + some sort of type checking for build-system/
#28387
Comments
/cc @ampproject/wg-infra and @ampproject/wg-runtime for opinions / ideas. |
What if we wrote build-system in TypeScript? |
Typescript would be cool, and you won't need to spin up a java process to typecheck. The Typescript language server can be spun up by your editor by default, and run the checks incrementally as you code. |
Agree build system is a good target for Typescript. Explicitly defining some of the types might also make obvious some ways to organize existing infra |
I agree with the long-term goal of moving to TS. However, I suspect it will be a multi-quarter effort to rewrite the 40K+ lines of JS code in Meanwhile, I think it's worth enforcing and backfilling JSDoc annotations, which should take substantially less time than a full rewrite, and help avoid simple coding bugs. Also, the link I shared in the issue description seems to suggest that it's possible to directly type-check JSDoc in |
I don't think a full rewrite is needed before we can start using TS, we can adopt it incrementally. Some possible ways include:
|
Dusting off this old issue and assigning to our new Infra friend @rileyajones, who mentioned wanting to do something like this today 😃 |
I'll echo |
I would instead suggest using JS syntax only with Typescript JSDoc annotations. 0 runtime dependencies to run the code, which means running |
With #34544, we have started type-checking |
For the AMP runtime, we enforce JSDoc requirements for all code, and check types using closure compiler. However,
build-system/
currently lacks JSDoc enforcement, and we do not type-check it using closure.This issue is to track two things:
eslint
plugin that can do it?The text was updated successfully, but these errors were encountered: