- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
Expand ESLint support for TypeScript and add max-warnings CLI option #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 🦋 Changeset detectedLatest commit: 4c3c3f4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
 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 | 
| 📝 WalkthroughWalkthroughThis 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  Changes
 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
Possibly related PRs
 Poem
 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
 Scope: all 4 workspace projects This error happened while installing a direct dependency of /tmp/eslint/packages/eslint-presets/eslint-preset-node Packages found in the workspace: ✨ Finishing Touches
 🪧 TipsChatThere are 3 ways to chat with CodeRabbit: 
 SupportNeed 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)
 Other keywords and placeholders
 CodeRabbit Configuration File ( | 
There was a problem hiding this 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.,
.mjsxand.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
.mjsxand.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
maxWarningsproperty is correctly typed asstringsince 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
maxWarningsis 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
⛔ Files ignored due to path filters (1)
- pnpm-lock.yamlis 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 invokingrequire('@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 thecommitlintconfig now that@commitlint/typesis added. This enhances IDE support and validation for your config object.package.json (1)
27-27: Approve addition of@commitlint/typesdevDependency.Pinning
@commitlint/typesto 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
tsandtsxto the ESLintfilespattern 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
tsandtsxto the import config’sfilesarray 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
globalsdependency 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
globalspackage. Searches for security advisories, CVEs, and vulnerability disclosures for this version of theglobalspackage 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 forglobals@16.2.0according 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 auditto 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:
- 1: https://www.npmjs.com/package/globals
- 2: https://docs.npmjs.com/try-the-latest-stable-version-of-npm/
- 3: https://betterstack.com/community/questions/how-to-find-version-of-installed-npm-package/
- 4: https://dev.to/andy/installing-a-new-node-version-and-migrating-npm-global-packages-4no3
- 5: https://hotframeworks.com/hosting/how-to-update-npm-packages-to-their-latest-version/
- 6: https://www.acunetix.com/vulnerabilities/sca/cve-2022-21191-vulnerability-in-npm-package-global-modules-path/
- 7: https://www.cvedetails.com/version/1274233/Nodejs-Node.js-16.2.0.html
- 8: https://www.upgrad.com/blog/how-to-get-list-of-globally-installed-packages-of-npm/
- 9: https://www.dhiwise.com/blog/design-converter/how-to-improve-npm-package-security-and-avoid-risks
- 10: https://security.snyk.io/package/npm/react-dom/16.2.0
globals@16.2.0 is up to date and secure
Version 16.2.0 of the
globalspackage 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-warningsoption 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
maxWarningsOptioncorrectly 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
globalspackage 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.globalswithglobals.nodeproperly configures the Node.js environment for ESLint. This follows ESLint flat config best practices and ensures Node.js built-in globals (likeprocess,Buffer, etc.) are recognized during linting.
Summary by CodeRabbit
New Features
--max-warningsoption to the lint command, allowing users to set a maximum number of warnings before the process fails..tsand.tsxfiles.Bug Fixes
Documentation
--max-warningslint option.Chores