-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
chore: added type checking using comments #2107
chore: added type checking using comments #2107
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2107 +/- ##
=======================================
Coverage 92.56% 92.56%
=======================================
Files 33 33
Lines 1265 1265
Branches 361 361
=======================================
Hits 1171 1171
- Misses 87 89 +2
+ Partials 7 5 -2
Continue to review full report at Codecov.
|
In my option, maintenance of jsdoc is difficult and the possibility of information becoming old becomes high. If you want to introduce types, I think you should move to typescript. If the migration is hard, I will do it. Anyway, I'm -1 on this changes. |
I am not aiming to create a doc with this, just as type checking in lint! that too not for all directories, just those utilities! |
We've already had |
@evilebottnawi I wanna know what you think. Honestly, I wanna migrate to typescript, so if you agree with me, I'll migrate to typescript on next branch. |
/cc @hiroppy better use JSDoc for typescript, it is allow to start migration right now, without major release (we already have many issue for major release, migration on typescriptse increase time to next major release), also it is allow to other users don't know typescript and still contributing webpack-dev-server (we can add types in other PRs), also webpack use same strategies for types so i think it is good idea use types using JSDoc |
sorry but I can't agree with these changes. First, if we want to migrate to typescript, please show me the roadmap. Secand, jsdoc is a bad idea, typescript has allowJS option, so we can migrate to typescript slowly. Also, learning jsdoc costs as same as learning typescript. Sorry but I’m sure this is technical debt. If you use allowJS option, I’ll agree with you. Anyway, first, we must decide we want to migrate to typescript or not. Really sorry. |
I think yes, sometimes i look on code in some places and can't remember possible types and in some places it is help to maintain, i don't want use pure typescript because it can be hard for other developers to send PRs with fixes so i think using types through JSDocs is good idea. It is not hard priority for us bug it is help to us.
Can you clarify? |
I think if we migrate with removing the For me, JSDocs is an option which we need even after migrating to TS, not just for now, plus it's giving us the advantage of having a type checking in build too. and without any major change! Having this and then migrating to TS will help a lot with the migration as we would be having the types in the comment I think webpack core package might have faced the same problem of too much load with migration that's why they have this in the codebase |
If we use JSdoc, when will we move to TypeScript? If you do not make it clear, you can not make a migration forever. why I think we should avoid Jsdoc?
typescript is difficult or not?Many users have already used typescript, and I think typescript is not difficult because we can use https://www.npmjs.com/package/typescript my ideaIf you want to migrate to typescript step by step, you can change only that file as typescript using allowJS. finallyI have experience of moving from flow to typescript in a large-scale product. I think there is no need to make the type strong from the beginning. We used allowJS to migrate to TypeScript. |
Should we migrate on typescript fully? webpack use JSDoc for type and all fine so we can do this also, also you can find other popular packages what written on js and use ts only as linting, for example https://github.com/sindresorhus/execa
It is not hard to track, also we ccan configure typescript report about this, types should help to us and don't increase work time on issues/features so JSDos is ok solution
look at it from the side that this is just another linter for our code, it is not new language or something also, just linter as eslint
yep, typescript is not difficult, rewriting can take us time and for novice users who very often uses webpack, it can be difficult, so will be great keep code in js and use types as part of lint process |
agreed 👍
yeah, we can use But for time being sure we can use Then as per my view if the whole need to migrate to TS (even with step by step using
|
Here my 2 cents.
A technical clarification: JSDoc means "Using |
/cc @hiroppy |
@sokra Thank you for answering. As I said,
First, I hope we must decide on this choice. If we don't migrate to typescript, I agree to jsdoc, but I think it is easy to migrate to typescript using |
I prefer jsdoc, because it is easy for other developers contribute package, also it is allow to developers solve all on js and when if it is accepted, add types without additional time wasting. Also we can add types step by step without rewriting on typescript and do not spend a lot of time on this and the money of our sponsors |
either of both looks good !... |
My thoughts:
|
As I said above I prefer to migrate to typescipt rather than using jsdoc. But I respect @evilebottnawi's opinion. Agree with you.
|
@evilebottnawi Yes, I wanna create a tracking issue like this for contributors and us. |
Can we have a review on this (on those types)?? |
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.
@evilebottnawi I agree with what you said here:
JSDoc seems easy enough to add in, and I agree that typescript can be an additional barrier for contributors. This looks good to me. |
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
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.
👍 Don't forget we focus on websockets
and CLI
and next major release in near future, so types is not high priority right
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.
fix CI errors. LGTM.
For Bugs and Features; did you add new tests?
Added script to do type linting in build
Motivation / Use-Case
As this package as quite a more number of utility methods and logics spread. Type checking is quite needful here. Migrating whole to typescript, for now, is quite a work.
So as discussed with @evilebottnawi , it's better to do the type checking in comments as
webpack
does too.Breaking Changes
No
Just an addition of
tsconfig.json
in root andlint:type
in CIAdditional Info
This type-checking is done with reference to
jsDoc
Addition dependency :
typescript
as devDependencyAs of now, I have refactored
addEntries.js
, and for time being, only includedlib/utils/addEntries.js
in the tsconfig. as the completing of the changing to dir/files, the tsconfig will be changed.These changes have no effect on the main logic or the core of the codebase.