Closed dmt0 closed 2 years ago
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.
@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.
Decorators make it possible to annotate and modify classes and properties at design time.
@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.
ES7 decorators only work with classes and not with functions. If a decorator is present [react/prefer-stateless-function] should not be recommended.