Skip to content

Enhancement(utils): Update types ESLint v9 Linter class (flat config) #8968

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

Closed
4 tasks done
JoshuaKGoldberg opened this issue Apr 22, 2024 · 6 comments
Closed
4 tasks done
Assignees
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
Milestone

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Apr 22, 2024

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

utils

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

Splitting out of #8211 / #8211 (comment):

API Users (mainly those that use utils/ts-eslint)

  • Switch Linter to flat config by default

We'd need to look more into the difference between the before and after here as to whether it actually makes a difference for consumers of our package. If it doesn't then all good we can tick and move on! If it does then we need to figure out a path forward here with the types. EG how can we support types that depend on the version of eslint the user has installed?

In summary: we need to update the TSESLint.Linter class within @typescript-eslint/utils/ts-eslint to have the same default behavior as the core ESLint.Linter class.

Additional Info

This isn't a good first issue. Someone who's already familiar with the classes & utilities in question should tackle this.

💖

@JoshuaKGoldberg JoshuaKGoldberg added enhancement New feature or request breaking change This change will require a new major version to be released accepting prs Go ahead, send a pull request that resolves this issue labels Apr 22, 2024
@JoshuaKGoldberg JoshuaKGoldberg added this to the 8.0.0 milestone Apr 22, 2024
@JoshuaKGoldberg JoshuaKGoldberg mentioned this issue Apr 22, 2024
42 tasks
@JoshuaKGoldberg
Copy link
Member Author

Hmm, looking at eslint/eslint#17851, I think we get this for free by virtue of our Linter being a re-export of the ESLint class?

class Linter extends (ESLintLinter as typeof LinterBase) {}
export { Linter };

cc @bradzacher - I think we can mark this as already done?

@JoshuaKGoldberg JoshuaKGoldberg added triage Waiting for team members to take a look and removed breaking change This change will require a new major version to be released accepting prs Go ahead, send a pull request that resolves this issue labels Apr 22, 2024
@bradzacher
Copy link
Member

Specifically it's the types we need to correct here. Make sure that the types accept a flat config.

@JoshuaKGoldberg
Copy link
Member Author

Right - and they do, I think?

verify(
textOrSourceCode: SourceCode | string,
config: Linter.ConfigType,
filenameOrOptions?: Linter.VerifyOptions | string,
): Linter.LintMessage[];

export type ConfigType = ClassicConfig.Config | FlatConfig.ConfigArray;

@bradzacher
Copy link
Member

https://eslint.org/docs/latest/use/migrate-to-9.0.0#-linter-now-expects-flat-config-format

If you still need the v8.x Linter functionality, pass configType: "eslintrc" to the constructor

We don't support that flag in the constructor options I think.

We might want to generically parameterise it as well? Maybe? Or maybe we don't care and just the constructor option is fine.

@JoshuaKGoldberg
Copy link
Member Author

Yeah I would really like to not have to parameterize it. 😬 Quite a lot of work for very little gain. If someone files an issue I think we can always see if they have a use case that really benefits from it.

@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Apr 26, 2024
@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels Apr 26, 2024
@JoshuaKGoldberg JoshuaKGoldberg changed the title Enhancement(utils): Switch Linter to flat config by default Enhancement(utils): Update types ESLint v9 Linter class (flat config) Apr 26, 2024
@JoshuaKGoldberg
Copy link
Member Author

#8999 was merged into v8. ✅

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2024
@bradzacher bradzacher added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Apr 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy