From 08ac17ecaab5c0ca581e25edf9835b470b12c1d6 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 5 Jan 2025 18:01:55 +0800 Subject: [PATCH] fix(tslint): enhance applyWithWalker to track failures --- packages/tslint/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/tslint/index.ts b/packages/tslint/index.ts index fc2d1b8..056e249 100644 --- a/packages/tslint/index.ts +++ b/packages/tslint/index.ts @@ -81,6 +81,14 @@ export function convertRule | TSLintRule>( walkFn(ctx, programOrChecker); return ctx.failures; }; + const applyWithWalker = rule.applyWithWalker.bind(rule); + rule.applyWithWalker = function (walker) { + const failures = applyWithWalker(walker); + for (const failure of failures) { + onAddFailure(failure); + } + return failures; + } if ('applyWithProgram' in rule) { rule.applyWithProgram(sourceFile, languageService.getProgram()!); } else {