Skip to content

Conversation

@TheCodeDestroyer
Copy link
Owner

@TheCodeDestroyer TheCodeDestroyer commented May 31, 2025

Summary by CodeRabbit

  • Chores
    • Updated metadata to document patch releases for ESLint NextJS, React, TypeScript, and preset packages.
    • Added a new runtime dependency to improve compatibility.
  • Refactor
    • Adjusted ESLint rule configuration to disable the 'import-x/no-rename-default' rule for all JavaScript and TypeScript files.
    • Updated how the ESLint NextJS plugin configuration is imported, with no impact on user-facing functionality.
  • New Features
    • ESLint now respects .gitignore files to exclude ignored paths from linting.
    • Added automatic React version detection to the ESLint React configuration.
    • Expanded ESLint ignore patterns to include the .next directory.
    • Disabled the @typescript-eslint/unbound-method rule by default in the TypeScript ESLint configuration.

@coderabbitai
Copy link

coderabbitai bot commented May 31, 2025

📝 Walkthrough

Walkthrough

Multiple patch updates were documented for ESLint-related packages including @tcd-devkit/eslint-config-next, @tcd-devkit/eslint-config, @tcd-devkit/eslint-config-react, @tcd-devkit/eslint-preset-next, and @tcd-devkit/eslint-config-ts. Changes include disabling a specific import rule globally, adding React version detection, ignoring the .next directory, integrating .gitignore patterns into ESLint, refactoring an import statement in the Next.js ESLint config, adding a runtime dependency, and disabling a TypeScript ESLint rule with corresponding tests.

Changes

File(s) Change Summary
.changeset/flat-worlds-like.md Added a changeset documenting a patch update for @tcd-devkit/eslint-config-next.
.changeset/empty-banks-stay.md Added a changeset documenting a patch update for @tcd-devkit/eslint-config to support ignoring .gitignore entries.
.changeset/plain-buckets-tease.md Added a changeset documenting a patch update for @tcd-devkit/eslint-config-react to add React version detection.
.changeset/silly-goats-crash.md Added a changeset documenting a patch update for @tcd-devkit/eslint-preset-next to ignore .next directory.
.changeset/public-taxis-matter.md Added a changeset documenting a patch update for @tcd-devkit/eslint-config-ts to disable @typescript-eslint/unbound-method rule.
eslint.config.mjs Moved 'import-x/no-rename-default': ['off'] rule to apply globally to JS/TS files instead of only fixtures.
packages/eslint/eslint-config-next/src/next.linter.ts Refactored import of flatConfig from named import to extracting from default plugin object.
packages/eslint-presets/eslint-preset-next/src/next-preset.linter.ts Added .next directory to global ESLint ignore patterns.
packages/eslint/eslint-config-react/src/react.linter.ts Added settings.react.version with value 'detect' for automatic React version detection.
packages/eslint/eslint-config/package.json Added runtime dependency @eslint/compat version 1.2.9.
packages/eslint/eslint-config/src/base.linter.ts Integrated .gitignore ignore patterns into ESLint base config using @eslint/compat and Node.js fs/url modules.
packages/eslint/eslint-config-ts/src/ts.rules.ts Disabled @typescript-eslint/unbound-method rule by adding it to tsRules with value ['off']; added console log.
packages/eslint/eslint-config-ts/src/tests/rules/unbound-method.test.ts Added test verifying that @typescript-eslint/unbound-method rule is disabled by default.

Poem

🐇 A patch hops in with silent cheer,
Rules moved and imports made clear.
React’s version now detected true,
.next ignored, .gitignore too.
TypeScript’s bound method takes a rest,
Tests confirm it’s off, all’s blessed! 🌿✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

Scope: all 4 workspace projects
/tmp/eslint/packages/eslint-presets/eslint-preset-node:
 ERR_PNPM_WORKSPACE_PKG_NOT_FOUND  In packages/eslint-presets/eslint-preset-node: "@tcd-devkit/eslint-config@workspace:*" is in the dependencies but no package named "@tcd-devkit/eslint-config" is present in the workspace

This error happened while installing a direct dependency of /tmp/eslint/packages/eslint-presets/eslint-preset-node

Packages found in the workspace:

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

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

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

@coderabbitai coderabbitai bot changed the title @coderabbitai Disable 'import-x/no-rename-default' rule in ESLint config and refactor import May 31, 2025
Copy link

@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)
.changeset/flat-worlds-like.md (1)

5-5: Fix the framework name spelling.

Use the official spelling "Next.js" instead of "NextJS" for consistency with the framework's branding.

-Fix ESLint NextJS config
+Fix ESLint Next.js config
🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: The official spelling of this programming framework is “Next.js”.
Context: ...int-config-next': patch --- Fix ESLint NextJS config

(NODE_JS)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 096af14 and da9bef6.

📒 Files selected for processing (3)
  • .changeset/flat-worlds-like.md (1 hunks)
  • eslint.config.mjs (1 hunks)
  • packages/eslint/eslint-config-next/src/next.linter.ts (1 hunks)
🧰 Additional context used
🪛 LanguageTool
.changeset/flat-worlds-like.md

[uncategorized] ~5-~5: The official spelling of this programming framework is “Next.js”.
Context: ...int-config-next': patch --- Fix ESLint NextJS config

(NODE_JS)

🔇 Additional comments (1)
packages/eslint/eslint-config-next/src/next.linter.ts (1)

1-1:

❓ Verification inconclusive

Verify the import style change is necessary.

The refactor from named import to default import with destructuring changes how flatConfig is accessed. Ensure this change aligns with the current export structure of @next/eslint-plugin-next.

Also applies to: 5-5


🏁 Script executed:

#!/bin/bash
# Description: Check the export structure of @next/eslint-plugin-next to verify the import change is necessary
# Expected: Confirm whether flatConfig is available as named export or only through default export

# Check if package.json references the Next.js ESLint plugin
rg -A 5 -B 5 "@next/eslint-plugin-next" package.json

# Search for any other usage patterns of this import in the codebase
rg -A 3 -B 3 "from '@next/eslint-plugin-next'" 

Length of output: 459


Verify flatConfig import matches the plugin’s current exports

Before approving, confirm whether @next/eslint-plugin-next actually exports flatConfig as a named export or only via its default export. This will ensure the import in packages/eslint/eslint-config-next/src/next.linter.ts is correct.

• Check the published plugin’s export signatures (e.g., inspect its type definitions in node_modules or its repository README).
• If flatConfig is a named export, revert to import { flatConfig } from '@next/eslint-plugin-next'.
• If it’s only exposed on the default export, keep import nextPlugin from '@next/eslint-plugin-next' and destructure.

File needing confirmation:

  • packages/eslint/eslint-config-next/src/next.linter.ts:1

@changeset-bot
Copy link

changeset-bot bot commented May 31, 2025

🦋 Changeset detected

Latest commit: 26edbe5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@tcd-devkit/eslint-config Patch
@tcd-devkit/eslint-config-next Patch
@tcd-devkit/eslint-config-react Patch
@tcd-devkit/eslint-config-ts Patch
@tcd-devkit/eslint-preset-next Patch
@tcd-devkit/eslint-preset-node Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

@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)
packages/eslint/eslint-config/src/base.linter.ts (1)

11-12: Consider more robust project root detection.

Using process.cwd() assumes ESLint runs from the project root, which may not always be the case in monorepos or when ESLint is invoked from subdirectories.

Consider using a more robust approach to find the project root:

-const cwdURL = `file://${process.cwd()}/`;
-const gitignorePath = fileURLToPath(new URL(`.gitignore`, cwdURL));
+// Find project root by looking for package.json or .git directory
+import { findUp } from 'find-up';
+const projectRoot = findUp.sync(['.git', 'package.json'], { type: 'directory' }) || process.cwd();
+const gitignorePath = path.join(projectRoot, '.gitignore');

However, this would require adding find-up as a dependency. The current approach is acceptable for most use cases.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between da9bef6 and 4a6024f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • .changeset/empty-banks-stay.md (1 hunks)
  • .changeset/plain-buckets-tease.md (1 hunks)
  • .changeset/silly-goats-crash.md (1 hunks)
  • packages/eslint-presets/eslint-preset-next/src/next-preset.linter.ts (1 hunks)
  • packages/eslint/eslint-config-react/src/react.linter.ts (1 hunks)
  • packages/eslint/eslint-config/package.json (1 hunks)
  • packages/eslint/eslint-config/src/base.linter.ts (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • .changeset/silly-goats-crash.md
  • packages/eslint/eslint-config-react/src/react.linter.ts
  • packages/eslint/eslint-config/package.json
  • .changeset/plain-buckets-tease.md
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: TheCodeDestroyer
PR: TheCodeDestroyer/devkit#5
File: packages/eslint/eslint-config-react/package.json:80-80
Timestamp: 2025-05-23T18:25:39.851Z
Learning: The @tcd-devkit ESLint configuration packages (like eslint-config-react) are built from scratch specifically for ESLint v9+ using the flat config format, not migrated from older ESLint versions.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: main
🔇 Additional comments (5)
packages/eslint-presets/eslint-preset-next/src/next-preset.linter.ts (1)

14-14: LGTM! Appropriate ignore pattern for Next.js.

Adding the .next directory to the global ignores is correct as it contains generated build files that shouldn't be linted.

packages/eslint/eslint-config/src/base.linter.ts (3)

14-21: Clean conditional logic for .gitignore handling.

The implementation correctly handles the case where .gitignore doesn't exist by using an empty object fallback, preventing configuration errors.


22-24: Proper integration of .gitignore config.

The gitignoreConfig is correctly prepended to the configuration array, ensuring .gitignore patterns are applied before other rules.


1-4:

✅ Verification successful

Good implementation approach with minor considerations.

The imports look correct for implementing .gitignore integration. The use of Node.js built-in modules and @eslint/compat follows ESLint's recommended patterns for flat config.

Verify that @eslint/compat is properly added as a dependency:


🏁 Script executed:

#!/bin/bash
# Description: Check if @eslint/compat is listed as a dependency
# Expected: The package should be listed in dependencies or devDependencies

fd "package.json" packages/eslint/eslint-config --exec cat {} | jq '.dependencies, .devDependencies'

Length of output: 451


Dependency Verification Complete – No Further Action Needed

Verified that @eslint/compat (v1.2.9) is listed under dependencies in packages/eslint/eslint-config/package.json. All imports and config logic look correct—approving these changes.

.changeset/empty-banks-stay.md (1)

1-6: Well-formatted changeset documentation.

The changeset correctly documents the patch-level update for adding .gitignore support to the ESLint configuration package.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 31, 2025
Copy link

@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 (3)
.changeset/flat-worlds-like.md (1)

1-6: Use official "Next.js" branding and clarify the changeset description

The description currently reads:

Fix ESLint NextJS config
  • The framework is officially spelled “Next.js”.
  • It would be more informative to mention that this patch disables the import-x/no-rename-default rule and refactors the flatConfig import.

Apply this diff:

---
- Fix ESLint NextJS config
+ Fix ESLint Next.js config by disabling `import-x/no-rename-default` rule and refactoring `flatConfig` import
🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: The official spelling of this programming framework is “Next.js”.
Context: ...int-config-next': patch --- Fix ESLint NextJS config

(NODE_JS)

packages/eslint/eslint-config-ts/src/__tests__/rules/unbound-method.test.ts (1)

1-18: LGTM with debugging cleanup needed.

The test structure and logic are correct. The test properly verifies that the @typescript-eslint/unbound-method rule is disabled by checking it equals ['off']. The use of the CustomRule type provides good type safety.

However, the console.log statements appear to be debugging code that should be removed before merging.

Apply this diff to remove the debugging statements:

-    console.log('tsRules:', tsRules);
-    console.log('ruleId:', ruleId);
-    console.log('ruleValue:', ruleValue);
-
packages/eslint/eslint-config-ts/src/ts.rules.ts (1)

25-26: Remove debugging console.log statement.

This console.log statement appears to be debugging code that should be removed before merging to production.

Apply this diff to remove the debugging statement:

-console.log('source tsRules:', tsRules);
-
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4a6024f and 26edbe5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (13)
  • .changeset/empty-banks-stay.md (1 hunks)
  • .changeset/flat-worlds-like.md (1 hunks)
  • .changeset/plain-buckets-tease.md (1 hunks)
  • .changeset/public-taxis-matter.md (1 hunks)
  • .changeset/silly-goats-crash.md (1 hunks)
  • eslint.config.mjs (1 hunks)
  • packages/eslint-presets/eslint-preset-next/src/next-preset.linter.ts (1 hunks)
  • packages/eslint/eslint-config-next/src/next.linter.ts (1 hunks)
  • packages/eslint/eslint-config-react/src/react.linter.ts (1 hunks)
  • packages/eslint/eslint-config-ts/src/__tests__/rules/unbound-method.test.ts (1 hunks)
  • packages/eslint/eslint-config-ts/src/ts.rules.ts (2 hunks)
  • packages/eslint/eslint-config/package.json (1 hunks)
  • packages/eslint/eslint-config/src/base.linter.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/public-taxis-matter.md
🚧 Files skipped from review as they are similar to previous changes (9)
  • .changeset/plain-buckets-tease.md
  • .changeset/silly-goats-crash.md
  • packages/eslint-presets/eslint-preset-next/src/next-preset.linter.ts
  • .changeset/empty-banks-stay.md
  • packages/eslint/eslint-config/package.json
  • packages/eslint/eslint-config-next/src/next.linter.ts
  • eslint.config.mjs
  • packages/eslint/eslint-config/src/base.linter.ts
  • packages/eslint/eslint-config-react/src/react.linter.ts
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: TheCodeDestroyer
PR: TheCodeDestroyer/devkit#32
File: eslint.config.mjs:5-10
Timestamp: 2025-05-31T20:36:11.688Z
Learning: The NextJS ESLint plugin (@next/eslint-plugin-next) exports a default named plugin that requires importing as a default export and then destructuring the needed configuration (e.g., flatConfig). This pattern triggers the `import-x/no-rename-default` rule, necessitating a global disable of this rule when using NextJS ESLint configurations.
Learnt from: TheCodeDestroyer
PR: TheCodeDestroyer/devkit#5
File: packages/eslint/eslint-config-react/package.json:80-80
Timestamp: 2025-05-23T18:25:39.851Z
Learning: The @tcd-devkit ESLint configuration packages (like eslint-config-react) are built from scratch specifically for ESLint v9+ using the flat config format, not migrated from older ESLint versions.
🧬 Code Graph Analysis (1)
packages/eslint/eslint-config-ts/src/__tests__/rules/unbound-method.test.ts (1)
packages/eslint/eslint-config-ts/src/ts.rules.ts (2)
  • CustomRule (27-27)
  • tsRules (3-23)
🪛 LanguageTool
.changeset/flat-worlds-like.md

[uncategorized] ~5-~5: The official spelling of this programming framework is “Next.js”.
Context: ...int-config-next': patch --- Fix ESLint NextJS config

(NODE_JS)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: main
🔇 Additional comments (1)
packages/eslint/eslint-config-ts/src/ts.rules.ts (1)

12-12: LGTM! Rule addition is correct.

The addition of '@typescript-eslint/unbound-method': ['off'] follows the established pattern and correctly disables the rule as intended.

@TheCodeDestroyer TheCodeDestroyer merged commit af1d4f7 into main Jun 1, 2025
3 checks passed
@TheCodeDestroyer TheCodeDestroyer deleted the fix-eslint-config-next branch June 1, 2025 08:30
@github-actions github-actions bot mentioned this pull request Jun 1, 2025
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.

2 participants