JamieMason / eslint-plugin-prefer-arrow-functions

Auto-fix plain Functions into Arrow Functions, in all cases where conversion would result in the same behaviour
https://www.npmjs.com/package/eslint-plugin-prefer-arrow-functions
MIT License
43 stars 11 forks source link

Functions as Object properties #15

Open Tzahile opened 2 years ago

Tzahile commented 2 years ago

Description

Create a .js file in an environment with eslint and eslint-plugin-prefer-arrow-functions create an object with a function as a property:

const myObj = {
  dummyMethod(){
    // ...
  }
}

The plugin will mark (warn / error) the function.

In some cases, we'd like to use functions as object properties. In my case, I use Vuejs 2, and each component has this error for the data property:

export default {
  data(){
    return {...}
  }
}

Suggested Solution

It could be great if there's an option to add a rule to the rule-section for prop functions