Skip to content

Conversation

@TheCodeDestroyer
Copy link
Owner

@TheCodeDestroyer TheCodeDestroyer commented Jun 1, 2025

Summary by CodeRabbit

  • New Features

    • Added support for the --max-warnings option to the lint command, allowing users to set a maximum number of warnings before the process fails.
    • ESLint configurations now include TypeScript file extensions, expanding linting coverage to .ts and .tsx files.
    • Improved Node.js environment support in ESLint presets by explicitly defining Node.js global variables.
  • Bug Fixes

    • Addressed missing TypeScript file extensions in ESLint configurations.
    • Fixed ESLint errors in TypeScript ESLint config.
  • Documentation

    • Updated documentation to reflect the new --max-warnings lint option.
  • Chores

    • Added new development dependency for commit linting.
    • Minor comment and formatting cleanups.

@changeset-bot
Copy link

changeset-bot bot commented Jun 1, 2025

🦋 Changeset detected

Latest commit: 4c3c3f4

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

This PR includes changesets to release 7 packages
Name Type
@tcd-devkit/eslint-config-ts Patch
@tcd-devkit/eslint-preset-node Patch
@tcd-devkit/scripts Patch
@tcd-devkit/eslint-config-import Patch
@tcd-devkit/eslint-config Patch
@tcd-devkit/eslint-config-import-ts Patch
@tcd-devkit/eslint-preset-next 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

@coderabbitai
Copy link

coderabbitai bot commented Jun 1, 2025

📝 Walkthrough

Walkthrough

This update introduces several new changeset files documenting patch updates across multiple packages, including ESLint configurations and scripts. It expands ESLint file matching to TypeScript extensions, adds Node.js globals to the Node preset, introduces a max-warnings CLI option for linting, updates dependencies, and cleans up console logs and documentation.

Changes

File(s) Summary
.changeset/*.md Added changeset files documenting patch updates for ESLint configs and scripts packages.
packages/eslint/eslint-config-import/src/import.linter.ts
packages/eslint/eslint-config/src/base.linter.ts
Expanded ESLint file matching to include .ts and .tsx extensions.
packages/eslint-presets/eslint-preset-node/src/node-preset.linter.ts
packages/eslint-presets/eslint-preset-node/package.json
Added Node.js globals to ESLint config and added globals dependency.
packages/scripts/src/constants/option.constants.ts
packages/scripts/src/types/option.types.ts
packages/scripts/src/commands/lint.command.ts
packages/scripts/src/utils/cli.utils.ts
packages/scripts/README.md
Added and documented the max-warnings CLI option for linting.
packages/eslint/eslint-config-ts/src/tests/rules/unbound-method.test.ts
packages/eslint/eslint-config-ts/src/ts.rules.ts
Removed debug console.log statements from test and rules files.
commitlint.config.js Changed JSDoc type annotation to single-line comment.
package.json Added @commitlint/types as a devDependency.
packages/scripts/src/commands/format.command.ts Removed unnecessary blank line.
prettier.config.cjs Updated ESLint directive comment.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant runEslint (utils)
    participant ESLint

    User->>CLI: tcd-scripts lint --max-warnings 10
    CLI->>runEslint (utils): Call runEslint with options
    runEslint (utils)->>ESLint: Run ESLint with --max-warnings 10
    ESLint-->>runEslint (utils): Lint results
    runEslint (utils)-->>CLI: Return results
    CLI-->>User: Output lint summary
Loading

Possibly related PRs

  • Dependency Dashboard #6: Established the initial changesets infrastructure, which this PR builds upon by adding new changeset files and documenting further package updates.

Poem

A patch here, a tweak there,
TypeScript files get extra care.
Node globals join the linting spree,
Max warnings set for all to see.
With changes tracked and logs now gone,
The rabbit hops—linting on! 🐇✨

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
Progress: resolved 0, reused 0, downloaded 1, added 0
/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 Expand ESLint support for TypeScript and add max-warnings CLI option Jun 1, 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 (4)
packages/eslint/eslint-config/src/base.linter.ts (1)

27-27: Suggest extending file patterns for edge cases.

To support edge-case extensions used by consuming projects (e.g., .mjsx and .mtsx), consider updating the pattern:

-files: ['**/*.{js,jsx,ts,tsx,mjs,cjs}'],
+files: ['**/*.{js,jsx,ts,tsx,mjs,cjs,mjsx,mtsx}'],
packages/eslint/eslint-config-import/src/import.linter.ts (1)

12-12: Suggest extending file patterns for edge cases.

To cover additional file types used in external projects, you might include .mjsx and .mtsx:

-files: ['**/*.{js,jsx,ts,tsx,mjs,cjs}'],
+files: ['**/*.{js,jsx,ts,tsx,mjs,cjs,mjsx,mtsx}'],
packages/scripts/src/types/option.types.ts (1)

12-12: Consider adding type documentation for the maxWarnings property.

The maxWarnings property is correctly typed as string since CLI arguments are parsed as strings. However, consider adding a JSDoc comment to clarify that this represents a stringified number value.

+  /** Maximum number of warnings allowed (as string from CLI) */
   maxWarnings?: string;
packages/scripts/src/utils/cli.utils.ts (1)

160-162: Logic is correct, but consider type consistency.

The conditional logic properly handles the max-warnings option. However, since the option default is defined as '0' (string) in the constants file, calling .toString() is redundant.

Consider simplifying if maxWarnings is already typed as a string:

  if (options.maxWarnings !== undefined) {
-    eslintArgs.push('--max-warnings', options.maxWarnings.toString());
+    eslintArgs.push('--max-warnings', options.maxWarnings);
  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e4fd177 and 4c3c3f4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/cruel-breads-read.md (1 hunks)
  • .changeset/khaki-pigs-wink.md (1 hunks)
  • .changeset/salty-pianos-write.md (1 hunks)
  • .changeset/solid-lands-tickle.md (1 hunks)
  • commitlint.config.js (1 hunks)
  • package.json (1 hunks)
  • packages/eslint-presets/eslint-preset-node/package.json (1 hunks)
  • packages/eslint-presets/eslint-preset-node/src/node-preset.linter.ts (2 hunks)
  • packages/eslint/eslint-config-import/src/import.linter.ts (1 hunks)
  • packages/eslint/eslint-config-ts/src/__tests__/rules/unbound-method.test.ts (0 hunks)
  • packages/eslint/eslint-config-ts/src/ts.rules.ts (0 hunks)
  • packages/eslint/eslint-config/src/base.linter.ts (1 hunks)
  • packages/scripts/README.md (1 hunks)
  • packages/scripts/src/commands/format.command.ts (0 hunks)
  • packages/scripts/src/commands/lint.command.ts (2 hunks)
  • packages/scripts/src/constants/option.constants.ts (1 hunks)
  • packages/scripts/src/types/option.types.ts (1 hunks)
  • packages/scripts/src/utils/cli.utils.ts (1 hunks)
  • prettier.config.cjs (1 hunks)
💤 Files with no reviewable changes (3)
  • packages/eslint/eslint-config-ts/src/ts.rules.ts
  • packages/scripts/src/commands/format.command.ts
  • packages/eslint/eslint-config-ts/src/tests/rules/unbound-method.test.ts
🧰 Additional context used
🧠 Learnings (4)
.changeset/solid-lands-tickle.md (1)
Learnt from: TheCodeDestroyer
PR: TheCodeDestroyer/devkit#5
File: packages/eslint/eslint-config-react/src/react.linter.ts:20-20
Timestamp: 2025-05-23T17:50:17.181Z
Learning: ESLint configuration packages in the @tcd-devkit ecosystem are designed to be consumed by external projects, so they may include file patterns and extensions (like mjsx, mtsx) that aren't used in the current monorepo but might be needed by consuming projects.
packages/eslint/eslint-config-import/src/import.linter.ts (2)
Learnt from: TheCodeDestroyer
PR: TheCodeDestroyer/devkit#5
File: packages/internal-utils/package.json:55-55
Timestamp: 2025-05-23T19:27:10.314Z
Learning: Each individual ESLint config package in the @tcd-devkit monorepo has its own "imports" field that maps "#*" to their source files, enabling alias imports like #react.linter within their own package scope. The internal-utils package doesn't need an "imports" field when it only contains one source file.
Learnt from: TheCodeDestroyer
PR: TheCodeDestroyer/devkit#5
File: packages/eslint/eslint-config-react/src/react.linter.ts:20-20
Timestamp: 2025-05-23T17:50:17.181Z
Learning: ESLint configuration packages in the @tcd-devkit ecosystem are designed to be consumed by external projects, so they may include file patterns and extensions (like mjsx, mtsx) that aren't used in the current monorepo but might be needed by consuming projects.
packages/eslint/eslint-config/src/base.linter.ts (1)
Learnt from: TheCodeDestroyer
PR: TheCodeDestroyer/devkit#5
File: packages/eslint/eslint-config-react/src/react.linter.ts:20-20
Timestamp: 2025-05-23T17:50:17.181Z
Learning: ESLint configuration packages in the @tcd-devkit ecosystem are designed to be consumed by external projects, so they may include file patterns and extensions (like mjsx, mtsx) that aren't used in the current monorepo but might be needed by consuming projects.
packages/eslint-presets/eslint-preset-node/src/node-preset.linter.ts (1)
Learnt from: TheCodeDestroyer
PR: TheCodeDestroyer/devkit#5
File: packages/eslint-presets/eslint-preset-node/src/node-preset.linter.ts:14-20
Timestamp: 2025-05-23T17:49:36.376Z
Learning: The @tcd-devkit preset packages (like eslint-preset-node) are designed to be combinations of existing @tcd-devkit config packages rather than introducing new external plugins or rules. They serve as "plug n play" bundles for convenience.
🧬 Code Graph Analysis (1)
packages/scripts/src/commands/lint.command.ts (1)
packages/scripts/src/constants/option.constants.ts (1)
  • maxWarningsOption (57-60)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: main
🔇 Additional comments (17)
prettier.config.cjs (1)

1-1: Verify ESLint rule suppression adequacy.

Removed the suppression for @typescript-eslint/no-unsafe-call; ensure that invoking require('@tcd-devkit/prettier-config') does not trigger lint errors under your updated ESLint rules. Run your lint suite to confirm.

commitlint.config.js (1)

1-1: Approve JSDoc type annotation for configuration.

The single-line JSDoc comment @type {import('@commitlint/types').UserConfig} correctly types the commitlint config now that @commitlint/types is added. This enhances IDE support and validation for your config object.

package.json (1)

27-27: Approve addition of @commitlint/types devDependency.

Pinning @commitlint/types to the same version as @commitlint/cli (19.8.1) aligns with your config change and ensures type-safe JSDoc imports. Dependencies remain alphabetically ordered.

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

27-27: Approve inclusion of TypeScript file extensions.

Adding ts and tsx to the ESLint files pattern now ensures TypeScript files are linted under the base config, keeping it aligned with related configs in the monorepo.

packages/eslint/eslint-config-import/src/import.linter.ts (1)

12-12: Approve inclusion of TypeScript file extensions.

Adding ts and tsx to the import config’s files array extends lint coverage to TypeScript sources, aligning with the overall patch for ESLint configs.

.changeset/solid-lands-tickle.md (1)

1-7: LGTM! Well-documented changeset.

The changeset properly documents the addition of TypeScript file extensions to ESLint configurations. The format follows changeset conventions correctly.

.changeset/khaki-pigs-wink.md (1)

1-6: LGTM! Proper changeset documentation.

The changeset correctly documents the Node environment configuration update with appropriate formatting and clear description.

packages/eslint-presets/eslint-preset-node/package.json (1)

62-63:

✅ Verification successful

Verify the globals package version for currency and security.

The addition of the globals dependency supports the Node environment configuration. Please ensure version 16.2.0 is current and free from security vulnerabilities.


🌐 Web query:

What is the latest version of the globals npm package and are there any known security vulnerabilities in version 16.2.0?

💡 Result:

Latest Version of the globals npm Package

The latest version of the globals npm package, as of May 25, 2025, is 16.2.0. This version was published 7 days ago[1].

Security Vulnerabilities in globals@16.2.0

At this time, there are no known or publicly reported security vulnerabilities affecting version 16.2.0 of the globals package. Searches for security advisories, CVEs, and vulnerability disclosures for this version of the globals package do not reveal any issues[1].

While it is always good practice to run regular security audits on your dependencies using tools like npm audit, there is no indication of risk or ongoing vulnerabilities for globals@16.2.0 according to current public sources[9].

Summary Table

Package Name Latest Version Known Vulnerabilities in 16.2.0
globals 16.2.0 None reported

Additional Recommendations

  • Continue to monitor official sources and use npm audit to catch any newly reported issues[9].
  • Always review the release notes of dependencies after upgrades for any potential breaking changes or newly disclosed risks.

In summary: globals@16.2.0 is the latest version and is not known to have any security vulnerabilities as of June 1, 2025[1][9].

Citations:


globals@16.2.0 is up to date and secure

Version 16.2.0 of the globals package is the latest release (published May 25, 2025) and has no known or publicly reported security vulnerabilities. No further action is needed.

.changeset/salty-pianos-write.md (1)

1-6: LGTM! Standard changeset format.

The changeset follows proper conventions and accurately documents the addition of the max-warnings argument for ESLint.

.changeset/cruel-breads-read.md (1)

1-6: LGTM! Proper changeset documentation.

The changeset correctly documents the ESLint error fixes for the eslint-config-ts package.

packages/scripts/README.md (2)

67-67: Clear and accurate documentation.

The new --max-warnings option is well-documented with a clear description of its purpose and default value.


72-72: Good example usage.

The example effectively demonstrates how to use the new option in combination with other flags.

packages/scripts/src/commands/lint.command.ts (2)

8-8: Well-integrated import.

The import is properly placed in alphabetical order with other option imports.


35-35: Correct option registration.

The maxWarningsOption is properly added to the lint command using the established Commander.js pattern.

packages/scripts/src/constants/option.constants.ts (1)

57-60: LGTM! Clean implementation following established patterns.

The new maxWarningsOption correctly follows the same pattern as other options in the file. The string default value '0' is appropriate for CLI arguments, which are typically handled as strings before being parsed.

packages/eslint-presets/eslint-preset-node/src/node-preset.linter.ts (2)

4-4: Good addition of Node.js globals support.

The import of the globals package is appropriate for configuring Node.js environment variables in the ESLint preset.


18-22: Excellent implementation of Node.js globals configuration.

The addition of languageOptions.globals with globals.node properly configures the Node.js environment for ESLint. This follows ESLint flat config best practices and ensures Node.js built-in globals (like process, Buffer, etc.) are recognized during linting.

@TheCodeDestroyer TheCodeDestroyer merged commit c15740a into main Jun 1, 2025
3 checks passed
@TheCodeDestroyer TheCodeDestroyer deleted the fix-some-issues branch June 1, 2025 09: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