eslint-plugin-prefer-arrow-functions icon indicating copy to clipboard operation
eslint-plugin-prefer-arrow-functions copied to clipboard

Functions as Object properties

Open Tzahile opened this issue 3 years ago • 1 comments

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

Tzahile avatar Nov 17 '21 13:11 Tzahile

Any news about this important feature ?

throrin19 avatar Sep 16 '24 12:09 throrin19

Released in 3.6.0

JamieMason avatar Jan 09 '25 22:01 JamieMason