ember-cli-dependency-checker
ember-cli-dependency-checker copied to clipboard
Idea: fail build if peerDep is missing?
👋 Hey there! I wanted to open an issue to discuss adding peerDependencies
support to ember-cli-dependency-checker
.
I've gone around a few times with folks like @ef4 and @Turbo87 about the best way for addons to specify their dependencies. It seems peerDependencies
is semantically often what we want, but it's currently not really used or enforced by existing tooling.
If ember-cli-dependency-checker
failed builds if a peer dependency were missing, it would encourage addon authors to start using them more, and might make everyone's lives a little easier.
What do you think? Has there been priori discussion around this? I'm just learning about these issues, but often get recommended to consider using peerDependencies
even though it's not currently enforced anywhere. If this addon supported it, I think myself and others would be more incentivized to use it.
in theory that sounds like a good idea, though in general I'm a little worried about it due to the other issues that peer dependencies have.
one example is ESLint plugins and ember-cli-eslint
: the plugins usually declare an eslint
peer dependency, but since the Ember app only has a dependency on ember-cli-eslint
(which depends on broccoli-lint-eslint
which depends on eslint
) yarn
will show warnings during yarn install
. I'm worried that we'll run into similar issues 🤔
I see.
Would it be possible to inspect the "final graph" (if there is such a thing) to check for the presence of eslint
?
yes, but you might actually end up with several different versions if a subsubsubsubsubdependency misbehaves and has eslint
as an actual dependency.
We can only warn instead of failing build.
@quaertym true, but yarn
and npm
already do that, so I'm not sure where the benefit would be
One benefit is that npm
and yarn
only warn once upon install, whereas this addon would warn upon each invocation of ember
...
Also, see https://github.com/ember-cli/rfcs/pull/112 for some background context here. I still need to dust off that RFC and re-submit it to emberjs/rfcs though...