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

Issue with no-unused-components #891

Closed
EnochG1 opened this issue May 15, 2019 · 1 comment
Closed

Issue with no-unused-components #891

EnochG1 opened this issue May 15, 2019 · 1 comment

Comments

@EnochG1
Copy link

EnochG1 commented May 15, 2019

Tell us about your environment

  • ESLint version: ^5.16.0
  • eslint-plugin-vue version: ^5.2.2
  • Node version: 10.15.3

Please show your full configuration:

module.exports = {
  root: true,
  parserOptions: {
    parser: 'babel-eslint'
  },
  env: {
    browser: true,
  },
  extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    'plugin:vue/essential',
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    'standard'
  ],
  // required to lint *.vue files
  plugins: [
    'vue'
  ],
  // add your custom rules here
  rules: {
    // allow async-await
    'generator-star-spacing': 'off',
    'no-extra-semi': 'off',
    'semi': 'off',
    "space-before-function-paren": ["error", "never"],
    // allow debugger during development
    'no-debugger': 'warn',
  }
}

What did you do?

<template>
  <div>
    <button @click="upsert">SKU {{ upsertLabel }}</button>
    <modals-container />
  </div>
</template>

<script>
import ModalUpsertSku from './ModalUpsertSku';

export default {
  name: 'Master',
  components: {
    ModalUpsertSku
  },
  methods: {
    upsert() {

      let param = {
        upsertCode: this.upsertCode
      };
      let options = {
        width: '350px',
        height: 'auto'
      };

      if (this.upsertCode === 'M') {
        param.skuId = this.grid.getrowdata(
          this.grid.selectedrowindexes[0]
        ).skuId;
      }

      this.$modal.show(ModalUpsertSku, param, options);
    }
  }

What did you expect to happen?
Using component not in vue template, but in method, parameter for vue-js-modal.
(https://github.com/euvl/vue-js-modal)

What actually happened?

Module Warning (from ./node_modules/eslint-loader/index.js):

  ✘  https://google.com/#q=vue%2Fno-unused-components  The "ModalUpsertSku" component has been registered but not used
  src\apps\SampleSearch\components\SearchMaster.vue:30:5

(+ When I use eslint-plugin-vue version 4.X, this eslint output wasn't occured. It shows from version 5)

I also read #556.
Even though I'm not using , I use component in vue instance. I think in this case this rule should not be error. (It's not string like 'ModalUpsertSku', just ModalUpsertSku)

@ota-meshi
Copy link
Member

Thank you for this issue.

You can delete the following code:

  components: {
    ModalUpsertSku
  },

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

No branches or pull requests

2 participants