Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support optionalDependencies in the no-extraneous-dependencies rule #266

Closed
sindresorhus opened this issue Apr 25, 2016 · 8 comments · Fixed by #294
Closed

Support optionalDependencies in the no-extraneous-dependencies rule #266

sindresorhus opened this issue Apr 25, 2016 · 8 comments · Fixed by #294

Comments

@sindresorhus
Copy link

sindresorhus commented Apr 25, 2016

I ran it on AVA and got:

  test/cli.js:19
  ✖   19:2  'chokidar' is not listed in the project's dependencies. Run 'npm i -S chokidar' to add it  import/no-extraneous-dependencies

It is defined, but as an optionalDependency: https://github.com/sindresorhus/ava/blob/c4e58e3e7eeb6b966a32a964445ac5ced813793a/package.json#L171-L173

Using master (055201e).

@benmosher
Copy link
Member

Yeah, I suspect the peerDependencies version of this is inevitable as well (though those are often reflected in devDependencies, so maybe not).

Feels like the existing devDependencies strategy makes sense. Default to allowed, add as a flag to enforce as is if desired.

@sindresorhus
Copy link
Author

Feels like the existing devDependencies strategy makes sense. Default to allowed, add as a flag to enforce as is if desired.

Default to allowed yes. I don't see why you would want to disallow it though? optionalDependencies are more like dependencies than devDependencies.

@benmosher
Copy link
Member

I can imagine turning it off for tests or "critical" regions or something. Easy enough to support (maybe even easier than not).

If whoever implements this wants to leave the option off, though, I won't argue. 😎

@sindresorhus
Copy link
Author

👍 Alright. Was just curious.

@rexxars
Copy link

rexxars commented Jun 30, 2016

What happened to the peerDependency version of this? If you don't have tests that require it, they won't necessarily be in devDependencies..?

@benmosher
Copy link
Member

@rexxars don't think anyone is looking at it. PR welcome. 😁

@ianstormtaylor
Copy link

+1 to peerDependencies

@benmosher
Copy link
Member

@rexxars @ianstormtaylor created #423 to track, accepting PRs 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants