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

[Public API request] make parseForESLint accept ts.sourceFile #774

Closed
Assignees
JoshuaKGoldberg
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: parserIssues related to @typescript-eslint/parserpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree
@Quramy

Description

@Quramy

I want a public API for TypeScript language service plugin ( this is related to#254 (comment) ).

API proposal

Signature

parseForESLintFromSourceFile(sourceFile:ts.sourceFile,options?:ParserOptions|null,):ParseForESLintResult

Expected behavior

This new function should works almost the same asparseForESLint. However, the following points are different:

  • result.ast should be converted by@typescript-eslint/typescript-estree/src/ast-converter directly.
  • result.services.program should be undefined ( I want to skip to callcreateProgram)

Motivation

I develop a TypeScript language service plugin to integrate tsserver and ESLint,https://github.com/Quramy/typescript-eslint-language-service.

In tsserver, ts.LanguageService does:

  • tokenize source text and create an AST node. And the parsing is so fast because of ts.IncrementalParser.
  • provide ts.Program ( So ts-estree don't need call createProgram )

Of course, I can provide a language service plugin using only public@typescript-eslint/parser APIs. But they accept only string text. So source code's text would be tokenized twice if using these public APIs. It's so silly.

Now I use some internal APIs ( seehttps://github.com/Quramy/typescript-eslint-language-service/blob/v1.2.3/src/ast-converter.ts#L187 ) for the above performance reason. But depending on them is too fragile.

Please consider it.

Quramy

Metadata

Metadata

Labels

accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: parserIssues related to @typescript-eslint/parserpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

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