eslint个性化配置

发布时间 2023-06-30 09:19:16作者: 安肯德基
 1 {
 2   // 导入文件时是否携带文件的拓展名
 3   "path-autocomplete.extensionOnImport": true,
 4   // 配置@的路径提示
 5   "path-autocomplete.pathMappings": {
 6     "@": "${folder}/src"
 7   },
 8   "workbench.startupEditor": "none",
 9   "path-autocomplete.excludedItems": {},
10   //忽略找不到`tsconfig.json` or `jsconfig.json`
11   "vetur.ignoreProjectWarning": true,
12   "vetur.completion.scaffoldSnippetSources": {
13     "workspace": "?",
14     "user": "?️",
15     "vetur": "✌"
16   },
17   // vscode默认启用了根据文件类型自动设置tabsize的选项
18   // "editor.detectIndentation": false,
19   // 重新设定tabsize 缩进值为2
20   "editor.tabSize": 2,
21   "liveServer.settings.useBrowserPreview": true,
22   "vscode-edge-devtools.fallbackRevision": "@a41122be052fe9616f0def5fe6842fa942930d46",
23   //  #去掉代码结尾的分号
24   "prettier.semi": false,
25   // 添加 vue 支持
26   "eslint.validate": ["javascript", "javascriptreact", "vue"],
27   "vetur.format.defaultFormatter.js": "vscode-typescript",
28   // #让vue中的js按"prettier"格式进行格式化
29   // "vetur.format.defaultFormatter.js": "prettier",
30   "vetur.format.defaultFormatterOptions": {
31     "js-beautify-html": {
32       // #vue组件中html代码格式化样式
33       "wrap_attributes": "force-aligned", //也可以设置为“auto”,效果会不一样
34       "wrap_line_length": 200,
35       "end_with_newline": false,
36       "semi": false,
37       "singleQuote": true
38     },
39     "prettier": {
40       // Prettier option here
41       "trailingComma": "es5", // 多行时,尽可能打印尾随的逗号
42       "tabWidth": 2, // 会忽略vetur的tabSize配置
43       "useTabs": false, // 是否利用tab替代空格
44       "semi": true, // 句尾是否加;
45       "singleQuote": true, // 使用单引号而不是双引号
46       "arrowParens": "avoid" // allow paren-less arrow functions 箭头函数的参数使用圆括号
47     }
48   },
49   //每次保存的时候将代码按eslint格式进行修复
50   "editor.codeActionsOnSave": {
51     "source.fixAll.eslint": true
52   },
53   "eslint.autoFixOnSave": true,
54   "eslint.format.enable": true,
55 
56   //保存时自动格式化
57   "editor.formatOnSave": true,
58   "editor.formatOnType": true,
59 
60   "editor.foldingStrategy": "indentation",
61   "window.zoomLevel": 1,
62   "workbench.colorCustomizations": {
63     //当前选项卡颜色
64     "tab.activeBackground": "#888888",
65     //与选中同内容
66     "editor.selectionHighlightBackground": "#828000"
67     // "editor.selectionHighlightBorder": "#ecd9d9"
68   },
69   "workbench.iconTheme": "vscode-icons-mac",
70   "liveServer.settings.donotShowInfoMsg": true,
71   "[html]": {
72     "editor.defaultFormatter": "esbenp.prettier-vscode"
73   },
74   "workbench.editor.enablePreview": false,
75   "[vue]": {
76     "editor.defaultFormatter": "esbenp.prettier-vscode"
77   },
78   "eslint.codeActionsOnSave.rules": null,
79   "eslint.execArgv": null,
80   "[json]": {
81     "editor.defaultFormatter": "esbenp.prettier-vscode"
82   }
83 }