eslint-plugin-ban
eslint-plugin-ban copied to clipboard
Ban decorator functions
Would it be possible to add banning for decorators? (or maybe i'm missing it, but using either decorator name or @name in a rule doesn't seem to currently catch instances where that decorator is used).
Example use case:
I want to ban the use of @Expose
from the class-transformer library:
export class MyClass {
@Expose({ name:'my_str_field' })
myStrField: string
}
I have tried both of the following rule configs (not that the second one should work as the function is not named with a @ prefix, that's just syntax sugar), but neither seem to work:
"ban/ban": [
"error",
{
"name": [ "Expose" ],
"message": "Class-transformer camelCase <-> snake_case is handled by KeyCaseInterceptor"
},
{
"name": [ "@Expose" ],
"message": "Class-transformer camelCase <-> snake_case is handled by KeyCaseInterceptor"
}
]
Any updates?
Hello, @chriswhite199 this is a good idea. Will try to come back with a PR soon. thanks
Sorry for the long delay, actually we need to move the codebase to typescript in order to address this feature before.