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

chore: prettier and vitest config simplification #1117

Merged
merged 4 commits into from
Jan 3, 2025

Conversation

juliusmarminge
Copy link
Collaborator

@juliusmarminge juliusmarminge commented Jan 3, 2025

Summary by CodeRabbit

  • Chores

    • Updated project dependencies and Prettier configuration
    • Removed unnecessary Prettier plugins
    • Added @uploadthing/prettier-config for consistent code formatting
    • Refined Vitest configuration for improved testing setup
  • Tooling

    • Streamlined testing configuration with dynamic package aliases
    • Enhanced module resolution and test environment settings
    • Simplified ESLint plugin structure and reduced development dependencies
    • Added TypeScript type checking in ESLint rules for better code quality

Copy link

vercel bot commented Jan 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-uploadthing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 9:56pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
legacy-docs-uploadthing ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 9:56pm

Copy link

changeset-bot bot commented Jan 3, 2025

⚠️ No Changeset found

Latest commit: ed3c30e

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
Contributor

coderabbitai bot commented Jan 3, 2025

Walkthrough

This pull request involves updates to the project's configuration files, focusing on dependency management and testing setup. The changes include removing certain Prettier-related dependencies from the root package.json, creating a new @uploadthing/prettier-config package, and modifying the Vitest configuration files. The modifications aim to streamline the project's tooling and testing infrastructure by centralizing configuration and updating dependency management.

Changes

File Change Summary
package.json - Removed dependencies: @ianvs/prettier-plugin-sort-imports, prettier, prettier-plugin-tailwindcss
- Added dependency: @uploadthing/prettier-config
- Added Prettier configuration pointing to @uploadthing/prettier-config
tooling/prettier-config/package.json - Created new package @uploadthing/prettier-config
- Added clean script
- Added dependencies: @ianvs/prettier-plugin-sort-imports, prettier, prettier-plugin-tailwindcss
vitest.config.ts - File deleted
vitest.workspace.ts - Added methods for package root and alias generation
- Created dynamic aliases object
- Updated base configuration for Vitest
- Modified export to include unit and browser test configurations
tooling/eslint-plugin/index.js - Added TypeScript checking with // @ts-check
- Updated import statements to include .js extension
tooling/eslint-plugin/package.json - Added property "type": "module"
- Simplified exports field
- Removed build and dev scripts
- Reduced devDependencies
tooling/eslint-plugin/rules/no-hardcoded-version-in-test.js - Added TypeScript checking with // @ts-check
- Updated function signature to use JSDoc for types
tooling/eslint-plugin/rules/no-throwing-promises.js - Added TypeScript checking with // @ts-check
- Updated function signature to use JSDoc for types
tooling/eslint-plugin/tsconfig.json - File deleted
tooling/eslint-plugin/tsup.config.ts - File deleted

Possibly related PRs

  • fix: dropzone behavior #980: The main PR involves updates to the package.json file, including the removal of certain dependencies and the addition of a new Prettier configuration.
  • fix: Fix withUt in monorepos #987: This PR addresses issues with the withUt functionality in monorepos, which may relate to the configuration changes in the main PR.
  • feat: add custom fetch override #1099: The introduction of a customizable fetch function in the main PR aligns with the changes in this PR, which also enhances the upload functionality by allowing different fetch implementations to be used.
  • chore: fix peer dep ranges #1103: The modifications in the main PR regarding dependency management and version updates are connected to the changes in this PR, which aims to fix peer dependency ranges across multiple packages.
  • fix: automatic dev mode detection #1106: This PR focuses on fixing the automatic detection of development mode, which may relate to the configuration changes in the main PR.

Suggested labels

📚 documentation, examples

Suggested reviewers

  • markflorkowski

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b3406e and ed3c30e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • tooling/eslint-plugin/package.json (1 hunks)
  • tooling/prettier-config/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tooling/prettier-config/package.json
  • tooling/eslint-plugin/package.json

🪧 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.

Copy link
Contributor

github-actions bot commented Jan 3, 2025

📦 Bundle size comparison

Bundle Size (gzip) Visualization
Main 29.95KB See Treemap 📊
PR (f240fbf) 29.95KB See Treemap 📊
Diff No change

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: 1

🧹 Nitpick comments (1)
tooling/eslint-plugin/package.json (1)

9-9: Reduced scripts section.

Removing build scripts helps streamline library maintenance. Make sure your code is thoroughly tested in its raw .js form to avoid potential runtime issues.

🧰 Tools
🪛 GitHub Actions: Publish Test Releases

[error] Lock file (pnpm-lock.yaml) is out of sync with package.json. Package specifications in lockfile don't match package.json. Missing entries for '@uploadthing/tsconfig', 'tsup', and 'typescript' in package.json.

🪛 GitHub Actions: Examples E2E

[error] Lock file is out of sync with package.json. Package specifiers in pnpm-lock.yaml don't match package.json. Missing entries in package.json for: @uploadthing/tsconfig, tsup, and typescript.

🪛 GitHub Actions: CI

[error] Lock file is out of sync with package.json. Package specifiers in pnpm-lock.yaml don't match package.json. Missing entries in package.json for: @uploadthing/tsconfig, tsup, and typescript.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 96df32c and 0b3406e.

📒 Files selected for processing (6)
  • tooling/eslint-plugin/index.js (1 hunks)
  • tooling/eslint-plugin/package.json (1 hunks)
  • tooling/eslint-plugin/rules/no-hardcoded-version-in-test.js (1 hunks)
  • tooling/eslint-plugin/rules/no-throwing-promises.js (1 hunks)
  • tooling/eslint-plugin/tsconfig.json (0 hunks)
  • tooling/eslint-plugin/tsup.config.ts (0 hunks)
💤 Files with no reviewable changes (2)
  • tooling/eslint-plugin/tsup.config.ts
  • tooling/eslint-plugin/tsconfig.json
✅ Files skipped from review due to trivial changes (1)
  • tooling/eslint-plugin/index.js
🧰 Additional context used
🪛 GitHub Actions: Publish Test Releases
tooling/eslint-plugin/package.json

[error] Lock file (pnpm-lock.yaml) is out of sync with package.json. Package specifications in lockfile don't match package.json. Missing entries for '@uploadthing/tsconfig', 'tsup', and 'typescript' in package.json.

🪛 GitHub Actions: Examples E2E
tooling/eslint-plugin/package.json

[error] Lock file is out of sync with package.json. Package specifiers in pnpm-lock.yaml don't match package.json. Missing entries in package.json for: @uploadthing/tsconfig, tsup, and typescript.

🪛 GitHub Actions: CI
tooling/eslint-plugin/package.json

[error] Lock file is out of sync with package.json. Package specifiers in pnpm-lock.yaml don't match package.json. Missing entries in package.json for: @uploadthing/tsconfig, tsup, and typescript.

🔇 Additional comments (9)
tooling/eslint-plugin/rules/no-throwing-promises.js (3)

1-2: Good use of JSDoc Type Checking.

Enabling // @ts-check in a JavaScript file is a great step toward better type safety. Ensure that your project's tooling is configured to correctly parse and validate JSDoc annotations across all relevant files, so that any type mismatches are flagged early.


5-8: Typedef approach is consistent but verify usage across the ESLint plugin.

Defining @typedef {import("@typescript-eslint/utils").TSESTree.Node} is helpful for type clarity. Confirm that all other rule files reference the same typedef or a shared definition to maintain consistency throughout the ESLint plugin.


13-17: Parameter type removed from the function signature.

The inline TypeScript annotation was removed in favor of JSDoc. This is fine in a // @ts-check environment but double-check that your code editor or build pipeline properly infers the type from the JSDoc comments to avoid losing IntelliSense or type-checking benefits.

tooling/eslint-plugin/rules/no-hardcoded-version-in-test.js (4)

1-2: Enforce consistent type-checking approach.

Adding // @ts-check enables type-checking in a JavaScript file, which can prevent subtle bugs. Ensure that all files in this ESLint plugin follow a consistent approach (e.g., enabling or disabling ts-check) to maintain uniformity.


5-7: Good use of JSDoc typedef for TSESTree.Node.

This clarifies the type reference without requiring TypeScript import statements. It simplifies code while retaining the type-checking benefits.


9-15: Clear JSDoc for findUp function.

Excellent detail in JSDoc describing the node parameter, the predicate parameter, and the return type. This improves maintainability and discoverability for future contributors.


16-18: Replace TypeScript parameter types with JSDoc.

The updated signature and inline /** @type {TSESTree.Node | undefined} */ annotation preserves type safety while removing the direct TS for function parameters. This is consistent with the new module approach.

tooling/eslint-plugin/package.json (2)

4-4: Enabling ECMAScript module format.

Adding "type": "module" ensures that files in this package are treated as ECMAScript modules. This is a beneficial move toward a more modern JavaScript ecosystem, but confirm that consumers of this plugin can handle the ESM format.

Do you want a script to confirm that consuming projects properly support ESM files?

🧰 Tools
🪛 GitHub Actions: Publish Test Releases

[error] Lock file (pnpm-lock.yaml) is out of sync with package.json. Package specifications in lockfile don't match package.json. Missing entries for '@uploadthing/tsconfig', 'tsup', and 'typescript' in package.json.

🪛 GitHub Actions: Examples E2E

[error] Lock file is out of sync with package.json. Package specifiers in pnpm-lock.yaml don't match package.json. Missing entries in package.json for: @uploadthing/tsconfig, tsup, and typescript.

🪛 GitHub Actions: CI

[error] Lock file is out of sync with package.json. Package specifiers in pnpm-lock.yaml don't match package.json. Missing entries in package.json for: @uploadthing/tsconfig, tsup, and typescript.


6-6: Simplified exports object.

Refactoring the "exports" field to point directly to index.js keeps the structure simpler. Verify that these changes still allow ESLint to load the rule properly.

🧰 Tools
🪛 GitHub Actions: Publish Test Releases

[error] Lock file (pnpm-lock.yaml) is out of sync with package.json. Package specifications in lockfile don't match package.json. Missing entries for '@uploadthing/tsconfig', 'tsup', and 'typescript' in package.json.

🪛 GitHub Actions: Examples E2E

[error] Lock file is out of sync with package.json. Package specifiers in pnpm-lock.yaml don't match package.json. Missing entries in package.json for: @uploadthing/tsconfig, tsup, and typescript.

🪛 GitHub Actions: CI

[error] Lock file is out of sync with package.json. Package specifiers in pnpm-lock.yaml don't match package.json. Missing entries in package.json for: @uploadthing/tsconfig, tsup, and typescript.

tooling/eslint-plugin/package.json Outdated Show resolved Hide resolved
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.

1 participant