Skip to content

False positives from one-component-per-file #1411

Closed
@markrian

Description

@markrian

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: 7.17 (also tested with 6.8)
  • eslint-plugin-vue version: 7.4.1
  • Node version: 12.18.4
  • Operating System: Ubuntu 20.04

Please show your full configuration:

module.exports = {
  extends: ['plugin:vue/recommended'],
};

What did you do?

const foo = { mixin() {} };

Vue.component({
  mixins: [foo.mixin({})],
});

and equally:

<script>
const foo = { mixin() {} };

export default {
  mixins: [foo.mixin({})],
};
</script>

What did you expect to happen?
There should be no reported violations of one-component-per-file.

What actually happened?

yarn run v1.22.5
$ eslint test.js

/home/markrian/dev/eslint-plugin-vue-bug/test.js
  4:15  warning  There is more than one component in this file  vue/one-component-per-file
  5:22  warning  There is more than one component in this file  vue/one-component-per-file

✖ 2 problems (0 errors, 2 warnings)

Done in 0.39s.

Repository to reproduce this issue
https://gitlab.com/markrian/eslint-plugin-vue-one-component-per-file-bug

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