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

@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
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.

Awesome, thanks.

@JoshuaKGoldberg
Copy link

👋 @MichaelDeBoey thanks for the ping but I'm a bit lost, is there something I should be doing here?

@MichaelDeBoey
Copy link
Member

@JoshuaKGoldberg I figured since you're the maintainer of the original package, you could maybe give some more insights into if this replacement is done properly and maybe we forgot some edge cases here that are important and that's why you guys have TS as a dependency.
Or if not, maybe we could thrive the original package to exclude TS from its dependencies.

@JoshuaKGoldberg
Copy link

Ah gotcha, thanks! Yeah I think you're on the right track. We've been experimenting with splitting up @typescript-eslint/utils: e.g. typescript-eslint/typescript-eslint#10383. In the meantime this is pretty much the right strategy.

If you don't think you'd end up wanting to use the standalone @typescript-eslint/rule-creator package, we could take an issue asking for a standalone getParserServices.

@MichaelDeBoey
Copy link
Member

@JoshuaKGoldberg I think it would be awesome if we could just keep using the original code without all the problems mentioned here in this PR.
Forking it in this package would mean we would have 2 places where possible changes/bugfixes need to happen, which won't be beneficial of everybody's time imo.

CC/ @eslint-community/eslint-plugin-node

@ota-meshi
Copy link
Member

ota-meshi commented Jun 26, 2025

I think ts-declaration-location also has typescript in its peer dependencies. I don't think this PR alone will completely solve the problem, am I right?

Sorry. I realized later that there was a #451.

@aladdin-add
Copy link

so what's the next step here?

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.

6 participants