vuejs/vue-eslint-parser

no-unused-vars in template pug

Eyrum opened this issue · 2 comments

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I'm using eslint-plugin-vue.
  • I'm sure the problem is a parser problem. (If you are not sure, search for the issue in eslint-plugin-vue repo and open the issue in eslint-plugin-vue repo if there is no solution.
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

9.21.0

What version of eslint-plugin-vue and vue-eslint-parser are you using?

  • vue-eslint-parser@latest
  • eslint-plugin-vue@latest

What did you do?

no-unused-vars in template pug
import js from "@eslint/js";
import vueParser from 'vue-eslint-parser'
import babelParser from '@babel/eslint-parser'
import pluginVue from 'eslint-plugin-vue'

export default [
  js.configs.recommended,
  {
    languageOptions: {
      parser: vueParser,
      parserOptions: {
        parser: babelParser,
      },
    }
  },
  ...pluginVue.configs['flat/essential'],
  {
    rules: {
      quotes: ["error", "double"],
    },
  },
];

<script setup>
import HelloWorld from "./HelloWorld.vue"
// 'HelloWorld' is defined but never used.
</script>

<template lang="pug">
  HelloWorld
</template>

What did you expect to happen?

HelloWorld is used in template which should be a used var. No errors will be present.

What actually happened?

'HelloWorld' is defined but never used.
(no-unused-vars)

Link to Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNp9VEtv1DAQ/ivGl4C067RckJaCVoIDNzggONSLlE1mFwfHNn6krar8946dZ7u7vSTxzPfNfPNwHqmzZf4NpNS/tZUVawPQDb3x0BhZeCCyUMdPnJpw5PQzV4RUon37jvyNDHIXKW+4uslHPELoiu6LPUhWanUQR1Y7rTDkYyRjIAsOvON0Q2453SZk3hvXoFpOVwjaooo8udaDq3b3nO646jB6VPwTnP+iG6MVKD+KdqUVxhPEB4NCBLqtJ3Nx5GB1g+HZi4I55SrPSTZbMyIcqeAgFFRkHzxR0IIlwUHFYrl9JsyBh8utmuOdtgicFKh86hHqH/TWbtS57UF5je36ONWDgn8U1qGcBMvwvO6Ba5Ps2QRNLXwGHhp+AW9kOAr1K8CAHmHJvMZECOUK7hMY21ME6XGMWGrthlIcs1DqpgFVQbWKrjR4kroTiiN8N15o5TajnZBexWYuLNFmzylj5iwqnFjd8NXFV39gjE21jUJvswOOA1vhcIVEIbPdUq4NEpYp/wftowGXFqzVtl/USoe9xP3pqWO2+NzhwHDMpij/YdEvLoF/MEja4FejK0yEwXpHBe1XMLF3qhSQbsmg4Pk2RGrcJecHagT0/gvOky25gDu3IK/mW2zH6yFLbQfEnw/sil2dIpa/gfO48/+FhL1m1+x9vMlp8B3tngBJU6Bn

Additional comments

Something like this

eslint-plugin-vue and vue-eslint-parser projects do not officially support pug templates.
Using eslint-plugin-vue-pug may solve the problem, but I'm not sure.
Thanks for your understanding.

https://github.com/rashfael/eslint-plugin-vue-pug