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

used parameter reported as unused in template loop #543

Closed
rijulg opened this issue Aug 1, 2018 · 2 comments
Closed

used parameter reported as unused in template loop #543

rijulg opened this issue Aug 1, 2018 · 2 comments

Comments

@rijulg
Copy link

rijulg commented Aug 1, 2018

Tell us about your environment

  • ESLint Version: ^3.0.0-rc.10
  • eslint-plugin-vue Version: vue/strongly-recommended
  • Node Version: v10.3.0

Please show your full configuration:

module.exports = {
  root: true,
  env: {
    node: true,
    jest: true,
  },
  'extends': [
    'plugin:vue/strongly-recommended',
    '@vue/airbnb'
  ],
  rules: {
    "vue/no-parsing-error": [2, {"x-invalid-end-tag": false}],
    "no-param-reassign": [2, { "props": false }],
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'import/no-extraneous-dependencies': process.env.NODE_ENV === 'production' ? 'on' : 'off',
  },
  parserOptions: {
    parser: 'babel-eslint'
  },
}

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

<MenuItem
  v-for="{name, icon} in menu"
  :name="name"
  :key="name">
  <Icon
      v-if="icon"
      :type="icon"/>
  <span>{{ name }}</span>
</MenuItem>

What did you expect to happen?
no errors

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

Module Warning (from ./node_modules/eslint-loader/index.js):
error: 'icon' is defined but never used (vue/no-unused-vars) at src\components\sidebar\sidebar.vue:16:23:
14 |
15 | <MenuItem
16 | v-for="{name, icon} in menu"
| ^
17 | :name="name"
18 | :key="name">
19 |
error: Expected indentation of 8 spaces but found 10 spaces (vue/html-indent) at src\components\sidebar\sidebar.vue:21:1:
19 |
20 | <Icon
21 | v-if="icon"
| ^
22 | :type="icon"/>
23 | {{ name }}
24 |

Besides the loop error, can someone please explain why indenting the divs inside the main div is reported as incorrect? I am just not sure if indenting them is right or not anymore but I thought it should have been.

@mysticatea
Copy link
Member

mysticatea commented Aug 2, 2018

Thank you for the report.

This looks like the same issue as #423. It will be fixed in the next version.
Could you try the current beta version of eslint-plugin-vue?

@michalsnik
Copy link
Member

I tested it on eslint-plugin-vue@next and it seems to be fixed.

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

3 participants