* For a TypeScript AST node and each of its child nodes, check whether the node is a class * element which implements an abstract member but does not have the `override` keyword.
(node: ts.Node, ctx: WalkContext, program: ts.Program)
| 36 | * element which implements an abstract member but does not have the `override` keyword. |
| 37 | */ |
| 38 | function visitNode(node: ts.Node, ctx: WalkContext, program: ts.Program) { |
| 39 | // If a class element implements an abstract member but does not have the |
| 40 | // `override` keyword, create a lint failure. |
| 41 | if ( |
| 42 | ts.isClassElement(node) && |
| 43 | !hasOverrideModifier(node) && |
| 44 | matchesParentAbstractElement(node, program) |
| 45 | ) { |
| 46 | ctx.addFailureAtNode( |
| 47 | node, |
| 48 | FAILURE_MESSAGE, |
| 49 | Replacement.appendText(node.getStart(), `override `), |
| 50 | ); |
| 51 | } |
| 52 | |
| 53 | ts.forEachChild(node, (n) => visitNode(n, ctx, program)); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Checks if the specified class element matches a parent abstract class element. i.e. |
no test coverage detected
searching dependent graphs…