Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enhancement: Support CodePath rule listener methods #6993

Closed
@NotWoods

Description

@NotWoods

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

Rules created using createRule currently don't have TypeScript support for the Code Path Analysis events. This would be great to add since they still work fine, its just that TypeScript complains.

I'd like to be able to use onCodePathStart, onCodePathEnd, onCodePathSegmentStart, onCodePathSegmentEnd, and onCodePathSegmentLoop as well as use an interface for CodePath and CodePathSegment,

Fail

N/A

Pass

createRule({
  meta: { ... },
  defaultOptions: [],
  create(context) {
    return {
      /**
       * @param {import('eslint').Rule.CodePath} codePath
       * @param {import('@typescript-eslint/utils').TSESTree.Node} node
       */
      onCodePathStart(codePath, node) {
        const isEffect = ASTUtils.isFunction(node) && isUseEffectCall(node.parent);
        functionInfoStack.push({ codePath, node, isEffect, listeners: [] });
      }
    }
  }
})

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requesthelp wantedExtra attention is neededpackage: utilsIssues related to the @typescript-eslint/utils package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions