TypeScript as optional dependency?
The additions in 0.27.0 are wonderful for my TypeScript projects; I'm so excited! However, adding an unconditional dependency to the TypeScript compiler was surprising, and ballooned the node_modules of many of my non-TypeScript projects quite considerably while upgrading. Is there any room for us to, say, use a peer or optional dependency instead?
🎈
https://packagephobia.now.sh/result?p=xo
This doubles XO. 40MB -> 90MB
The benefit of bundling TypeScript is that it then just works for linting d.ts (ambient) files, which really all JavaScript packages should include.
This doubles XO. 40MB -> 90MB
Why is it a problem?
XO has always favored developer convenience over size. XO bundles lots of things to make devs more productive and ensure high-quality code.
It also looks like TypeScript will soon fix the large package size: https://github.com/microsoft/TypeScript/issues/27891#issuecomment-580912889
... which really all JavaScript packages should include.
But not do anything with them, like execute tests against them? That seems like a strange recommendation.
Why is it a problem?
… because it's not using the dependency?
If XO is supposed to be used in a lot of my projects, it quite simply adds up.
You may imagine a situation in which a project team that has had internal contention about the adoption of TypeScript suddenly surprised to find it in their package graph. (Even moreso because it's not using the dependency.)
XO has always favored developer convenience over size.
tbh I chose and recommend the use of XO both because it is batteries-included and that it is focused. If I wanted the bloat too, prettier-standard is right there for me to dump in.
It also looks like TypeScript will soon fix the large package size
A comment on a closed PR doesn't really sound like "soon". But that's good news, thanks for hunting for that!
I really appreciate the discussion!
I wasn't expecting it to be controversial discussion, I was just looking at a lot of other utilities that have optional TypeScript integration and saw that they were marked as peer dependencies. It's not a big deal.
Since XO now requires TypeScript to be available, that should be called out in the README so that users can consider their needs and find alternatives if needed. I suppose I'll tell clients to stay on 0.27.1.
Since XO now requires TypeScript to be available, that should be called out in the README so that users can consider their needs and find alternatives if needed. I suppose I'll tell clients to stay on 0.27.1.
Why is that such a big deal? Additional dependencies that you don't use won't have any impact on anything other than your disk space. Is 40Mb of disk space so valuable?
won't have any impact on anything…
Except if you have metered Internet, throttled Internet, high-latency Internet, CI with throttled Internet… the list goes on.
And, again, a trade-off can be made by the individual, and would likely make sense if the dependency was even used! But it's not!
I understand that XO is meant to be batteries included, but given the extra size I’d give this decision further thought.
Including TS only helps those who hand-write definition files. Everyone else either already has it or doesn’t need it.
Once a d.ts file is added to the repo I think it wouldn’t be much to ask to also include TypeScript to have it linted. The repo’s author cares enough about TypeScript users to have a whole file dedicated to it after all, might as well specify TypeScript in package.json
Decisions have been made