【发布时间】:2022-08-09 07:14:35
【问题描述】:
有没有办法停止从 ESLint 中获取单个单词的错误看法Vue3 中的名称?
每次我运行 ESLint 时,我都会收到以下消息:
1:1 error Component name \"About\" should always be multi-word vue/multi-word-component-names
我目前有这个设置:
文件结构:
├── index.html
├── node_modules
├── npm
├── package.json
├── package-lock.json
├── public
│ └── favicon.ico
├── README.md
├── src
│ ├── App.vue
│ ├── assets
│ │ └── logo.svg
│ ├── components
│ │ └── Menu.vue
│ ├── env.d.ts
│ ├── main.ts
│ ├── router
│ │ └── index.ts
│ └── views
│ ├── About.vue
│ └── Home.vue
├── tsconfig.json
└── vite.config.ts
.eslintrc:
{
\"root\": true,
\"env\": {
\"node\": true
},
\"extends\": [
\"plugin:vue/vue3-essential\",
\"eslint:recommended\",
\"@vue/typescript/recommended\"
],
\"parserOptions\": {
\"ecmaVersion\": 2021
},
\"rules\": {}
}
包.json
{
...
\"scripts\": {
\"dev\": \"vite\",
\"build\": \"vue-tsc --noEmit && vite build\",
\"preview\": \"vite preview\",
\"lint\": \"eslint --ext .ts,vue --ignore-path .gitignore .\"
},
...
}
-
将你想要的配置添加到
.eslintrc?文档中有广泛的指导:eslint.org/docs/user-guide/configuring。但是 Vue 风格指南将其描述为“基本”:vuejs.org/v2/style-guide/#Multi-word-component-names-essential,这就是它在该预设中的原因。 -
@jonrsharpe 这是我最初的想法,但正如您在“组件”中所说,这是必不可少的。但据我了解,这不包括视图,因为即使 vue-cli 使用单个单词名称生成它们,因为您不会将它们用作代码中的标签......
-
@Tomkys 唯一(应该)是一个单词的组件是 App.vue - 随着新的更新,生成的组件也是 Multi-Word i bleieve
标签: vue.js vue-router eslint vuejs3 vite