fix: declare parsers as optional peer dependencies
The test shows babel-eslint-plugin is compatible with the latest of all major version of babel-eslint, so * is used.
The parser is migrated to monorepo https://github.com/babel/babel/tree/main/eslint/babel-eslint-parser
So better to not add any dependency to be compatible with both packages. Especially since there is no version restriction.
@TrySound I wonder how Babel solved the peer dependency problem when moving from Babel 6 to 7.
Which problem I don't follow? Babel-eslint bumped babel/core long time ago. https://github.com/babel/babel-eslint/blob/master/package.json#L32
@TrySound I remember there were lots of packages declaring unscoped Babel packages, e.g. babel-core, as peer dependency. I'm curious how they moved to using scoped Babel packages (@babel/core) as peer dependencies.
One way I can think of is declaring both parser as optional using peerDependenciesMeta. ~I'll update the PR.~ Updated.
There was babel-core@7-bridge package which reexported @babel/core. Probably yeah, peerDependenciesMeta can be a way to go. But it should be resolved in recommended config as well.
@TrySound Now I remember, [email protected]. I've opened an issue at Babel to request to provide the bridge version: https://github.com/babel/babel/issues/11989.
By @kaicataldo in https://github.com/babel/babel/issues/11989#issuecomment-693892947
The hard break was intentional here because we've changed how the parser works and there are significant breaking changes. I'm in favor of making things fail faster in this case so that people are aware of the changes if/when they upgrade.
I think declaring both of them as optional peer dependencies is the best way to go.