unplugin / unplugin-vue-components

📲 On-demand components auto importing for Vue
https://www.npmjs.com/package/unplugin-vue-components
MIT License
3.76k stars 350 forks source link

vue/component-name-in-template-casing not working #783

Open chenyulun opened 2 months ago

chenyulun commented 2 months ago

Describe the bug

eslint + "vue/component-name-in-template-casing": ["error", "PascalCase"],

https://eslint.vuejs.org/rules/component-name-in-template-casing.html#vue-component-name-in-template-casing

eslint9.0+

import antfu from '@antfu/eslint-config'

export default antfu({
  vue: {
    vueVersion: 2,
  },
  rules: {
    'no-console': 'warn',
  },
}, {
  ignores: [
    'dist',
    'public',
    'node_modules',
    '*.d.ts',
  ],
})

只有局部注册的组件,能检测并且要求模板必须使用PascalCase

https://github.com/antfu/eslint-config/issues/535

Reproduction

npm install --save-dev eslint eslint-plugin-vue

System Info

System:
    OS: macOS 12.6.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 26.85 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/Library/Caches/fnm_multishells/73193_1721734107367/bin/node
    Yarn: 1.22.21 - ~/Library/pnpm/yarn
    npm: 9.8.1 - ~/Library/Caches/fnm_multishells/73193_1721734107367/bin/npm
    pnpm: 9.5.0 - ~/Library/pnpm/pnpm
    bun: 1.0.29 - ~/.bun/bin/bun
    Watchman: 2023.10.09.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 126.0.6478.183
    Chrome Canary: 128.0.6612.0
    Edge: 126.0.2592.113
    Safari: 16.1

Used Package Manager

pnpm

Validations

chenyulun commented 2 months ago
export default antfu({
rules: {
    'vue/component-name-in-template-casing': ['error', 'PascalCase', {
      registeredComponentsOnly: false,
    }]
  }
})