Vue.js 禁用规则时出现vue cli linting警告
我正在使用vue cli构建一个应用程序,使用airbnb规则进行lint 尽管我在Vue.js 禁用规则时出现vue cli linting警告,vue.js,eslint,vue-cli-3,eslint-config-airbnb,Vue.js,Eslint,Vue Cli 3,Eslint Config Airbnb,我正在使用vue cli构建一个应用程序,使用airbnb规则进行lint 尽管我在.eslintrc.js配置文件中添加了一条规则,并且该规则应用于其他文件,但我的Welcome.vue文件中的这个特定变量在linting时会不断抛出警告 警告: warning: Identifier 'tables_count' is not in camel case (camelcase) at src\components\Welcome.vue:49:33: 47 | enableA
.eslintrc.js
配置文件中添加了一条规则,并且该规则应用于其他文件,但我的Welcome.vue
文件中的这个特定变量在linting时会不断抛出警告
警告:
warning: Identifier 'tables_count' is not in camel case (camelcase) at src\components\Welcome.vue:49:33:
47 | enableAll: function enableAll() {
48 | const tables_count = this.tables.length;
49 | for (let i = 0; i < tables_count; i += 1) {
| ^
50 | this.tables[i].enabled = true;
51 | }
52 | },
我的应用程序的结构如下:
- App.vue
- 欢迎光临
- Game.vue
App.vue
和Game.vue
都有分数不足的变量,linting不会对它们发出警告
- App.vue:
this.show\u welcome=true代码>
- Game.vue:
this.current_answer=''代码>
npm run service
或npm run lint
注意:我想我已经解决了,但仍然没有…
目前,我只有welcome.vue的单元测试,它有自己的lint文件,但我在其中添加了规则,仍然收到警告:
测试/单元/eslintrc.js
module.exports = {
env: {
jest: true,
},
rules: {
camelcase: ['warn', { properties: 'never' }],
},
};
如果您不想让eslint检查变量大小写,那么只需在
.eslintrc.js中使用camelcase:“off”
将其关闭即可。对于typescript项目:
.eslintrc.js
{
规则:{
“@typescript eslint/camelcase”:“关闭”
}
}
module.exports = {
env: {
jest: true,
},
rules: {
camelcase: ['warn', { properties: 'never' }],
},
};