eslint --init messes up binaries for projects using yarn
See original GitHub issueeslint --init
uses npm which messes up the binaries installed by yarn. This issue will affect any project using yarn.
Even worse, it also runs some packages uninstall scripts, which in the case you’re using husky
will remove the installed git hooks.
An asciinema recording of the steps to reproduce the issue, and its effects, can be found here:
https://asciinema.org/a/T200B8Qgg7QepzHw5w1TbtuoC
- eslint@4.19.1
- Node version 10.0.0
- npm version 5.6.0
- yarn version 1.6.0
No eslint configuration needed to reproduce this issue.
Steps to reproduce
The following steps reproduce the issue in a test project:
mkdir eslint-init-with-yarn
cd eslint-init-with-yarn
git init .
ls -ltr .git/hooks
yarn init .
yarn add husky eslint --dev
# Check that husky created the hooks
ls -ltr .git/hooks
# Check the binaries added by yarn in the node_modules dir
ls node_modules/.bin
yarn eslint --init
# Answer with predefined AirBNB style guide, no react, using a JSON configuration file
# Check that the hooks disappeared
ls .git/hooks
# Also the binaries
ls node_modules/.bin
What did you expect to happen?
Previously binaries installed by yarn to keep existing, and the git hooks not being removed.
What actually happened? Please include the actual, raw output from ESLint.
The binaries previously installed by yarn were deleted, and the commit hooks created when installing husky
also were removed (the uninstall script for husky was run).
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top GitHub Comments
A work around for those affected by this issue is removing your
node_modules
folder and runningyarn install
againThanks for confirming. Closing this issue.