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

docs(installation): Update Hoisted dependencies step to help users with Prettier/EsLint #4580

Open
wants to merge 2 commits into
base: canary
Choose a base branch
from

Conversation

J4v4Scr1pt
Copy link

@J4v4Scr1pt J4v4Scr1pt commented Jan 17, 2025

📝 Description

Updated Hoisted dependencies step in installation.mdx.
Added extra information about hoisted pnpm packages. Because without prior knowledge about hoisting you may end up with broken Prettier and EsLint. Read more here: pnpm/pnpm#8878

⛳️ Current behavior (updates)

Docs don't inform new users that their Prettier and EsLint may stop working because of how Pnpm and hoisting works.

🚀 New behavior

Now the user will have the information needed to prevent non-working Prettier and EsLint.

💣 Is this a breaking change (Yes/No): No

Summary by CodeRabbit

  • Documentation
    • Updated installation guide with additional guidance for pnpm configuration.
    • Clarified instructions for managing hoisted dependencies, specifically for Prettier and ESLint in versions prior to 10 of pnpm.

Added extra information about hoisted pnpm packages.
Because without prior knowledge about hoisting you may end up with broken Prettier and EsLint. 
Read more here: pnpm/pnpm#8878
Copy link

changeset-bot bot commented Jan 17, 2025

⚠️ No Changeset found

Latest commit: dc66863

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 17, 2025

@J4v4Scr1pt is attempting to deploy a commit to the NextUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Walkthrough

The pull request updates the installation documentation for users utilizing pnpm as their package manager. It introduces guidance on configuring the .npmrc file to manage hoisted dependencies effectively, particularly for Prettier and ESLint. The changes clarify that in versions prior to 10 of pnpm, these tools are included in the default hoist pattern and emphasize the need to explicitly add them back if a custom hoist pattern is used.

Changes

File Change Summary
apps/docs/content/docs/guide/installation.mdx Added guidance for configuring .npmrc for hoisting Prettier and ESLint, including a note on default hoist patterns in pnpm versions prior to 10.

The added configuration lines are:

public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*

These lines ensure that Prettier and ESLint dependencies are correctly hoisted when using pnpm.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 64ab4cd and dc66863.

📒 Files selected for processing (1)
  • apps/docs/content/docs/guide/installation.mdx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/docs/content/docs/guide/installation.mdx

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.

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/docs/content/docs/guide/installation.mdx (1)

154-155: Consider enhancing the note's clarity.

While the addition is helpful, consider making it more explicit about why users might need to hoist these dependencies.

-If you are using Prettier and/or EsLint include them accordingly.
+If you are using Prettier and/or ESLint, you'll need to hoist these dependencies to ensure they work correctly with your project's root configuration.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 85913a8 and 64ab4cd.

📒 Files selected for processing (1)
  • apps/docs/content/docs/guide/installation.mdx (1 hunks)
🔇 Additional comments (1)
apps/docs/content/docs/guide/installation.mdx (1)

156-160: LGTM! Clear and helpful configuration example.

The configuration block clearly shows how to hoist HeroUI, ESLint, and Prettier dependencies. The syntax is correct and follows the pnpm configuration format.

@AnYiEE
Copy link
Contributor

AnYiEE commented Jan 17, 2025

It seems that public-hoist-pattern[]=*eslint-plugin* is enough.

@J4v4Scr1pt
Copy link
Author

It seems that public-hoist-pattern[]=*eslint-plugin* is enough.

The reason I added Prettier was because of it being default in the pnpm array. But maybe that is for early versions of Prettier?

@AnYiEE
Copy link
Contributor

AnYiEE commented Jan 17, 2025

It seems that public-hoist-pattern[]=*eslint-plugin* is enough.

The reason I added Prettier was because of it being default in the pnpm array. But maybe that is for early versions of Prettier?

There may be other uses. For a Next.js + ESLint 9 project, using Flat Config, with public-hoist-pattern[]=*eslint-plugin* is indeed sufficient. ESLint 8 doesn't even require public-hoist-pattern. (Note: Also using Prettier 3 along with eslint-config-prettier and prettier-plugin-tailwindcss)

@J4v4Scr1pt
Copy link
Author

It seems that public-hoist-pattern[]=*eslint-plugin* is enough.

The reason I added Prettier was because of it being default in the pnpm array. But maybe that is for early versions of Prettier?

There may be other uses. For a Next.js + ESLint 9 project, using Flat Config, with public-hoist-pattern[]=*eslint-plugin* is indeed sufficient. ESLint 8 doesn't even require public-hoist-pattern. (Note: Also using Prettier 3 along with eslint-config-prettier and prettier-plugin-tailwindcss)

Ahh ok, maybe I should add som more info context the step then maybe? What you think?

@AnYiEE
Copy link
Contributor

AnYiEE commented Jan 17, 2025

It seems that public-hoist-pattern[]=*eslint-plugin* is enough.

The reason I added Prettier was because of it being default in the pnpm array. But maybe that is for early versions of Prettier?

There may be other uses. For a Next.js + ESLint 9 project, using Flat Config, with public-hoist-pattern[]=*eslint-plugin* is indeed sufficient. ESLint 8 doesn't even require public-hoist-pattern. (Note: Also using Prettier 3 along with eslint-config-prettier and prettier-plugin-tailwindcss)

Ahh ok, maybe I should add som more info context the step then maybe? What you think?

Yes, it seems that a case-by-case explanation is needed.

@J4v4Scr1pt
Copy link
Author

J4v4Scr1pt commented Jan 17, 2025

Yes, it seems that a case-by-case explanation is needed.

Ok great then I will fix this 👍

Added more context to the hoist pattern
@J4v4Scr1pt
Copy link
Author

J4v4Scr1pt commented Jan 17, 2025

I have updated the docs now to be more clear.
From my understanding and correct me if I'm wrong.

Prettier <3 need the hoist pattern.
EsLint <9 need the hoist pattern. But there are people in v9 with flat-config (e.g. me) that experience issues and need to have it also. Because some setups with ESLint v9 still require hoisting due to specific project structure, ESLint plugins, or dependencies that rely on being hoisted.

@AnYiEE
Copy link
Contributor

AnYiEE commented Jan 18, 2025

EsLint <9 need the hoist pattern.

Only for me. My project previously used Next.js 14, EsLint 8 and Prettier 3.4, without needing any public-hoist-pattern (except for @nextui-org/*). After upgrading to Next.js 15 and EsLint 9, I need an additional public-hoist-pattern[]=*eslint-plugin* only.

@J4v4Scr1pt
Copy link
Author

EsLint <9 need the hoist pattern.

Only for me. My project previously used Next.js 14, EsLint 8 and Prettier 3.4, without needing any public-hoist-pattern (except for @nextui-org/*). After upgrading to Next.js 15 and EsLint 9, I need an additional public-hoist-pattern[]=*eslint-plugin* only.

I had a similar experience expect that neither EsLint 8 or 9 worked 😅. But according to the PR they removed the defaults because of version 9 and the flat config. That's why I tried to inform that in the information.

What you think it's ok now? :)
image

Copy link
Member

@ryo-manba ryo-manba left a comment

Choose a reason for hiding this comment

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

This is originally a pnpm issue, so I'm not sure if we should include setup details for external libraries like Prettier or ESLint. Providing useful information is important, but we should also avoid making the documentation overly lengthy. I'd appreciate hearing other members' thoughts.

@ryo-manba ryo-manba requested a review from wingkwong January 19, 2025 13:19
@J4v4Scr1pt
Copy link
Author

This is originally a pnpm issue, so I'm not sure if we should include setup details for external libraries like Prettier or ESLint. Providing useful information is important, but we should also avoid making the documentation overly lengthy. I'd appreciate hearing other members' thoughts.

I totally agree with you 👍😊! Because my intention is just to help others by having some information about this. Because I spent quite some time trying to understand why my Eslint failed 😅.
We could maybe just add a smaller note saying something like this:
"If you are on pnpm <10 Prettier and EsLint is default in they hoist array and depending on your setup you may need to be add them back."

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