beeauvin / sunbeams

a little something to brighten your day
Mozilla Public License 2.0
2 stars 0 forks source link

update lint to work in monorepos that use workspaces #26

Closed beeauvin closed 1 year ago

beeauvin commented 1 year ago

Lint mostly works now, it runs the command and everyone's happy - except if you're in a project with workspaces. Mostly because the reliance on the flat node_modules structure breaks down at that point. This might mean a move to peerDependencies, or something else entirely.

beeauvin commented 1 year ago

Let's talk about the problem here. In a project that isn't a monorepo this is what happens (loosely):

npm install throws all packages, and their direct dependencies, into a single node_modules and everyone is happy. Well, mostly. This means we can install sunbeams and it will put @sunbeams/eslint-config in the same place where eslint expects to find it; node_modules. Now as a user we don't have to install -both- sunbeams and sunbeams eslint config; dope.

Ok so in a monorepo project that uses workspaces, this is what happens (also loosely):

npm install will throw the packages it think everyone shares into the root node_modules and differences between those, or things ultra specific to a single workspace, in local node_modules to each workspace. Dependencies of packages are now not dumped into root node_modules though. This is fine, mostly. Anyway this means we have two solutions for running sunbeams lint in a monorepo:

The second is obviously the preferred method. But it's not guaranteed to work either. Going to try this in a few local projects with npm link and see what happens. If things look good that's the solve. If not... Well let's just hope it works.

beeauvin commented 1 year ago

Ok linking doesn't work the way I want it to. Time to pretend like I know how to do pre-releases.

beeauvin commented 1 year ago

Fam it worked.