-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[prefer-stateless-function] should check if component has ES7 decorator #501
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
Comments
Decorators are not ES7, and part of the proposal absolutely might be that they work with function declarations. They also certainly work with concise object methods as well. |
Related #491 (comment) |
@ljharb thats great and all, but the current proposal is with classes, and until that has been agreed upon and or implemented this is still a false positive and a bug. see https://github.com/wycats/javascript-decorators, first line in the summery for decorators.
|
@thewillhuang "and properties". https://github.com/wycats/javascript-decorators#object-literal-method-declaration - it is NOT a bug, it is an essential part of the proposal. |
@ljharb ah i see, missed that part completely |
Decorators remain stage 2, and have changed 3-4 times since this was filed. However, we do support them via the TS eslint parser. Additionally, the likely state of the proposal will exclude functions, so we should use the presence of a class decorator as an indication that the component should not be a stateless function. |
fixed in #1086 |
ES7 decorators only work with classes and not with functions. If a decorator is present [react/prefer-stateless-function] should not be recommended.
The text was updated successfully, but these errors were encountered: