bitter-ability-32190
03/16/2022, 5:43 PMeslint
initially.
1. Declare and use npm
as an ExternalTool
. That's easy-peasy.
2. We need a cached node_modules
per `package.json`/`package-lock.json`. Seems like I could have NPM.config_request
which will return those given a set of sources. (But this I don't think is right, since each "config" makes one unique node_modules
🤔 )
a. This should be easy-ish with a rule with a Process
and input/output digest for relevant files. The process runs npm install
in the right working dir.
3. Once I can request and access node_modules
running ESLint from it's .bin
dir should be easy. I think this is easy as well.
So I think just 2 is foggy since each config kind of makes a "hard wall" between 2 sources 🤔fast-nail-55400
03/16/2022, 5:45 PMProcess
had a way to symlink in the node_modules
directory already in the repository?fast-nail-55400
03/16/2022, 5:45 PMfast-nail-55400
03/16/2022, 5:48 PMnode_modules
has similarities to Go vendor
directories and other large sets of data downloaded as a result of a lockfile / consistent resolution. If Pants manages those, then it has to realize that data into sandboxes which has been a problem in the past for us with large sets of data, e.g. the Go SDK)bitter-ability-32190
03/16/2022, 5:55 PMnpm
and node_modules
, the relevant code only fires when we try to run eslint
, which is only the case if devs touched one of those (due to --changed
))bitter-ability-32190
03/16/2022, 6:07 PMnode_modules
isn't dissimilar to Python's venvs either. This actually kind of feel like a "multiple resolves" feature 🤔bitter-ability-32190
03/16/2022, 6:08 PMcurved-television-6568
03/16/2022, 6:22 PMnode_modules
, and I think we’d do well to avoid copying it around, or worse, re-build it too often…
$ du -sh node_modules/
998M node_modules/
$ find node_modules/ -type d | wc -l
15326
$ find node_modules/ -type f | wc -l
112682
bitter-ability-32190
03/16/2022, 6:27 PMbitter-ability-32190
03/16/2022, 6:28 PMcurved-television-6568
03/16/2022, 6:29 PMhundreds-father-404
03/16/2022, 6:35 PMhundreds-father-404
03/16/2022, 6:38 PMnode_modules
, https://github.com/pantsbuild/pants/issues/13390 might be instructive as well with what we do for Go. Notably, we extract the subset of GOPATH
eagerly so that you only materialize the specific package you need, not the whole chroot every time.
I'm not sure that's as feasible w/ JS/TS given their different compilation model. Go is awesome that you convert a dir of .go
files into a single __pkg__.a
file then all you have to do is pass that one file aroundbitter-ability-32190
03/16/2022, 6:40 PMhundreds-father-404
03/16/2022, 6:42 PMbitter-ability-32190
03/16/2022, 6:45 PMcurved-television-6568
03/16/2022, 6:48 PMbitter-ability-32190
03/16/2022, 6:49 PMcurved-television-6568
03/16/2022, 6:50 PMcurved-television-6568
03/16/2022, 6:50 PMhundreds-father-404
03/16/2022, 6:53 PM./pants fmt ::
and run everythingwide-midnight-78598
03/16/2022, 11:52 PMwide-midnight-78598
03/17/2022, 12:06 AMeslint
checks and/or prettier
formats sitting around somewhere from a test a few months back. Didn't really occur to me that they would constitute a reasonable starting point for a plugin. My brain goes compile-first, everything else later (or never)wide-midnight-78598
03/17/2022, 12:07 AMtsc
checks actually, can't recall if I made it to eslint
because eslint has so many ways to be consumed, and ignore files, and whatever else. Was a mild messbitter-ability-32190
03/17/2022, 12:29 AM