Correctly setup Eslint Airbnb with VScode in Vue project这是我没有 linting 的 Vuejs 代码。在我运行 之后 npm run lint --fix代码是这样的但我再次做...
这是我没有 linting 的 Vuejs 代码。

在我运行
之后
npm run lint --fix
代码是这样的

但我再次做了一些更改并按下 Control C。它被格式化为旧代码并返回相同的 linting 错误。
我认为当我点击 Control C 时我的代码会自动格式化。
这是我的 Vue 项目 eslint.rc 文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | module.exports = { root: true, env: { node: true, }, extends: [ 'plugin:vue/essential', '@vue/airbnb', ], rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', }, parserOptions: { parser: 'babel-eslint', }, }; |
我没有在 VScode 上安装 pretier 插件。但是我安装了 Vueter 插件和 Eslint 插件。
我的目标是使用 Eslint Airbnb 规则格式化我的 Vuejs 代码。当我保存代码时。
现在它弄乱了代码。我该如何解决这个问题?
为我添加
1 2 3 | "editor.codeActionsOnSave": { "source.fixAll.eslint": true } |
对我的 VS Code 设置 (
本文标题为:关于vue.js:在Vue项目中用VScode正确设置Eslint Air
基础教程推荐
- Ajax实现简单下拉选项效果【推荐】 2022-12-28
- JavaScript函数this指向问题详解 2023-08-12
- vue在install时node-sass@4.14.1 postinstall:node scripts/build.js错误解决 2023-07-09
- AJAX实现数据的增删改查操作详解【java后台】 2023-02-23
- JavaScript开发简单易懂的Svelte实现原理详解 2023-08-12
- 使用HTML5中postMessage知识点解决Ajax中POST跨域问题 2022-10-17
- html网页中使用希腊字母的方法 2022-09-21
- Ajax实现关键字联想和自动补全功能及遇到坑 2023-02-23
- ajax异步加载图片实例分析 2022-12-18
- 【vue】三种获取input值的写法 2023-10-08
