paleite / eslint-plugin-diff

Run ESLint on your changes only
https://npm.im/eslint-plugin-diff
MIT License
181 stars 14 forks source link

potential bug - only running once? #39

Open burtonator opened 1 year ago

burtonator commented 1 year ago

I'm trying to debug why the diff plugin isn't working and it seems it "works" once... and then the second time you call it it has a different code path.

Is the cache causing a problem potentially?

I'm still trying to debug what's happening but it should be the same path each time but the first run takes a different path and doesnt' call getPreProcessor and shouldBeProcessed isn't applied.

subskribe-kevin commented 1 year ago

confirmed that the cache breaks this and causes non-determinstic behavior.

especially if you change ESLINT_PLUGIN_DIFF_COMMIT to an earlier commit like the git init checksum.

It won't show the updated output unless you clear the cache.

subskribe-kevin commented 1 year ago

I think this could potentially be fixed by moving ESLINT_PLUGIN_DIFF_COMMIT into the eslint config.

I think the problem is that eslint doesn't realize that the ESLINT_PLUGIN_DIFF_COMMIT has changed (why would it?) and then can't invalidate the cache.