Skip to content

feat: add --staged flag to lint only files staged in the index#49

Open
PrasannaMishra001 wants to merge 1 commit intoomegaup:mainfrom
PrasannaMishra001:fix/add-staged-flag
Open

feat: add --staged flag to lint only files staged in the index#49
PrasannaMishra001 wants to merge 1 commit intoomegaup:mainfrom
PrasannaMishra001:fix/add-staged-flag

Conversation

@PrasannaMishra001
Copy link

@PrasannaMishra001 PrasannaMishra001 commented Feb 16, 2026

When --staged is passed to the validate or fix subcommands, only files that are staged in the git index (git diff --cached) are considered. This is useful for pre-commit hooks that should only lint staged changes rather than the entire diff against a branch.

The flag is incompatible with --all-files, commits, and explicit file arguments. When --staged is active, file_contents reads from the index (git show :filename) instead of the working tree.

FIXES: #50

When --staged is passed to the validate or fix subcommands, only files
that are staged in the git index (git diff --cached) are considered.
This is useful for pre-commit hooks that should only lint staged changes
rather than the entire diff against a branch.

The flag is incompatible with --all-files, commits, and explicit file
arguments. When --staged is active, file_contents reads from the index
(git show :filename) instead of the working tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add support for --staged flag to lint only staged files

1 participant

Comments