Skip to content

--fix fails on custom options in order-in-components #523

@bbugh

Description

@bbugh

Tell us about your environment

  • ESLint Version: v4.19.1
  • eslint-plugin-vue Version: v4.5.0
  • Node Version: v8.9.1

Please show your full configuration:

module.exports = {
  "parserOptions": {
    "parser": "babel-eslint",
    "ecmaVersion": 6,
    "sourceType": "module"
  },
  'env': {
    "browser": true,
    "es6": true,
    "jest": true,
    "jquery": true,
    "node": true,
  },
  'extends': [
    'eslint:recommended',
    'plugin:vue/recommended',
  ],
  'rules': {
    "vue/order-in-components": ["error", {
      "order": [
        "el",
        "name",
        "parent",
        "functional",
        "inheritAttrs",
        ["delimiters", "comments"],
        ["components", "directives", "filters"],
        "extends",
        "mixins",
        "model",
        ["props", "propsData"],
        "data",
        "validations",  // new order-in-components
        "computed",
        "watch",
        "LIFECYCLE_HOOKS",
        "methods",
        ["template", "render"],
        "apollo",  // new order-in-components
        "renderError"
      ]
    }]
  }
}

What did you do? Please include the actual source code causing the issue.

When using the custom configuration, I would expect the following listing to be automatically organized, but it's not. All of the properties are organized, but my custom properties are ignored by --fix.

{
  validations: { ... },
  apollo: { ... }
  mixins: [],
  methods: { ... },
  data () { ... },
  props: { ... },
}

What did you expect to happen?

The file should be automatically organized into this listing:

{
  mixins: [],
  props: { ... },
  data () { ... },
  validations: { ... },
  methods: { ... },
  apollo: { ... }
}

What actually happened? Please include the actual, raw output from ESLint.

When running without --fix, it appears like this:

  43:3  error  The "mixins" property should be above the "validations" property on line 32  vue/order-in-components
  44:3  error  The "methods" property should be above the "apollo" property on line 42      vue/order-in-components
  45:3  error  The "data" property should be above the "validations" property on line 32    vue/order-in-components
  57:3  error  The "props" property should be above the "data" property on line 45          vue/order-in-components
  63:3  error  The "watch" property should be above the "methods" property on line 44       vue/order-in-components
  68:3  error  The "mounted" property should be above the "methods" property on line 44     vue/order-in-components

When running with --fix, it does not fix the properties.

  52:3  error  The "mixins" property should be above the "validations" property on line 32  vue/order-in-components
  53:3  error  The "props" property should be above the "validations" property on line 32   vue/order-in-components
  59:3  error  The "data" property should be above the "validations" property on line 32    vue/order-in-components

The file ends up looking like this, which is not the expected order at all:

{
  validations: { ... },
  methods: { ... },
  apollo: { ... }
  mixins: [],
  props: { ... },
  data () { ... },
}

This issue seems to be related to this pull request: #381

Metadata

Metadata

Assignees

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

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy