Conversation
Move lint-staged config to .lintstagedrc.js to use a function-based pattern that filters out libs/internal-sdk files before passing them to biome. This prevents biome from reformatting auto-generated SDK code when it appears in staged files (e.g. after merge conflicts), which previously caused unwanted formatting changes in PRs.
📝 WalkthroughWalkthroughThis PR migrates lint-staged configuration from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for dashboard-v2-novu-staging canceled.
|
|
Hey there and thank you for opening this pull request! 👋 We require pull request titles to follow specific formatting rules and it looks like your proposed title needs to be adjusted. Your PR title is: Requirements:
Expected format: Details: PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.lintstagedrc.js:
- Around line 3-8: The lint-staged rule currently filters files using
files.filter((file) => !file.includes('/internal-sdk/')) which is too broad;
update the filter to precisely match the biome.json exclusion by checking for
the specific path segment used there (e.g., 'libs/internal-sdk') so that only
files under that exact directory are skipped. Locate the filtered variable and
the files.filter callback in .lintstagedrc.js and replace the
includes('/internal-sdk/') check with a stricter check that matches the biome
scope (for example using file.includes('libs/internal-sdk') or a
path-segment-aware test). Ensure the rest of the function returns the same biome
command when filtered is non-empty.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 223540e7-5b2a-4fa3-a192-fc195c2d1a44
📒 Files selected for processing (2)
.lintstagedrc.jspackage.json
💤 Files with no reviewable changes (1)
- package.json
What changed
When there's a merge conflict involving
libs/internal-sdk(auto-generated code), the lint-staged pre-commit hook was running biome formatting on those files. This caused unwanted formatting changes to appear in PRs, since biome reformats the auto-generated code (e.g., changing double quotes to single quotes).While
biome.jsonalready excludeslibs/internal-sdkviafiles.includes, this exclusion is bypassed when lint-staged passes explicit file paths as CLI arguments to biome.How it's fixed
package.jsonto a new.lintstagedrc.jsfile/internal-sdk/before passing them to biomeinternal-sdkfiles are staged, no biome command runs at allTesting
Verified locally that:
internal-sdkfile and runninglint-stageddoes not run biome on it (formatting is preserved)Slack Thread
What changed
Moved lint-staged configuration from
package.jsonto a new.lintstagedrc.jsfile with added filtering logic. The configuration now excludes files matching/internal-sdk/(auto-generated code) before passing them to biome for formatting. This prevents biome from reformatting auto-generated files that should not be modified.Affected areas
root: Lint-staged configuration moved to
.lintstagedrc.jswith filtering to skip internal-sdk files during pre-commit formatting checks.Key technical decisions
.lintstagedrc.jsfile using a function-based pattern to filter staged files before passing to biome, allowing dynamic exclusion logic that bypasses the limitation of biome.json file exclusions when explicit file paths are provided via CLI.Testing
Manual verification confirmed: