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

vue/no-unused-property false positive with camelCase v-bind same-name shorthand #2370

Closed
2 tasks done
M1CK431 opened this issue Jan 15, 2024 · 7 comments · Fixed by #2379
Closed
2 tasks done

vue/no-unused-property false positive with camelCase v-bind same-name shorthand #2370

M1CK431 opened this issue Jan 15, 2024 · 7 comments · Fixed by #2379
Labels

Comments

@M1CK431
Copy link
Contributor

M1CK431 commented Jan 15, 2024

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: 8.56.0
  • eslint-plugin-vue version: 9.20.1
  • Vue version: 3.4.13
  • Node version: 21.5.0
  • Operating System: Archlinux

Please show your full configuration:

/* eslint-env node */
module.exports = {
  root: true,
  env: { node: true, es2022: true },
  parserOptions: { ecmaVersion: "latest" },
  plugins: ["prettier"],
  extends: [
    "plugin:vue/vue3-strongly-recommended",
    "eslint:recommended",
    "./.eslintrc-auto-import.json",
    "plugin:prettier/recommended"
  ],
  overrides: [
    {
      files: ["*.graphql", "*.gql"],
      parser: "@graphql-eslint/eslint-plugin",
      plugins: ["@graphql-eslint"],
      rules: {
        "@graphql-eslint/no-duplicate-fields": "error"
      }
    }
  ],
  rules: {
    "prettier/prettier": [
      "warn",
      { trailingComma: "none", arrowParens: "avoid" }
    ],
    "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-setter-return": "off",
    "no-empty": ["error", { allowEmptyCatch: true }],

    "vue/multi-word-component-names": "off",
    "vue/no-reserved-component-names": "off",
    "vue/max-attributes-per-line": "off",
    "vue/no-template-shadow": "off",
    "vue/one-component-per-file": "off",
    "vue/require-explicit-emits": "off",
    "vue/singleline-html-element-content-newline": "off",
    "vue/require-default-prop": "off",
    "vue/v-on-event-hyphenation": ["error", "never"],
    "vue/component-tags-order": [
      "warn",
      { order: ["template", "script", "style"] }
    ],
    "vue/no-lone-template": "warn",
    "vue/order-in-components": "warn",
    "vue/this-in-template": "error",
    "vue/block-tag-newline": "warn",
    "vue/component-name-in-template-casing": [
      "warn",
      "PascalCase",
      {
        registeredComponentsOnly: false,
        ignores: ["component", "transition", "fa"]
      }
    ],
    "vue/component-options-name-casing": "warn",
    "vue/custom-event-name-casing": "error",
    "vue/no-empty-component-block": "warn",
    "vue/no-ref-object-destructure": "error",
    "vue/no-required-prop-with-default": "warn",
    "vue/no-template-target-blank": "error",
    "vue/no-this-in-before-route-enter": "error",
    "vue/no-unsupported-features": ["error", { version: "^3.4.0" }],
    "vue/no-unused-properties": "warn",
    "vue/no-unused-refs": "warn",
    "vue/no-useless-mustaches": "warn",
    "vue/no-useless-v-bind": "warn",
    "vue/padding-line-between-blocks": "warn",
    "vue/prefer-separate-static-class": "error",
    "vue/prefer-true-attribute-shorthand": "warn",
    "vue/v-for-delimiter-style": "warn",
    "vue/attribute-hyphenation": ["warn", "never"]
  }
};

What did you do?

<template><div :tuut /></template>

<script>export default { props: { tuut: String } }</script>

What did you expect to happen?
No EsLint warning about "unused" tuut prop

What actually happened?

warning 'tuut' of property found, but never used vue/no-unused-properties

Repository to reproduce this issue

https://github.com/vuejs/eslint-plugin-vue
Don't be evil, it's not always needed 🙄

@FloEdelmann
Copy link
Member

FloEdelmann commented Jan 15, 2024

I can't reproduce that: https://ota-meshi.github.io/eslint-plugin-vue-demo/#eJxVjMEKwyAQRH9l2XOC0KNIfqJXLzZuimBV1jUUgv/eSHpobzPzmHfgmj2hRiP0KtEJLTYBGB920A/HoM5u1A80deVQZKF3ySzgaXMtChzjVjiXqq8MsOWs4S4c0nO6llP4t3Sb+tB/lTbhhNwiVdQH7o1UynNLrZKfh5pYwmC33j+xBT+J

bar is correctly marked as used, foo is correctly reported as unused.

@M1CK431
Copy link
Contributor Author

M1CK431 commented Jan 15, 2024

Ok excuse me, my example were wrong, this issue appears only with camelCase props:
image

@FloEdelmann FloEdelmann changed the title vue/no-unused-property false positive when used only with new v-bind same-name shorthand vue/no-unused-property false positive with camelCase v-bind same-name shorthand Jan 15, 2024
@M1CK431
Copy link
Contributor Author

M1CK431 commented Jan 25, 2024

Glad to see that! However I haven't vue-eslint-parser in my package.json. What should I do to use the fixed version?

@FloEdelmann
Copy link
Member

FloEdelmann commented Jan 25, 2024

This issue can only be closed when the vue-eslint-parser version in eslint-plugin-vue's package.json is increased to the latest version. A PR is welcome for that!

Meanwhile, you can manually run npm install vue-eslint-parser@latest && npm remove vue-eslint-parser in your project. This upgrades vue-eslint-parser (as dependency of eslint-plugin-vue) in your package-lock.json without adding it as a direct dependency.

@M1CK431
Copy link
Contributor Author

M1CK431 commented Jan 25, 2024

Here it is #2379 @FloEdelmann 😉

@M1CK431
Copy link
Contributor Author

M1CK431 commented Jan 25, 2024

Thanks! Can't wait for the next release 😄

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

Successfully merging a pull request may close this issue.

3 participants