Colin D
Colin D

Reputation: 3109

Using eslint-plugin-import in a monorepo not reporting errors when it should?

If I have the following monorepo set up

Then currently, I don't get any warning from something like eslint-plugin-import, when preferably, I would like an error because if I publish app2, then any user that tries to install it from NPM will receive errors because it does not properly specify that it needs is-even as a dependency

Reproducible case here with a minimal monorepo https://github.com/cmdcolin/yarn_workspaces_eslint_plugin_import

Upvotes: 1

Views: 1882

Answers (1)

Colin D
Colin D

Reputation: 3109

This was fixed by adding

extends:
  - eslint:recommended
  - plugin:import/recommended
rules:
  import/no-extraneous-dependencies: error

This makes it detect the error properly, e.g. this message is expected and good now

yarn run v1.22.15
$ eslint .

/home/cdiesh/test/packages/app2/src/index.js
  1:1  error  'is-even' should be listed in the project's dependencies. Run 'npm i -S is-even' to add it  import/no-extraneous-dependencies

✖ 1 problem (1 error, 0 warnings)


Upvotes: 1

Related Questions