-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Change Request: Remove parser plugins from flat config #16930
Copy link
Copy link
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussioncoreRelates to ESLint's core APIs and featuresRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLint
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussioncoreRelates to ESLint's core APIs and featuresRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLint
Type
Projects
Status
Complete
ESLint version
HEAD
What problem do you want to solve?
While working on the Language Plugins RFC I discovered a bit of complexity related to
languageOptions. Right now,languageOptionsis managed and resolved inside of the ESLint core, allowing us to do stuff like this:In order to make this work, the core resolves
@/espreeto theplugin.parsers.espreekey. This works well now, but once we movelanguageOptionsresolution out of the core, we'd need to mimick this behavior or else remove it.What do you think is the correct solution?
I believe the correct solution is to remove the resolution of the
languageOptions.parserkey and enforce thatlanguageOptions.parseralways be an object. So we would end up with a default config looking more like this:I think that this change won't affect many users, if at all, considering the majority of ESLint users aren't using the default parser and the most popular parsers (typescript-eslint and Babel) are still distributed as individual objects rather than plugins. For people using Espree, this change will be completely transparent.
Complexities of supporting resolution
The other option, which I don't think is a good idea, is to allow languages to specify keys to be resolved from plugins. So for the
@eslint/jspackage, we'd need a way to say "theparserkey should be resolved to the pluginparserskey with the given name. While we could do that, that would also open the door for any language plugin to specify its own key inside of an ESLint plugin, and then we'd be at risk of naming collisions, essentially creating a global scope into which any plugin can reach.Because
parseris the only key inside oflanguageOptionsthat does this plugin resolution, it makes more sense to me to eliminate this as a special case.Participation
Additional comments
No response