Skip to content

chore: scope jest, lint, prettier, and tsc to ignore .worktrees directory#7131

Merged
diegolmello merged 2 commits into
developfrom
fix/scope-worktree-commands
Apr 14, 2026
Merged

chore: scope jest, lint, prettier, and tsc to ignore .worktrees directory#7131
diegolmello merged 2 commits into
developfrom
fix/scope-worktree-commands

Conversation

@diegolmello

@diegolmello diegolmello commented Apr 12, 2026

Copy link
Copy Markdown
Member

Proposed changes

Avoid running test/lint/typecheck commands on sibling git worktrees by ignoring the standard .worktrees/ directory in all four tools:

  • jest: Added /(^|\\/)\.worktrees\\// to testPathIgnorePatterns
  • eslint: Added .worktrees/ to .eslintignore
  • prettier: Added .worktrees/ to .prettierignore
  • tsc: Added **/.worktrees/** to tsconfig.json exclude

Issues

https://rocketchat.atlassian.net/browse/CORE-2098

How to test or reproduce

Run any of the four commands from a worktree inside .worktrees/ and verify only files from the current worktree are processed.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes

Summary by CodeRabbit

  • Chores
    • ESLint configured to ignore the .worktrees/ directory, excluding it from linting.
    • Prettier configured to skip formatting files within the .worktrees/ directory.
    • Jest updated to exclude the .worktrees/ directory from test discovery and execution.
    • TypeScript configuration updated to exclude the .worktrees/ directory from type checking and compilation.

@coderabbitai

coderabbitai Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9def2542-79db-4e9a-b0a1-c0a888e9e11f

📥 Commits

Reviewing files that changed from the base of the PR and between 3c175f9 and deebf72.

📒 Files selected for processing (4)
  • .eslintignore
  • .prettierignore
  • jest.config.js
  • tsconfig.json
✅ Files skipped from review due to trivial changes (4)
  • .eslintignore
  • .prettierignore
  • tsconfig.json
  • jest.config.js
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ESLint and Test / run-eslint-and-test

Walkthrough

Adds .worktrees/ directory exclusions to ESLint, Prettier, Jest, and TypeScript configurations so files under .worktrees/ are ignored by linting, formatting, testing, and type-checking.

Changes

Cohort / File(s) Summary
Development tool ignore updates
/.eslintignore, /.prettierignore, jest.config.js, tsconfig.json
Added .worktrees/ to .eslintignore and .prettierignore; appended '.worktrees/' to jest.config.js testPathIgnorePatterns; added **/.worktrees/** to tsconfig.json exclude.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: adding .worktrees directory to ignore patterns for jest, lint, prettier, and tsc tools.
Linked Issues check ✅ Passed All coding requirements from CORE-2098 are met: jest, eslint, prettier, and TypeScript now exclude .worktrees directory to prevent cross-worktree interference.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective of excluding .worktrees from development tools; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@jest.config.js`:
- Line 2: The regex in testPathIgnorePatterns currently has a leading literal
slash which prevents the ^ anchor from matching; update the pattern in
jest.config.js for testPathIgnorePatterns (the entry currently
'/(^|\\/)\\.worktrees\\//') to remove the leading slash so it reads
'(^|\\/)\\.worktrees\\/' (or an equivalent pattern that matches either
start-of-string or a path separator before .worktrees, e.g.,
'^(.*/)?\\.worktrees\\/') so .worktrees paths are correctly ignored.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d0d8346b-bad7-4bf2-b025-71b6ac0116e5

📥 Commits

Reviewing files that changed from the base of the PR and between 7bc94c3 and 4cf17ab.

📒 Files selected for processing (4)
  • .eslintignore
  • .prettierignore
  • jest.config.js
  • tsconfig.json
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ESLint and Test / run-eslint-and-test
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,jsx,ts,tsx,json}

📄 CodeRabbit inference engine (CLAUDE.md)

Configure Prettier with tabs, single quotes, 130 character width, no trailing commas, arrow parens avoid, and bracket same line

Files:

  • tsconfig.json
  • jest.config.js
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use ESLint with @rocket.chat/eslint-config base configuration including React, React Native, TypeScript, and Jest plugins

Files:

  • jest.config.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts,jsx,tsx}: Use descriptive names for functions, variables, and classes that clearly convey their purpose
Write comments that explain the 'why' behind code decisions, not the 'what'
Keep functions small and focused on a single responsibility
Use const by default, let when reassignment is needed, and avoid var
Prefer async/await over .then() chains for handling asynchronous operations
Use explicit error handling with try/catch blocks for async operations
Avoid deeply nested code; refactor complex logic into helper functions

Files:

  • jest.config.js
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: RocketChat/Rocket.Chat.ReactNative PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-07T17:49:17.538Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Use ESLint with rocket.chat/eslint-config base configuration including React, React Native, TypeScript, and Jest plugins
Learnt from: CR
Repo: RocketChat/Rocket.Chat.ReactNative PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-07T17:49:17.538Z
Learning: Run yarn prettier-lint and TZ=UTC yarn test for modified files before committing
Learnt from: CR
Repo: RocketChat/Rocket.Chat.ReactNative PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-07T17:49:17.538Z
Learning: Applies to **/*.{js,jsx,ts,tsx,json} : Configure Prettier with tabs, single quotes, 130 character width, no trailing commas, arrow parens avoid, and bracket same line
📚 Learning: 2026-04-07T17:49:25.836Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat.ReactNative PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-07T17:49:25.836Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript for type safety; add explicit type annotations to function parameters and return types

Applied to files:

  • tsconfig.json
📚 Learning: 2026-04-07T17:49:17.538Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat.ReactNative PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-07T17:49:17.538Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript with strict mode enabled and configure baseUrl to app/ for import resolution

Applied to files:

  • tsconfig.json
📚 Learning: 2026-04-07T17:49:17.538Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat.ReactNative PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-07T17:49:17.538Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Use ESLint with rocket.chat/eslint-config base configuration including React, React Native, TypeScript, and Jest plugins

Applied to files:

  • tsconfig.json
  • jest.config.js
📚 Learning: 2026-04-07T17:49:17.538Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat.ReactNative PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-07T17:49:17.538Z
Learning: Applies to **/*.{js,jsx,ts,tsx,json} : Configure Prettier with tabs, single quotes, 130 character width, no trailing commas, arrow parens avoid, and bracket same line

Applied to files:

  • tsconfig.json
  • jest.config.js
🔇 Additional comments (3)
.eslintignore (1)

8-8: LGTM: ESLint scope now correctly excludes .worktrees/.

This matches the PR intent and prevents linting sibling worktree files.

.prettierignore (1)

12-12: LGTM: Prettier ignore entry is correct.

Adding .worktrees/ here is consistent with the rest of the tooling exclusions.

tsconfig.json (1)

73-73: LGTM: TypeScript exclusion is correctly scoped.

"**/.worktrees/**" is an appropriate addition to keep tsc limited to the active worktree.

Comment thread jest.config.js Outdated
@diegolmello diegolmello changed the title fix: scope jest, lint, prettier, and tsc to ignore .worktrees directory chore: scope jest, lint, prettier, and tsc to ignore .worktrees directory Apr 13, 2026
@diegolmello diegolmello had a problem deploying to experimental_ios_build April 13, 2026 19:57 — with GitHub Actions Error
@diegolmello diegolmello had a problem deploying to experimental_android_build April 13, 2026 19:57 — with GitHub Actions Error
@diegolmello diegolmello had a problem deploying to official_android_build April 13, 2026 19:57 — with GitHub Actions Error

@diegolmello diegolmello left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Babysit Review (Round 1)

CI: ESLint + Tests PASSED.

Auto-fixed:

  • jest.config.js line 2 — Jest regex pattern was broken (leading slash made caret anchor impossible to match). Replaced with simple string approach. CodeRabbit also flagged this.

Decisions (no action needed):

  • Pattern style inconsistency (string vs regex) — functionally identical, simplified version is cleaner.
  • .prettierignore trailing-slash inconsistency — cosmetic.

@OtavioStasiak OtavioStasiak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me!

Avoid running test/lint/typecheck commands on sibling git worktrees by
ignoring the standard .worktrees/ directory in all four tools.
@diegolmello diegolmello force-pushed the fix/scope-worktree-commands branch from 3c175f9 to deebf72 Compare April 14, 2026 11:56
@diegolmello diegolmello had a problem deploying to official_android_build April 14, 2026 12:01 — with GitHub Actions Failure
@diegolmello diegolmello had a problem deploying to experimental_android_build April 14, 2026 12:01 — with GitHub Actions Failure
@diegolmello diegolmello had a problem deploying to experimental_ios_build April 14, 2026 12:01 — with GitHub Actions Failure
@diegolmello diegolmello merged commit 4dfdacc into develop Apr 14, 2026
5 of 10 checks passed
@diegolmello diegolmello deleted the fix/scope-worktree-commands branch April 14, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants