Skip to content

Consider directly requiring tokenizer in base config #24

@urkle

Description

@urkle

I tried adding this to my yarn project which uses PnP and it failed with several dependency errors.

First issues is that vue-eslint-parser is configured as a devDependency instead of a dependency.

yarn error

Parsing error: vue-eslint-parser tried to access vue-eslint-parser-template-tokenizer-pug, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Moving this to the dependencies section instead of devDepeendencies fixes this error.

Then we get to the next issue, the inclusion of vue-eslint-parser-template-tokenizer-pug. After fixing the first error I receive this message.

Parsing error: vue-eslint-parser tried to access vue-eslint-parser-template-tokenizer-pug, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

This is caused because vue-eslint-parser is trying to require that package and has no dependency on it (but estlin-plugin-vue-pug does).

One way that should fix this is to not specify the string value in the options that this package created, but instead pass the tokenizer directly

Thus using this instead

const PugTokenizer = require('vue-eslint-parser-template-tokenizer-pug');
module.exports = {
    // parser: ...,
    parserOptions: {
        // other options
        templateTokenizer: { pug: PugTokenizer }
    },
    // other options
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions