'Configuring tsconfig.json and eslint for a monorepo using Yarn workspaces
I'm using a Yarn workspace monorepo structure in a TypeScript React project:
packages
admin
package.json
user
package.json
package.json // Workspace Root. Sets "workspaces": ["packages/*"]
I'm strugling to set up eslint
along-side TypeScript.
This is my current .eslintrc.json
file:
But I'm not really sure on how many .eslintrc
and tsconfig.json
files do I need.
OPTION #1
Each package would handle its own .eslintrc.json
and typescript.json
packages/
admin/
package.json
.eslintrc.json
tsconfig.json
user/
package.json
.eslintrc.json
tsconfig.json
package.json
OPTION #2
Have a root-leve .eslintrc.json
and tsconfig.json
and just do some extends and overrides (if necessary) for the inner packages.
packages/
admin/
package.json
.eslintrc.json // Some extends/overrides
tsconfig.json // Some extends/overrides
user/
package.json
.eslintrc.json // Some extends/overrides
tsconfig.json // Some extends/overrides
package.json
.eslintrc.json
tsconfig.json
Which of the 2 options should I follow? If I go with option 2, do I need any special config on the .eslintrc.json
and tsconfig.json
for the root
level?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|