Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require-direct-export rule doesn't work with export default Vue.extend({}) #907

Closed
SimonSiefke opened this issue Jun 15, 2019 · 1 comment · Fixed by #1450
Closed

require-direct-export rule doesn't work with export default Vue.extend({}) #907

SimonSiefke opened this issue Jun 15, 2019 · 1 comment · Fixed by #1450

Comments

@SimonSiefke
Copy link

Tell us about your environment

  • ESLint version: 5.16.0
  • eslint-plugin-vue version: 5.0.0
  • Node version: 12.2.0

Please show your full configuration:

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: ['plugin:vue/essential', '@vue/prettier', '@vue/typescript'],
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'vue/require-direct-export': 'error',
  },
  parserOptions: {
    parser: '@typescript-eslint/parser',
  },
}

What did you do?

<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png" />
    <HelloWorld msg="Welcome to Your Vue.js + TypeScript App" />
  </div>
</template>

<script lang="ts">
import Vue from "vue";
import HelloWorld from "./components/HelloWorld.vue";

export default Vue.extend({
  name: "app",
  components: {
    HelloWorld
  }
});
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

What did you expect to happen?
No error

What actually happened?

  12:1  error  Expected the component literal to be directly exported  vue/require-direct-export

✖ 1 problem (1 error, 0 warnings)

error Command failed with exit code 1.
@SimonSiefke SimonSiefke changed the title require-direct-export rule doesn't work with `export default Vue.extend({}) require-direct-export rule doesn't work with export default Vue.extend({}) Jun 15, 2019
@g-plane
Copy link
Contributor

g-plane commented Jan 19, 2021

@ota-meshi @mysticatea @michalsnik This issue was opened one year ago and so far there's no response.

Is that behavior of require-direct-export by design? This also relates to defineComponent in Vue 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants