charlierudolph / dependency-lint

Lints NPM dependencies and devDependencies
MIT License
14 stars 6 forks source link

--auto-correct should not delete dependencies listed in ignoreErrors.unused #37

Closed nfriedly closed 7 years ago

nfriedly commented 7 years ago

I have several things listed in my ignoreErrors.unused:

ignoreErrors:
  missing: []
  shouldBeDependency: []
  shouldBeDevDependency: []
  unused:
    # babel plugins
    - babel-plugin-add-module-exports
    - babel-plugin-transform-object-assign
    - babel-preset-es2015
    - babel-preset-react
    - babel-preset-stage-0

    # browserify plugins
    - babelify
    - browserify-global-shim
    - minifyify
    - uglifyify

    # eslint plugins
    - eslint-config-airbnb
    - eslint-plugin-import
    - eslint-plugin-jsx-a11y
    - eslint-plugin-react

    # css dependencies
    - watson-ui-component

When I run dependency-lint these are ignored as expected. However, when I run dependency-lint --auto-correct they are again reported as ignored, but are actually "fixed" (deleted from package.json). This, of course, actually breaks things.

nfriedly commented 7 years ago

I didn't even realize that this also bit me in another project where I had karma-* listed in my ignoreErrors.unused and it nuked all of my karma plugins :(

charlierudolph commented 7 years ago

Very sorry for that bug @nfriedly. I haven't used --auto-correct all that much yet. I'm guessing there may also be related bugs around the other sections of ignore errors.

nfriedly commented 7 years ago

FWIW, this is still a handy tool that I'd keep using even without the --auto-correct. But it'd be even awesomer if this worked better ;)

I'd offer to send a PR, but I think it'll be at least 3 weeks before I can look at it, and I'm only so-so at writing correct coffeescript :/

charlierudolph commented 7 years ago

Fix released with version 4.3.1

nfriedly commented 7 years ago

Thanks!