sindresorhus/eslint-plugin-unicorn
Rule proposal: Consistent decorator position for exports
Fechada
#2.038 aberto em 3 de fev. de 2023
help wantednew rule
Métricas do repositório
- Stars
- (5.022 estrelas)
- Métricas de merge de PR
- (Mesclagem média 4h 30m) (26 fundiu PRs em 30d)
Description
Description
Decorators can be placed in two positions when you export a class. Would be nice with a rule to enforce either for consistency.
https://twitter.com/leobalter/status/1621242353494425602
I haven't yet made up my mind which should be the default. Lets discuss.
Either:
export default @decorator class {}
or
@decorator export default class {}
My mind is split as I kinda feel that export should always come first, since it should immediately clear what's being exported. On the other hand, placing it first will allow stacking it above (the rule may want to enforce whether this is allowed too):
@decorator
export default class {}
I'm leaning towards the latter.
Fail
TODO
Pass
TODO
Additional Info
No response