#eslint-plugin-prefer-arrow yes or no

3 messages · Page 1 of 1 (latest)

barren grove
#

I am maintaining an nx repo with a number of angular applications in it. One of the tasks was to make the ESLinting more strict, so I am investigating what rules to incorporate. One of the rules I ran into, and a had discussions about with my co-workers is the eslint-plugin-prefer-arrow rule, which prefers const foo = () => {} over function foo() {}. Apparently, on this matter, the Angular team defaults to Google's TypeScript style guide, which prefers function declarations.

Can someone give some insight, and help me make a choice here?

exotic jackal
#

Id rather arrows functions. Other I love is curly with multi-or-nest

pliant panther
#

Defining overloads is easier with functions. Also auto-documentation tools will typically only recognize a traditional function instead of describing it as a constant.