Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

vue-eslint-parser and typescript-eslint problems #104

Open
@yoyo930021

Description

@yoyo930021

Reason:typescript-eslint/typescript-eslint#2865 (comment)

Hi, I'm usingvue-eslint-parser andtypescript-eslint in company project.
At the same time, I also help to contributetypescript-eslint project for fixing vue problems.

This problems are only happens when using type rules intypescript-eslint.
You need to addparserOptions.project in project to enable it.
https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md

There are two main issues:

performance issue

issues:#65,typescript-eslint/typescript-eslint#1180

The problem is thatvue-eslint-parser is designed with the AST not type information.
Thevue-eslint-parser will split code frame from template to@typescript-eslint/parser.
typescript-eslint/typescript-eslint#1180 (comment)
Typescript program need to parse full project for generate type information.
When parsing code frame, typescript program will reparse file AST and rebuild type information in project.
Thevue-eslint-parser will pass more code frames and same file path in single Vue SFC.

Possible solutions:

  1. IgnoreparserOptions.project to close get type information when pass code frame.
  2. Try to use ESLint processors, likeSvelte.
    Ref:Add fragment options to lint code fragment for Vue SFC performance typescript-eslint/typescript-eslint#1180 (comment)

[no-unsafe-*] rules

issues:typescript-eslint/typescript-eslint#2865

Strictly speaking, it isn't a problem with this project.
The typescript program can't parse Vue SFC file directly.

You may think it's strange, but why is it working now?
Because@typescript-eslint/parser will prioritize the content delivered from ESLint.
Typescript program will update by ESLint content not same as typescript program read.
But this problem is happens when ESLint not send file content and content from typescript program reading.
Example:

// App.vueimportHelloWorldfrom'./components/HelloWorld.vue'// <- typescript program can't parse it. because it will read including template and style.exportdefault{name:'App',components:{    HelloWorld// <- so type information is `any`}}

This problem will also have in<script setup> RFC.

Possible solutions:

  1. OverrideHelloWorld.vue content.
  2. Mock aHelloWorld.vue.ts file.

Maybe we need a common project for hacking typescript program.

Thanks for watching. Have a good day!

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp