Skip to content

chore: add lint-staged for running the lint & test scripts#1349

Merged
ronag merged 5 commits intonodejs:mainfrom
vinayakkulkarni:feat/add-lint-staged
Apr 25, 2022
Merged

chore: add lint-staged for running the lint & test scripts#1349
ronag merged 5 commits intonodejs:mainfrom
vinayakkulkarni:feat/add-lint-staged

Conversation

@vinayakkulkarni
Copy link
Copy Markdown
Contributor

  • Brings a better DX as the npm run lint & the npm run test scripts run only when the .js or .ts files are staged for pushing
  • Also enables the pre-push git hook to run lint-staged on the staged files

Comment thread package.json Outdated
Comment thread .husky/pre-push Outdated
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why pre-push? Why isn't pre-commit sufficient?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pre-push provides another layer of validation ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But there is nothing that pre-push can catch that pre-commit doesn't? Is there? You can't push something that's not commited. Or am I missing something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, pre-push does nothing special than pre-commit but I personally use it everywhere, so it was a opinionated opinion I guess 😉

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@vinayakkulkarni vinayakkulkarni requested a review from ronag April 21, 2022 18:30
@ronag ronag merged commit 615f617 into nodejs:main Apr 25, 2022
@vinayakkulkarni vinayakkulkarni deleted the feat/add-lint-staged branch April 25, 2022 08:52
@Fdawgs Fdawgs mentioned this pull request May 3, 2022
mcollina pushed a commit that referenced this pull request May 3, 2022
KhafraDev pushed a commit to KhafraDev/undici that referenced this pull request Jun 23, 2022
…1349)

* chore(husky): add `pre-push` hook

* feat: add `lint-staged` for running scripts

* style: fix lint issue

* chore: remove lint-staged as devDep

* fix: remove pre-push hook

Signed-off-by: Vinayak Kulkarni <[email protected]>
KhafraDev pushed a commit to KhafraDev/undici that referenced this pull request Jun 23, 2022
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
…1349)

* chore(husky): add `pre-push` hook

* feat: add `lint-staged` for running scripts

* style: fix lint issue

* chore: remove lint-staged as devDep

* fix: remove pre-push hook

Signed-off-by: Vinayak Kulkarni <[email protected]>
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
…1349)

* chore(husky): add `pre-push` hook

* feat: add `lint-staged` for running scripts

* style: fix lint issue

* chore: remove lint-staged as devDep

* fix: remove pre-push hook

Signed-off-by: Vinayak Kulkarni <[email protected]>
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
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.

3 participants