Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ban decorator functions #17

Open
chriswhite199 opened this issue Feb 24, 2021 · 3 comments
Open

Ban decorator functions #17

chriswhite199 opened this issue Feb 24, 2021 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@chriswhite199
Copy link

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"
          }
        ]
@DanBoSlice
Copy link

Any updates?

@remithomas remithomas added the enhancement New feature or request label May 10, 2021
@remithomas
Copy link
Owner

Hello,
@chriswhite199 this is a good idea. Will try to come back with a PR soon.
thanks

@remithomas
Copy link
Owner

Sorry for the long delay, actually we need to move the codebase to typescript in order to address this feature before.

@remithomas remithomas added the help wanted Extra attention is needed label Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants