Eslint cache persisting across branches?

10.2k views Asked by At

It may not be the eslint cache.

I am working in a project that is using a custom eslint plugin that is referenced in the package.json locally (not published on npm).

"special-eslint-plugin": "file:special-eslint-plugin-directory"

But then I am switching to an older branch that does NOT have this package. It is not installed in node_modules, it is not in package.json, or shrinkwrap, it is not a local directory. And when I run "npm run lint" (which runs grunt lint) I get this terminal output:

10:31 AM app  $ npm run lint
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~prelint: [email protected]
npm info lifecycle [email protected]~lint: [email protected]

> [email protected] lint /Users/****/Desktop/app/app/
> grunt lint

Running "lint" task

Running "eslint:target" (eslint) task
Warning: Failed to load plugin special-eslint-plugin: Cannot find module 'special-eslint-plugin' Use --force to continue.

Aborted due to warnings.


Execution Time (2018-10-09 10:31:52 UTC-7)
/ ... /

npm info lifecycle [email protected]~lint: Failed to exec lint script
npm ERR! code ELIFECYCLE
npm ERR! errno 6
npm ERR! [email protected] lint: `grunt lint`
npm ERR! Exit status 6
npm ERR! 
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/***/.npm/_logs/2018-10-09T17_31_53_336Z-debug.log

So I think that somehow the eslint cache is persisting across branches and it thinks it needs that package.

Things I have tried but not limited to:

git clean -xfd && npm cache clear --force && nvm use && npm install
  • Reinstalling node & npm
  • Reinstalling nvm
  • Removing all my global packages
  • Disabling all my editor packages (I had linters in the IDE)
  • Deleting the local branch
  • Restarting my computer

I am using:

  • Grunt
  • grunt-eslint
  • "node": "8.9.2"
  • "npm": "5.5.1"
  • nvm 0.30.2

There is a git hook that runs lint so it is preventing me from getting work done on this branch

The most interesting part is that it is not happening on my coworkers machines after they switch to the branch I am on and run the above git clean command. So it is something to do with my computer and not the branch.

Thanks

1

There are 1 answers

0
coelacanth7 A On

It turns out there was an .eslintrc file hiding on my desktop