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

[no-empty-function] disable for decorators #2278

Closed
vegerot opened this issue Jul 6, 2020 · 3 comments · Fixed by #2295
Closed

[no-empty-function] disable for decorators #2278

vegerot opened this issue Jul 6, 2020 · 3 comments · Fixed by #2295
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@vegerot
Copy link
Contributor

vegerot commented Jul 6, 2020

Repro

@Emit('click')
private onClick() {}

Proposed option:

{
  "rules": {
    "@typescript-eslint/no-empty-function": ["error", {decorators: 'off'}]
  }
}
@Emit('click')
private onClick() {}

Expected Result
No error
Actual Result
Error
Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 3.5.0
@typescript-eslint/parser 3.5.0
@vegerot vegerot added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Jul 6, 2020
@bradzacher bradzacher added enhancement: plugin rule option New rule option for an existing eslint-plugin rule and removed triage Waiting for team members to take a look labels Jul 6, 2020
@bradzacher
Copy link
Member

happy to accept a PR if you want to add a new option "decoratedFunctions" to the allow option.

@vegerot
Copy link
Contributor Author

vegerot commented Jul 7, 2020

I'd love to. Do you have any advice for getting started?

@bradzacher
Copy link
Member

The rule source is here.

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/rules/no-empty-function.ts

It is built on top of the base eslint rule which you can find in their repo.

You can use https://astexplorer.net to inspect the ast and figure out how to build the rule.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants