Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have lint-staged as a dev deps, should really use invoke it from a script? Wouldn't npx redownload it every time when you'd try to commit?

Copy link
Author

@hemantch01 hemantch01 Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in modern environments, if a package is installed as a devDependencies like lint-staged, typing npx package_name will actually just execute the local binary (in node_modules/.bin/* ) without redownloading it. husky also automatically adds your local node_modules/.bin to the path. So, usually, npx lint-staged is very safe. in older versions of npx in ci/cd where paths differ, npx might fail to resolve the local binary and try to hit the internet.

but there is another way i can add lint-staged in scripts object and then in pre-commit we can call that using

npm run lint-staged instead of npx lint-staged... should i do that??

5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*.{ts,tsx}": [
"eslint --fix --max-warnings 0"
]
}
Loading