关于visual-studio-code:vscode配置eslint

1.电脑系统 windows10专业版
2.在开发的过程中,咱们可能会应用到eslint,上面我来分享一下escode配置eslint和遇到的问题。
4.在settings.json中增加如下代码:

{
 // vscode默认启用了依据文件类型主动设置tabsize的选项
 "editor.detectIndentation": false,
 // 从新设定tabsize
 "editor.tabSize": 1,
 // #每次保留的时候主动格式化 
 "editor.formatOnSave": true,
 // #每次保留的时候将代码按eslint格局进行修复
 "editor.codeActionsOnSave": {
  "source.fixAll.eslint": true
 },
 "vetur.format.defaultFormatterOptions": {
  "prettier": {
   "semi": false,
   "singleQuote": true,
   //不在完结的对象增加逗号
   "trailingComma": "none"
  },
 }
}

5.你可能会遇到如下谬误:

这个意思是:在办法名和刮号之间须要有一格空格

6.解决办法,在 我的项目.eslintrc.js中增加如下代码:

rules: {
//去除办法名和括号之后的空格
  "space-before-function-paren": 0,
  'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
  'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
 }

7.本期的分享到了这里就完结啦,心愿对你有所帮忙,让咱们一起致力走向巅峰。

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理