postiz-app icon indicating copy to clipboard operation
postiz-app copied to clipboard

Feat/configure husky and lintstaged

Open caushcani opened this issue 1 year ago • 4 comments

What kind of change does this PR introduce?

Feature.

Why was this change needed?

#488

Other information:

eg: Did you discuss this change with anybody before working on it (not required, but can be a good idea for bigger changes). Any plans for the future, etc? Yes, with @nevo-david.

Checklist:

Put a "X" in the boxes below to indicate you have followed the checklist;

  • [x] I have read the CONTRIBUTING guide.
  • [x] I checked that there were not similar issues or PRs already open for this.
  • [x] This PR fixes just ONE issue (do not include multiple issues or types of change in the same PR) For example, don't try and fix a UI issue and include new dependencies in the same PR.

Summary by CodeRabbit

  • New Features

    • Introduced linting and formatting tasks for various file types across multiple applications.
    • Added a pre-commit hook to ensure code quality checks before commits.
  • Bug Fixes

    • Minor code formatting improvements in the github.component.tsx file for better clarity.
  • Documentation

    • Updated configuration files to enhance linting rules and pre-commit processes.
  • Chores

    • Added new dependencies for managing Git hooks and linting staged files.
    • Specified Node.js version for consistency in development environments.

caushcani avatar Dec 15 '24 16:12 caushcani

@caushcani is attempting to deploy a commit to the Listinai Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Dec 15 '24 16:12 vercel[bot]

Walkthrough

This pull request introduces a comprehensive linting and code quality improvement strategy across the project. The changes implement Husky and lint-staged to automatically run ESLint and Prettier on staged files before commits. Configuration files like .eslintrc.json have been updated with stricter linting rules, particularly for TypeScript files, such as enforcing no unused variables and changing the handling of any types. The modifications span multiple applications and include new pre-commit hooks, linting configurations, and package dependencies.

Changes

File/Directory Change Summary
.eslintrc.json Added no-unused-vars rule with underscore exception, modified no-explicit-any to warning level
.husky/pre-commit Added npx lint-staged command for pre-commit linting
.lintstagedrc.json New configuration for linting and formatting TypeScript and JavaScript files
apps/*/ Added .lintstagedrc files for backend, commands, cron, frontend, and workers
apps/backend/.eslintrc.json Added no-unused-vars rule with caught errors configuration
apps/frontend/src/components/settings/github.component.tsx Minor formatting changes
package.json Added Husky and lint-staged dependencies, new prepare script, specified Node.js version

Possibly related issues

  • #488 (gitroomhq/postiz-app): This PR directly addresses the issue of configuring Husky to run ESLint on staged files before commit, implementing the exact workflow requested in the issue.

Poem

🐰 Linting Rabbit's Delight

With Husky's hook and staged files tight, ESLint prowls with rules so bright, No unused vars shall escape my sight, Clean code dances in pure delight!

🔍✨

[!TIP] CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Dec 15 '24 16:12 coderabbitai[bot]

husky + biome on my taste make more sense, biome is x35 faster than eslint and prettier - https://biomejs.dev/

instructions - https://biomejs.dev/recipes/git-hooks/

OleksandrKucherenko avatar Dec 30 '24 09:12 OleksandrKucherenko

@OleksandrKucherenko , this could be good, could you fix the merge conflict in package-lock.json please?

jamesread avatar Jan 02 '25 01:01 jamesread

This PR is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Aug 14 '25 05:08 github-actions[bot]

This PR was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Aug 21 '25 06:08 github-actions[bot]