Skip to content

Root tsconfig#2890

Merged
RobinTail merged 7 commits intomasterfrom
root-tsconfig
Aug 28, 2025
Merged

Root tsconfig#2890
RobinTail merged 7 commits intomasterfrom
root-tsconfig

Conversation

@RobinTail
Copy link
Copy Markdown
Owner

@RobinTail RobinTail commented Aug 16, 2025

This changes tsconfig.base.json to tsconfig.json in the root, so that it won't require extension in every workspace and TS files in root would be covered too

@RobinTail RobinTail added dependencies Pull requests that update a dependency file refactoring The better way to achieve the same result labels Aug 16, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 16, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Updates multiple tsconfig.json files to extend ../tsconfig.json instead of ../tsconfig.base.json, removes content from cjs-test/tsconfig.json, fixes a trailing comma in migration/tsconfig.json, adds a typed interface for ESLint restricted syntax arrays, bumps ESLint and adds @eslint/js, and introduces a Renovate grouping rule for ESLint.

Changes

Cohort / File(s) Summary
TypeScript base switch
esm-test/tsconfig.json, example/tsconfig.json, express-zod-api/tsconfig.json, issue952-test/tsconfig.json, tools/tsconfig.json, zod-plugin/tsconfig.json
Change extends from ../tsconfig.base.json to ../tsconfig.json; other options unchanged.
TS config cleanup
migration/tsconfig.json
Change extends to ../tsconfig.json; remove trailing comma to fix JSON syntax.
TS config removal
cjs-test/tsconfig.json
Remove previous content; no base tsconfig is extended now.
ESLint typing
eslint.config.ts
Add interface RestrictedSyntax and annotate three rule arrays with RestrictedSyntax[]; no runtime changes.
Renovate rule
renovate.json
Add ESLint grouping rule for eslint and @eslint/*.
Dev dependency update
package.json
Add @eslint/js; bump eslint to ^9.33.0.

Sequence Diagram(s)

sequenceDiagram
  participant Dev
  participant Repo
  participant CI

  Dev->>Repo: Push tsconfig, ESLint, Renovate, package.json changes
  Repo-->>CI: Trigger pipeline
  CI->>CI: Use root tsconfig.json for subprojects
  CI->>CI: Apply ESLint with typed restrictions
  CI->>CI: Renovate groups ESLint updates per new rule
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Configuring renovate groups #2746 — Also modifies renovate.json packageRules to add grouping (TypeScript-ESLint and Vitest), aligning with this PR’s new ESLint grouping.

Suggested labels

CI/CD

Poem

In burrows of config, I hop with glee,
Switching bases from base to tree.
Lint rules tidied, types in a row,
Renovate herds where updates go.
A nibble of versions, a carrot of cheer—
Thump-thump! Clean paths for the code to steer. 🥕

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch root-tsconfig

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
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@RobinTail RobinTail marked this pull request as ready for review August 16, 2025 12:35
Copy link
Copy Markdown
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 (4)
renovate.json (1)

15-19: Good Renovate grouping for ESLint; consider including Prettier integrations (optional)

Grouping eslint with @eslint/* is correct and matches Renovate’s supported wildcards (as learned previously). Optionally, you may want to group eslint-config-prettier and eslint-plugin-prettier with ESLint updates, since they often move in tandem.

Apply this if you want them grouped together:

     {
       "groupName": "ESLint and its core modules",
-      "matchPackageNames": ["eslint", "@eslint/*"]
+      "matchPackageNames": ["eslint", "@eslint/*", "eslint-config-prettier", "eslint-plugin-prettier"]
     }
eslint.config.ts (3)

20-35: Type it readonly and avoid false positives for node: built-ins

  • Minor: prefer ReadonlyArray to prevent accidental mutation.
  • Important: builtinModules typically includes both "fs" and "node:fs". Current selector would also flag correct imports like import 'node:fs' and suggest node:node:fs. Filter out the node: prefixed items.

Apply both in one go:

-const importConcerns: RestrictedSyntax[] = [
+const importConcerns: ReadonlyArray<RestrictedSyntax> = [
   {
     selector:
       "ImportDeclaration[source.value='ramda'] > ImportSpecifier, " +
       "ImportDeclaration[source.value='ramda'] > ImportDefaultSpecifier",
     message: "use import * as R from 'ramda'",
   },
   {
     selector: "ImportDeclaration[source.value=/^zod/] > ImportDefaultSpecifier",
     message: "do import { z } instead",
   },
-  ...builtinModules.map((mod) => ({
+  ...builtinModules
+    .filter((mod) => !mod.startsWith("node:"))
+    .map((mod) => ({
       selector: `ImportDeclaration[source.value='${mod}']`,
       message: `use node:${mod} for the built-in module`,
-  })),
+    })),
 ];

37-64: Nit: use ReadonlyArray typing for consistency and safety

Same reasoning as above—mark as read-only to avoid accidental mutations during future edits.

-const performanceConcerns: RestrictedSyntax[] = [
+const performanceConcerns: ReadonlyArray<RestrictedSyntax> = [

66-168: Mark tsFactoryConcerns as ReadonlyArray and sanity-check selectors

  • Change the declaration to prevent accidental mutation while still allowing spread into rules:
-const tsFactoryConcerns: RestrictedSyntax[] = [
+const tsFactoryConcerns: ReadonlyArray<RestrictedSyntax> = [
  • No code mutates this array, and ReadonlyArray still supports spread usage at line 242.

– After upgrading ESLint/TS-ESLint, spot-check a few selectors (e.g. Identifier[name='KeyOfKeyword'], Literal[value='Promise']) against the AST emitted by @typescript-eslint/parser. A quick sample .ts file run through your config will confirm they still fire as expected.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4533a59 and c3b9cb5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • cjs-test/tsconfig.json (0 hunks)
  • eslint.config.ts (3 hunks)
  • esm-test/tsconfig.json (1 hunks)
  • example/tsconfig.json (1 hunks)
  • express-zod-api/tsconfig.json (1 hunks)
  • issue952-test/tsconfig.json (1 hunks)
  • migration/tsconfig.json (1 hunks)
  • package.json (1 hunks)
  • renovate.json (1 hunks)
  • tools/tsconfig.json (1 hunks)
  • zod-plugin/tsconfig.json (1 hunks)
💤 Files with no reviewable changes (1)
  • cjs-test/tsconfig.json
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-06-14T16:42:52.972Z
Learnt from: RobinTail
PR: RobinTail/express-zod-api#2736
File: express-zod-api/tsup.config.ts:12-26
Timestamp: 2025-06-14T16:42:52.972Z
Learning: In express-zod-api tsup configurations, the direct mutation of `options.supported` in the `esbuildOptions` callback is intentional behavior and should not be flagged as a side effect issue.

Applied to files:

  • zod-plugin/tsconfig.json
  • express-zod-api/tsconfig.json
📚 Learning: 2025-08-01T09:48:13.742Z
Learnt from: RobinTail
PR: RobinTail/express-zod-api#0
File: :0-0
Timestamp: 2025-08-01T09:48:13.742Z
Learning: In express-zod-api, when migrating from Zod v3 to v4, the correct approach for internal type imports is to change from `import type { $ZodType } from "zod/v4/core"` to `import { z } from "zod"` and then use `z.core.$ZodType`. The zod/v4/core module is reexported as z.core by the main zod package, making this a valid and working approach.

Applied to files:

  • express-zod-api/tsconfig.json
📚 Learning: 2025-06-02T21:08:56.475Z
Learnt from: RobinTail
PR: RobinTail/express-zod-api#2697
File: CHANGELOG.md:5-5
Timestamp: 2025-06-02T21:08:56.475Z
Learning: The `cjs-test` directory in the express-zod-api repository is a test workspace and should be excluded when checking for main project version consistency with changelog entries.

Applied to files:

  • express-zod-api/tsconfig.json
📚 Learning: 2025-05-28T18:58:10.064Z
Learnt from: RobinTail
PR: RobinTail/express-zod-api#2428
File: express-zod-api/src/index.ts:44-44
Timestamp: 2025-05-28T18:58:10.064Z
Learning: The type-only import `import type {} from "qs";` in express-zod-api/src/index.ts is necessary to avoid TS2742 errors for exported functions like attachRouting, makeRequestMock, testEndpoint, and testMiddleware that have types depending on types/qs. This import provides the reference TypeScript needs to infer portable type names.

Applied to files:

  • express-zod-api/tsconfig.json
  • eslint.config.ts
📚 Learning: 2025-06-15T13:56:19.544Z
Learnt from: RobinTail
PR: RobinTail/express-zod-api#2746
File: renovate.json:6-13
Timestamp: 2025-06-15T13:56:19.544Z
Learning: In Renovate configuration, `matchPackageNames` supports wildcard patterns using glob syntax (e.g., `typescript-eslint/*`). There is no `matchPackagePatterns` field. The `groupName` property is required to group related packages into single PRs.

Applied to files:

  • renovate.json
🔇 Additional comments (8)
example/tsconfig.json (1)

2-2: Extending the root tsconfig.json: sanity-check parity with the old base

Looks good. Please confirm the root tsconfig.json preserves any critical options previously provided by tsconfig.base.json (paths, strictness, lib targets) to avoid subtle behavior drift in this package.

issue952-test/tsconfig.json (1)

2-2: Switch to root config: confirm relative path correctness and inherited options

The relative path looks correct. Please double-check that the root tsconfig.json provides the same declaration-related settings (or at least doesn’t override them unexpectedly) since this package emits d.ts only.

migration/tsconfig.json (1)

2-2: Good fix on trailing comma; confirm base-config parity after extend switch

  • Trailing comma removal is correct JSON hygiene. LGTM.
  • After switching extends to ../tsconfig.json, please verify no behavior changes vs the previous tsconfig.base.json (notably module/moduleResolution interplay and any base include/exclude).

Also applies to: 7-7

express-zod-api/tsconfig.json (1)

2-2: Root tsconfig.json present and stale references removed

  • ✔️ tsconfig.json exists at the repository root
  • ✔️ No remaining references to tsconfig.base.json
  • ✔️ All package-level tsconfig.json files now extend "../tsconfig.json"
tools/tsconfig.json (1)

2-2: No stale tsconfig.base.json references and TS version supports “bundler” resolution

  • No lingering "extends": "../tsconfig.base.json" entries or tsconfig.base.json files in the repo.
  • All package.json TS versions are ≥ 5.1.3 (and some on “catalog:dev”), satisfying the ≥ 5.0 requirement for moduleResolution: "Bundler".
  • Existing tsconfig files correctly use moduleResolution: "Bundler" and will work as expected.
esm-test/tsconfig.json (1)

2-2: LGTM: consistent shift to root tsconfig

Extending the root tsconfig.json keeps settings centralized. No issues spotted.

zod-plugin/tsconfig.json (1)

2-2: LGTM: aligns with repo-wide config consolidation

Extending ../tsconfig.json is consistent with the PR objective. The local compilerOptions and exclude remain intact.

eslint.config.ts (1)

15-18: Nice: explicit typing for restricted-syntax entries

The RestrictedSyntax interface tightens config shape and improves maintainability. Good addition.

Comment thread package.json Outdated
@RobinTail
Copy link
Copy Markdown
Owner Author

eslint config file in compat test will remain JS, because TS-based one was added in 9.24.0

@coveralls-official
Copy link
Copy Markdown

coveralls-official Bot commented Aug 18, 2025

Coverage Status

coverage: 100.0%. remained the same
when pulling 3cc3b05 on root-tsconfig
into acfe2ab on master.

@RobinTail RobinTail changed the title Root tsconfig and ESLint config in typescript Root tsconfig Aug 18, 2025
@RobinTail RobinTail removed the dependencies Pull requests that update a dependency file label Aug 18, 2025
Copy link
Copy Markdown
Owner Author

@RobinTail RobinTail left a comment

Choose a reason for hiding this comment

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

should be fine

@RobinTail RobinTail merged commit 54d2bf8 into master Aug 28, 2025
13 checks passed
@RobinTail RobinTail deleted the root-tsconfig branch August 28, 2025 09:18
This was referenced Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring The better way to achieve the same result

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant