Closed
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
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