question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cache is deleted when linting text

See original GitHub issue

What version of ESLint are you using? Master

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration: N/A

What did you do? Please include the actual source code causing the issue.

Given a directory with a file and an .eslintcache:

> tree -a
.
├── .eslintcache
└── foo.js

Running eslint on text with --stdin causes the .eslintcache file to be deleted:

> echo "var foo=42;" | eslint --stdin
> tree -a
.
└── foo.js

What did you expect to happen?

Since the cache is only used when executing on files, I would not expect the .eslintcache file to be deleted. This causes problems when using eslint in a text editor like Atom, because it means as soon as a file is opened (and therefore linted), the cache file is deleted (see https://github.com/AtomLinter/linter-eslint/issues/587).

I believe this is because the code which deletes the cache is too high in the CLIEngine execution right after instantiation. It could likely be moved into executeOnFiles as an else to this check.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
IanVScommented, Jun 25, 2016

To give a little more explanation, I run eslint in my editor (Atom), which lints using --stdin and --stdin-filename. Linting there is quick, because it only runs on one file-worth of text at a time. When I’m ready to commit changes, I run an npm script which lints the entire codebase with --cache. I would like the cache to persist between my npm run lint executions, because without it linting can take quite a while.

1reaction
IanVScommented, Jun 19, 2016

Sure, this should be pretty straight-forward, I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command Line Interface - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Will clearing cache delete text messages? - Quora
A cache is storage created purely in order to make something faster, not to make it work correctly. It is never necessary for...
Read more >
Caching Dependencies - CircleCI
This document is a guide to caching dependencies in CircleCI pipelines.
Read more >
ng cache - Angular
Angular CLI saves a number of cachable operations on disk by default. When you re-run the same build, the build system restores the...
Read more >
ESLint v1.4.0 released - ESLint中文文档
Limitations: the --fix flag does not work for piped-in text and has no effect on code ... The cache is deleted the next...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found