I've set up my monorepo using NPM workspaces with the following high-level structure:
root
common // Shared package, named @company/common
src
...
package.json
tsconfig.json
web // ReactJS package, named @company/web
config
...
public
...
src
...
package.json
tsconfig.json
mobile // React Native package, named @company/mobile
...
package.json
tsconfig.json
.eslintrc.json
.prettierrc
package.json
tsconfig.json
tsconfig.base.json
All my packages are meant to be private and have been marked as such in their respective package.json files.
I've successfully managed to set everything up such that I can write code like this in the web and mobile workspaces:
import { ITestInterface } from '@company/common';
With my current setup, I get an eslint warning in my IDE (VS Code) whenever I open any file that imports anything from @company/common:
'@company/common' should be listed in the project's dependencies. Run 'npm i -S @company/common' to add it
I'd rather not disable this warning entirely if at all possible. Is there a way to configure eslint to have it understand monorepos so that it does not give me a warning when I try to import something from a package (workspace) within my monorepo?