Np: Detect missing dependencies

Created on 23 Feb 2016  路  7Comments  路  Source: sindresorhus/np

Meaning, dependencies required/imported in the module, but not defined in dependencies. To ensure I don't publish a release that has the dependency incorrectly in the devDependencies field. Like in the https://github.com/sindresorhus/grunt-concurrent/pull/85 case. Could maybe be a ESLint rule.

enhancement help wanted

All 7 comments

I think you can do that with what is going on in https://github.com/benmosher/eslint-plugin-import/pull/241, by running ESLint with this rule

  • with option devDependencies set to false
  • only on files defined by package.json files field
  • or only on files not ignored by .npmignore

If you have neither of those fields set, the tool will have to get really smart about what are "production" files, and what are "dev" files. I'd say if you don't have those, you should not attempt this, as it will almost always fail.

Would be quite straightforward to implement now that we are using JavaScript as implementation language.

@SamVerschueren I'm going to implement that in XO, so don't think this is needed anymore: https://github.com/sindresorhus/xo/pull/109

Not for us but maybe people that use ESLint instead of the superior XO ;)

@SamVerschueren They can still use that plugin themselves though. I just think depending on ESLint by default here is a bit heavy and I don't want to deal with support stuff about it.

Yeah, good point!

I think this can be closed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jescalan picture jescalan  路  3Comments

artivilla picture artivilla  路  5Comments

dotconnor picture dotconnor  路  4Comments

xxczaki picture xxczaki  路  6Comments

inker picture inker  路  4Comments