getify / eslint-plugin-proper-arrows

ESLint rules to ensure proper arrow function definitions
MIT License
308 stars 14 forks source link

Add "location" rule to forbid use of arrow functions in certain places #12

Closed getify closed 5 years ago

getify commented 5 years ago

This rule disallows arrow functions in various locations (of course each is configurable):

merlindorin commented 5 years ago

I don't understand why using arrow function in top/global scope or as export is an issue. For me, the main issue is using this in arrow function in these case and more exactly a top-level this.

For example, I can export an arrow function like that (dumb functions xD) and I don't see any issue:

export const
  error = (msg) => console.error(msg),
  warn = (msg) => console.warn(msg),
  info = (msg) => console.info(msg);

export default (msg) => console.log(msg);

Another example, One of my usage of arrow function is an export with simple and dumb arrow function for mapping data.


For object properties... I can understand for literal object and I think you speak about that.