Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`eslint-config-react-app@7.0.0` using dependencies instead of peerDependencies

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:13
  • Comments:5

github_iconTop GitHub Comments

tkaabbccommented, Aug 23, 2022

plugins declared as a peerdependency may not be a wrong.

Because eslint-config-react-app@7.0.0 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

unionalcommented, Aug 24, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Packages should use dependencies instead of ... - GitHub
We were hoping that peerDependencies could be used as a way to signal which dependencies should be shared with other packages. Even to...
Read more >
Why use peer dependencies in npm for plugins?
TL;DR: peerDependencies are for dependencies that are exposed to (and expected to be used by) the consuming code, as opposed to "private" dependencies...
Read more >
Understanding Peer Dependencies in JavaScript
Peer dependencies are almost like normal dependencies, but instead of defining a strong requirement between A and B (i.e the project you're ...
Read more >
Peer Dependencies | Node.js
The Problem: Plugins. There's one use case where this falls down, however: plugins. A plugin package is meant to be used with another...
Read more >
dependencies vs devDependencies vs peerDependencies
Usually, these libraries have all or part of their code in your final bundle(s). You can add them in your project using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found