Skip to content
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

Change Request: Keep providing context.parserPath for flat eslint #16878

Closed
1 task done
DMartens opened this issue Feb 10, 2023 · 4 comments
Closed
1 task done

Change Request: Keep providing context.parserPath for flat eslint #16878

DMartens opened this issue Feb 10, 2023 · 4 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint

Comments

@DMartens
Copy link
Contributor

ESLint version

8.33.0

What problem do you want to solve?

Currently eslint provides context.parserPath to rules.
But this property which is required for rules from eslint-plugin-import is no longer available when using the flat config.
According to #13481 it should be available, as it is still in phase 2 (" Ensure context.parserPath still works in Linter for FlatConfigArray (for now)") and not in phase 5 where will be removed.
It seems that currently the linter just passes an explicit undefined for the parserPath for flat configs.

What do you think is the correct solution?

Keep passing context.parserPath until it is removed or provide an alternative.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

@DMartens DMartens added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon labels Feb 10, 2023
@DMartens DMartens changed the title Change Request: Provide Change Request: Keep providing context.parserPath for flat eslint Feb 10, 2023
@mdjermanovic
Copy link
Member

Keep passing context.parserPath

I don't think eslint can provide context.parserPath in the flat config mode, because eslint doesn't know the path. In the flat config system, eslint doesn't load parsers. Users provide parsers as objects.

or provide an alternative.

Rules can already switch to context.languageOptions.parser.

@mdjermanovic mdjermanovic removed the triage An ESLint team member will look at this issue soon label Feb 10, 2023
@DMartens
Copy link
Contributor Author

Thanks for the clarification.
Then I will file an issue at eslint-plugin-import.
The reason I filed it here is that it was intended to be still supported (see #13481) and so other plugins would also benefit from it.

@CallMeLaNN
Copy link

@DMartens you probably want to see this Feature Request Support new ESLint flat config

@DMartens
Copy link
Contributor Author

@CallMeLaNN thanks for the link but that issue is primarily about providing configs for the flat config.
This PR enables to use the the parser of the current linted file without the workaround you posted about manually setting the parsers.

@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Aug 10, 2023
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint
Projects
Archived in project
Development

No branches or pull requests

3 participants