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

Chores: Add husky and lint-staged to run prettier on staged files #30

Merged
merged 3 commits into from
Jan 2, 2022

Conversation

KixPanganiban
Copy link
Contributor

Changes:

  • Added husky and lint-staged to devDependencies
  • Added prepare npm script to initialize husky
  • Added the following lint-staged directives:
    • eslint for ts and js files
    • prettier for all files that prettier recognizes

How to test:

  1. Pull this branch and run npm run prepare
  2. Stage a change to a src/ file which contains lines that prettier will obviously format, for example:
    console.log("prettier" +
    "will" +
    "lint this")
  3. Commit it with git commit -m "test commit"
  4. Confirm that husky runs lint-staged (and by extension, eslint and prettier). You should see a printout similar to this:
    CleanShot 2021-12-29 at 11 04 50

@dragonman225
Copy link
Owner

Works great! But whenever I do git commit, eslint creates a .eslintcache file because --cache is turned on. I think it would be better to add that file to .gitignore so that people wouldn't commit it accidentally.

@KixPanganiban
Copy link
Contributor Author

Happy new year @dragonman225! Just pushed a change adding that file to .gitignore.

@dragonman225 dragonman225 merged commit 331e1ce into dragonman225:master Jan 2, 2022
@dragonman225
Copy link
Owner

Happy new year @KixPanganiban!
Merged. Thanks for the pull request!

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.

2 participants