Note: Creating project-specific ESLint rules in a Yarn workspace
Dec 9, 2022
I recently needed to figure out how to create custom project-specific lint rules for a repository that is using Yarn workspaces where ESLint is run from the workspace root.
Create an ESLint plugin as a private (
”private”: truein its package.json) in the workspace (parallel with other packages) and define the ESLint rules there.
Add a dependency on that package to your workspace’s root package.json using the
link:<path>syntax. Mine looked like:
Reference the package normally in the workspace’s eslintrc.
You can see the PR here: https://github.com/facebook/relay/pull/4147