By default, diff/diff pulls changes from both ahead and behind commits and runs ESLint on them. Most likely use case though, is that we we want to run ESLint only on changes introduced by ahead commits.
To work around the above issue ESLINT_PLUGIN_DIFF_COMMIT can be set to something like base_branch..., but this is not a valid syntax for git diff --staged, and because getProcessors function pulls diffFileList - it is run for all 3 processors during plugin init, regardless of desired processor, resulting in failure when staged processor is loaded.
This PR moves diffFileList call inside the processor, so it won't get invoked during plugin load, which should resolve the issue w/o changing anything else.
Duplicating context from #31
By default,
diff/diff
pulls changes from both ahead and behind commits and runs ESLint on them. Most likely use case though, is that we we want to run ESLint only on changes introduced by ahead commits.To work around the above issue
ESLINT_PLUGIN_DIFF_COMMIT
can be set to something likebase_branch...
, but this is not a valid syntax forgit diff --staged
, and becausegetProcessors
function pullsdiffFileList
- it is run for all 3 processors during plugin init, regardless of desired processor, resulting in failure when staged processor is loaded.This PR moves
diffFileList
call inside the processor, so it won't get invoked during plugin load, which should resolve the issue w/o changing anything else.