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

Enhancement: Have RuleCreator rules throw an error if used with an incompatible parser #8150

Closed
Labels
breaking changeThis change will require a new major version to be releasedenhancementNew feature or requesttriageWaiting for team members to take a look
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

utils

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

#6814 ->#8146 and the discussion in#8149 are making me think that we really,really don't want users to use a parser that isn't at the very least running@typescript-eslint/parser internally. This is for two reasons:

  • typescript-eslint rules need to be able to assume the TSESTree shape for the AST
  • Type-checked rules need our generated type information

#8146 tries enforcing the exact parser being used - but that won't work for all users because some languages require wrapping parsing with their own (https://github.com/typescript-eslint/typescript-eslint/pull/8146/files#r1437273011). So checking the exact parser isn't likely feasible.

Instead, what if we augmentRuleCreator so that rules verify some basic assumptions about the parsed AST / context beforecreate(context)?

  • It can check the root nodes to make sure there's the expected TSESTreeProgram AST node
    • I haven't verified that this is true for other parsers - but likely an equivalent will hold up
  • It can it can run the normal checks fromgetParserServices on theesTreeNodeToTSNodeMap andtsNodeToESTreeNodeMap node maps existing
  • If the rule has type checking, it can run the normal check fromgetParserServices on theprogram existing if!allowWithoutFullTypeInformation

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis change will require a new major version to be releasedenhancementNew feature or requesttriageWaiting for team members to take a look

    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