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

build: add husky pre-commit hook and update linting scripts #35

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

sbolel
Copy link
Contributor

@sbolel sbolel commented Jul 17, 2024

Summary

This PR adds configuration of husky and lint-staged for pre-commit checks, and improvements to the linting scripts in the package.json. Additionally, it formats previously incorrectly formatted files.

Added

  • Husky Pre-commit Hook: A pre-commit hook has been added to run lint-staged and ensure all staged files are linted and formatted before committing.

Changed

  • Storybook Preview Configuration: Improved formatting for better readability in .storybook/preview.tsx.
  • Linting Scripts: Updated the lint:js script in package.json to use Prettier for checking JavaScript and TypeScript files. Modified fix:js script to use --write instead of --fix.

Deprecated

  • None

Removed

  • None

Fixed

  • Formatted .storybook/preview with Prettier.
  • Added // prettier-ignore comments in the global variable definitions in vite.config.ts to be ignored Prettier when formatting.

How to test

  1. Pre-commit Hook:

    • Make a change to any file in the repository.
    • Attempt to commit the change.
    • Ensure that lint-staged runs and lints the staged files before the commit is completed.
  2. Storybook:

    • Run the Storybook server using yarn storybook.
    • Verify that the themes are correctly applied in the preview and that there are no errors.
  3. Linting:

    • Run yarn lint and ensure all files are checked using Prettier.
    • Run yarn fix to verify that all fixable issues are resolved.
  4. Vite Configuration:

    • Build the project using yarn build.
    • Ensure there are no issues related to global variable definitions in the build process.

Related Issues

@sbolel sbolel self-assigned this Jul 17, 2024
@sbolel sbolel requested a review from acald-creator July 17, 2024 23:18
@sbolel sbolel added the enhancement New feature or request label Jul 17, 2024
@sbolel sbolel merged commit f3de2f9 into main Jul 17, 2024
1 check passed
@sbolel sbolel deleted the build/pre-commit/prettier branch July 17, 2024 23:22
Copy link

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add precommit hook to run Prettier to format staged files on every commit
1 participant