This rule raises an issue when a class decorated with @Pipe does not implement the PipeTransform interface.
Angular Pipes are expected to implement the PipeTransform interface to ensure type safety and follow Angular conventions.
The PipeTransform interface defines the contract that all pipes must follow, requiring a transform method with proper
typing. Without this interface:
transform method correctly Implementing PipeTransform makes your code more robust and follows Angular’s recommended patterns.
Without implementing PipeTransform, pipes may have incorrect method signatures leading to runtime errors. The code also becomes less
maintainable and loses TypeScript’s type checking benefits.
Add implements PipeTransform to your pipe class and import the interface from @angular/core.
@Pipe({ name: 'test' })
class Test { // Noncompliant
transform(value: string) {}
}
import { PipeTransform } from '@angular/core';
@Pipe({ name: 'test' })
class Test implements PipeTransform {
transform(value: string) {}
}