sindresorhus/eslint-plugin-unicorn
View on GitHubRule proposal: Consistent decorator position for exports
Open
#2,038 opened on Feb 3, 2023
help wantednew rule
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