Skip to content

Yarn v2 (pnp) compatibility with custom parser #64

Closed
@AlexandreBonaventure

Description

@AlexandreBonaventure

Hello,
when using vue-eslint-parser + custom parser (with typescript here) in the context of yarn v2 we get the following error:

Parsing error: A package is trying to access another package without the second one being listed as a dependency of the first one

Required package: @typescript-eslint/parser (via "@typescript-eslint/parser")
Required by: vue-eslint-parser

This comes from:
https://github.com/mysticatea/vue-eslint-parser/blob/ea156df3872da715d580ea1c9c67a2c6e340b9ee/src/script/index.ts#L570

Yarn v2 is now enforcing require to be strict (no extraneous deps). In this case, I think the solution could be to make the parserOptions.parser to be the parser itself instead of a string. This way we can actually outsource the require call in the userland (here eslint-config-typescript: https://github.com/vuejs/eslint-config-typescript/blob/master/index.js#L8). It is up to the consuming library then to define its own dependencies.
This is an open discussion, I'm no expert here, but I'll be willing to PR if we agree on a solution.

ref: vuejs/vue-cli#5135

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions