create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

`[email protected]` using dependencies instead of peerDependencies

Open jancama2 opened this issue 2 years ago • 5 comments

Using dependencies for plugins in sharable configs for eslint is an antipattern. According to the docs, these dependencies should be put to peerDependencies. The reason is that multiple sharable configs could lock their version of plugins and expect different implementation and eslint wouldn't know which one to use. The user should be always the one to select and install eslint plugins. Reused shareable configs, parsers or other packages can be in dependencies tho.

The older version of eslint-config-react-app had it correct, the new version has it wrong.

jancama2 avatar Dec 22 '21 22:12 jancama2

Can someone look into this? This is a blocking issue.

unional avatar Jun 16 '22 18:06 unional

I encountered the same problem

tkaabbc avatar Jul 30 '22 02:07 tkaabbc

plugins declared as a peerdependency may not be a wrong.

Because [email protected] use @rushstack/eslint-patch/modern-module-resolution. This patch allows a shared ESLint config to bring along its own plugins, rather than imposing peer dependencies on every consumer of the config. For more detail see @rushstack/eslint-patch

https://github.com/facebook/create-react-app/blob/f34d88e30c7d8be7181f728d1abc4fd8d5cd07d3/packages/eslint-config-react-app/base.js#L11

tkaabbc avatar Aug 22 '22 15:08 tkaabbc

plugins declared as a peerdependency may not be a wrong.

Not really. The fact that it conflicts at the consuming side with other plugins means that solution doesn't work.

unional avatar Aug 24 '22 04:08 unional