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.

Add `--since` CLI option to only lint changed files

See original GitHub issue

The version of ESLint you are using.

7.23.0

The problem you want to solve.

Only lint files that have changed since a feature branch was created, or since a particular commit, to save time by avoiding linting unchanged files.

This would be similar to functionality in other tools like jest (https://jestjs.io/docs/cli#--changedsince), lerna (https://github.com/lerna/lerna/tree/main/core/filter-options#--since-ref), and prettier (https://github.com/azz/pretty-quick).

Your take on the correct solution to problem.

I would like to propose adding a new --since CLI option to eslint, which would take a branch name or commit hash. The branch name or commit hash would be used to determine all the files changed between that commit and the current state. This would run the same as if eslint was run via CLI, with all the changed filenames passed in as arguments.

I’ve tested this concept out in https://github.com/jdanil/eslint-changeset.

Are you willing to submit a pull request to implement this change?

Yes. But my changes would be restricted to supporting git, as I am not familiar with other SCM systems.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, Apr 9, 2021

I’m not thrilled with baking in any SCM-specific knowledge. This seems like something a script built on top of ESLint could do in a single line.

0reactions
jdanilcommented, Apr 14, 2021

All good. Thanks for considering it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable eslint only for edited files - javascript - Stack Overflow
If you want to lint staged and edited files, use: eslint $(git diff --name-only HEAD | grep -E '\.(js|jsx)$' | xargs).
Read more >
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 >
Automate ng lint for changed files | by Vipin Saini - Medium
The above command creates .eslintrc.json file to the folder and adds some dev dependencies to the project. Created JSON file is the place...
Read more >
Linting Staged Git Files with lint-staged -- newline - Fullstack.io
Cannot add lint-staged: only eslint, stylelint, ... --cache tells ESLint to only check changed files, and --fix tells ESLint to ...
Read more >
pre-commit
Add a file called .pre-commit-config.yaml to the root of your project. The pre-commit config file describes what repositories and hooks are installed.
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