Skip to content

chore(no-sync): remove @typescript-eslint/utils #449

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

risantos
Copy link

Description

  • Remove @typescript-eslint/utils, which has typescript as a peer dependency.
    Update the getParserServices function to handle parser services directly without relying on the removed utility.

Related issues

  • Warning received while installing eslint-plugin-n on JS projects without typescript:

    warning "eslint-plugin-n > @typescript-eslint/[email protected]" has unmet peer dependency "typescript@>=4.8.4 <5.9.0".
    warning "eslint-plugin-n > [email protected]" has unmet peer dependency "typescript@>=4.0.0".
    warning "eslint-plugin-n > @typescript-eslint/utils > @typescript-eslint/[email protected]" has unmet peer dependency "typescript@>=4.8.4 <5.9.0".
    warning "eslint-plugin-n > @typescript-eslint/utils > @typescript-eslint/typescript-estree > @typescript-eslint/[email protected]" has unmet peer dependency "typescript@>=4.8.4 <5.9.0".
    warning "eslint-plugin-n > @typescript-eslint/utils > @typescript-eslint/typescript-estree > @typescript-eslint/[email protected]" has unmet peer dependency "typescript@>=4.8.4 <5.9.0".
    warning "eslint-plugin-n > @typescript-eslint/utils > @typescript-eslint/typescript-estree > [email protected]" has unmet peer dependency "typescript@>=4.8.4".

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the @typescript-eslint/utils dependency and inlines its parser services logic.

  • Removed @typescript-eslint/utils from package.json.
  • Reimplemented getParserServices in lib/util/get-parser-services.js with custom error handling and parser detection.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
package.json dropped @typescript-eslint/utils dependency
lib/util/get-parser-services.js added inline parserServices logic, error messages, and a flag for type-info requirements
Comments suppressed due to low confidence (1)

lib/util/get-parser-services.js:58

  • This error branch is newly introduced but lacks corresponding tests. Add unit tests to cover the scenario where parserServices.program is null and allowWithoutFullTypeInformation is false to ensure throwError is invoked as expected.
    if (parserServices.program == null && !allowWithoutFullTypeInformation) {

Copy link

@scagood scagood left a comment

Choose a reason for hiding this comment

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

Generally love this change 💜

Thank you

// Not using tseslint parser?
module.exports = function getParserServices(
context,
allowWithoutFullTypeInformation = false
Copy link

Choose a reason for hiding this comment

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

I think we should just assume this is always false, and not give the options to change this here.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, updated!
Tried improving the JSDoc, too.

@MichaelDeBoey
Copy link
Member

CC/ @JoshuaKGoldberg

@risantos risantos force-pushed the chore/no-sync/remove-typescript-eslint-utils branch from 5b3c683 to e67e523 Compare June 26, 2025 02:14
- Removes the dependency on `typescript`, a peer dependency of `@typescript-eslint/utils`
@risantos risantos force-pushed the chore/no-sync/remove-typescript-eslint-utils branch from e67e523 to d9b69bb Compare June 26, 2025 02:24
@risantos risantos requested a review from scagood June 26, 2025 02:37
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.

3 participants