Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint ./some-file.js triggers invalid-todo-violation-rule for unrelated files #218

Open
buschtoens opened this issue Aug 8, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@buschtoens
Copy link
Contributor

When linting only a subset of files by explicitly passing them to eslint (instead of just eslint .), all TODOs from all other files are incorrectly reported as passing / invalid-todo-violation-rule.

Steps to reproduce:

  1. Setup a package with an eslint config and some files failing that config.
    (Optionally verify, that violations are present with: eslint .)
  2. Run UPDATE_TODO=1 eslint --format @scalvert/eslint-formatter-todo .
  3. Verify, that violations are no longer reported:
    eslint --format @scalvert/eslint-formatter-todo .
  4. Lint a single file eslint --format @scalvert/eslint-formatter-todo ./some-file.js

Actual Behavior

All TODOs for files other than some-file.js are incorrectly reported as fixed (invalid-todo-violation-rule).

Expected Behavior

Only TODOs for files matching the input glob / files list passed to eslint should be checked.

@scalvert
Copy link
Collaborator

scalvert commented Aug 9, 2021

Thanks for reporting, @buschtoens. I'll take a peek and see what I can find.

I do know of a discrepancy between how the ember-template-lint implementation and this formatter behave, in that the former operates on a file by file basis when working with todos, while the eslint formatter operates on all files. I believe this is likely not what we want, and could be contributing to what you're observing. I plan on cleaning up this implementation and matching it with that of ember-template-lint once I complete a current round of feature enhancements.

@scalvert scalvert added the bug Something isn't working label Aug 9, 2021
@scalvert scalvert self-assigned this Aug 9, 2021
@scalvert
Copy link
Collaborator

Hey @buschtoens. I just updated and released https://github.com/scalvert/eslint-formatter-todo/releases/tag/v1.4.0, which I believe will address your issue. Please try it out and let me know if it works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants