Skip to content

Types defined in custom global declaration files not inferred in vue files #99

@ozguruysal

Description

@ozguruysal

Hi, I'm not sure if this issue belongs to this repo or eslint-plugin-vue, but it does seem like a parsing issue.

Problem

Using VSCode, when we define global types in declaration files, those types are available in .ts files, however in *.vue files, eslint complains about them showing an error that says: 'XXX' is not defined.eslint(no-undef).

I have created a reproduction repo (branch) here.

  1. Clone the repo, make sure you're in eslint-no-undef branch and install dependencies with yarn or npm install
  2. Open project in VSCode.
  3. Check files /src/types/config.d.ts, /src/main.ts and /src/App.vue. As you can see, interface IFoo is inferred in main.ts, however in App.vue, eslint shows an error

image

  1. Downgrade typescript-eslint/parser to version 3 (example 3.10.1), reload or restart VSCode, now it works without any issues.

Expected

Global types should be inferred in .vue files just as in .ts files using typescript-eslint/parser v4+.

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