Skip to content

vue/define-macros-order does not support multiple defineModel macro calls #2371

Closed
@hendrikheil

Description

@hendrikheil

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: v8.56.0
  • eslint-plugin-vue version: v9.20.1
  • Vue version: v3.4.15
  • Node version: v18.18.2
  • Operating System: MacOS 14.1

Please show your full configuration:

module.exports = {
  extends: [
    'plugin:vue/base',
  ],

  parserOptions: {
    parser: {
      js: 'espree',
      jsx: 'espree',

      ts: '@typescript-eslint/parser',
      tsx: '@typescript-eslint/parser',
    },
  },
  rules: {
    "vue/define-macros-order": ["error", {
      order: ['defineOptions', 'defineModel', 'defineProps', 'defineEmits', 'defineSlots'],
      defineExposeLast: true,
    }]
  },
};

What did you do?
I defined two defineModel calls as is allowed in vue 3.4.

What did you expect to happen?
Both defineModel calls are treated the first macro "group" and they are sorted alphabetically.

What actually happened?

npm run lint:ts


> vue-eslint-multiple-define-model@1.0.0 lint:ts
> eslint --ext .vue .


/Users/hendrik/projects/stafftastic/vue-eslint-multiple-define-model/reproduction.vue
  9:1  error  defineModel should be the first statement in `<script setup>` (after any potential import statements or type definitions)  vue/define-macros-order

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

Repository to reproduce this issue

https://github.com/hendrikheil/vue-eslint-multiple-define-model

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions