Skip to content

Rule Proposal: vue/no-arrow-for-properties #846

Open
@nathanchase

Description

@nathanchase

Please describe what the rule should do:
The rule would disallow the use of fat arrow functions data: () => {} inside components. Any component's options that are functions (e.g. data, methods, computed, head and other internal options) would have to use either data() {} or data: function() {}.

What category should the rule belong to?

  • Warns about a potential error

Code examples that this rule should warn about:

BAD

data: () => {
    return {
      value: this.getValue() // 'this' is not accessible
    };
},

GOOD

data() {
    return {
      value: this.getValue() // Now 'this' is accessible
    };
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions