Skip to content

Conversation

@macchiitaka
Copy link

@macchiitaka macchiitaka commented Dec 21, 2025

Thank you for maintaining this useful plugin! I use it regularly and it's been very helpful for managing module dependencies in my projects.

Summary

Added tsconfigPath option to allow customization of the TypeScript configuration file path.

Background & Motivation

Currently, this plugin hardcodes reading from tsconfig.json. However, in real-world projects, there are cases where multiple tsconfig.json files are used (e.g., tsconfig.json, tsconfig.app.json, tsconfig.test.json). The current implementation always reads from tsconfig.json, which prevents loading application-specific configurations.

In particular, recent Vite templates create tsconfig.app.json by default alongside tsconfig.json and tsconfig.node.json to separate application-specific settings from the base configuration. This separation allows different TypeScript settings for different parts of the project (client-side application vs. Node.js build tools), improving maintainability and flexibility.

To solve this problem, we added the tsconfigPath option to allow users to flexibly specify which TypeScript configuration file to use.

Changes

New Feature

  • Added tsconfigPath option
    • Default: tsconfig.json (maintains existing behavior)
    • Can specify custom file names (e.g., tsconfig.app.json, tsconfig.base.json)

Modified Files

  • strict-dependencies/index.js: Added tsconfigPath option to schema
  • strict-dependencies/resolveImportPath.js: Modified to accept tsconfigPath parameter and read the specified file
  • __tests__/resolveImportPath.js: Added test cases for tsconfigPath option
  • __tests__/index.js: Updated resolveImportPath calls to support the 4th parameter
  • README.md: Added documentation for tsconfigPath option

Usage Example

// .eslintrc.js
{
  "rules": {
    "strict-dependencies/strict-dependencies": [
      "error",
      [
        {
          "module": "src/components/ui",
          "allowReferenceFrom": ["src/pages"]
        }
      ],
      {
        "tsconfigPath": "tsconfig.app.json"  // Specify custom tsconfig file
      }
    ]
  }
}

Backward Compatibility

  • When tsconfigPath option is not specified, existing behavior (defaults to tsconfig.json) is maintained
  • All existing tests pass

Additional Notes

This change enables projects using multiple tsconfig.json files to specify the appropriate configuration file for ESLint rules.

- Add tsconfigPath option to allow specifying custom tsconfig file
- Default behavior (tsconfig.json) is maintained for backward compatibility
- Update tests and documentation

Co-authored-by: Cursor Agent <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Dec 21, 2025

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • auto-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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