vscode 保存时自动在对象或数组最后一个元素后面添加逗号 您所在的位置:网站首页 firstandforemost后面加逗号 vscode 保存时自动在对象或数组最后一个元素后面添加逗号

vscode 保存时自动在对象或数组最后一个元素后面添加逗号

2024-02-24 09:38| 来源: 网络整理| 查看: 265

编辑器配置了prettier

项目里又🈶️eslint配置

两者冲突

怎么不让vscode自动在末尾添加逗号

解决方案: 在setting.json中添加下面这行

// #在对象或数组最后一个元素后面不加逗号

"prettier.trailingComma": "none",

我的完整配置是:

{ "editor.fontSize": 16, "editor.accessibilityPageSize": 16, "workbench.colorTheme": "One Dark Pro", "ProjectTree.useDefaultIgnore": false, "dart.flutterSdkPath": "/Users/sinochem/development/flutter", "editor.minimap.enabled": false,

"editor.wordWrap": "on", "update.enableWindowsBackgroundUpdates": false, "update.mode": "none", "update.showReleaseNotes": false, "window.zoomLevel": 0, "typescript.updateImportsOnFileMove.enabled": "always", "explorer.confirmDelete": false, // #值设置为true时,每次保存的时候自动格式化;值设置为false时,代码格式化请按shift+alt+F "editor.formatOnSave": true, //设置tab的缩进为2 "editor.tabSize": 2, // #每次保存的时候将代码按eslint和tslint格式进行修复 "editor.codeActionsOnSave": { "source.fixAll.eslint": true, "eslint.autoFixOnSave": false, "source.fixAll.tslint": true }, "eslint.run": "onSave", // #让prettier使用eslint的代码格式进行校验 // vscode 更新后已经统一使用editor.codeActionsOnsave // #代码结尾加分号为好 "prettier.semi": false, // #使用带引号替代双引号 "prettier.singleQuote": true, "prettier.tabWidth": 4, // #在对象或数组最后一个元素后面不加逗号 "prettier.trailingComma": "none", // #让函数(名)和后面的括号之间加个空格 "javascript.format.insertSpaceBeforeFunctionParenthesis": true, "vetur.format.defaultFormatterOptions": { "js-beautify-html": { // #vue组件中html代码格式化样式 "wrap_attributes": "force-aligned", //也可以设置为“auto”,效果会不一样 "wrap_line_length": 200, "end_with_newline": false, "semi": false, "singleQuote": true }, "prettier": { "semi": false, "singleQuote": true, "no-tabs": "off" } }, "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, // 格式化stylus, 需安装Manta's Stylus Supremacy插件 "stylusSupremacy.insertColons": false, // 是否插入冒号 "stylusSupremacy.insertSemicolons": false, // 是否插入分号 "stylusSupremacy.insertBraces": false, // 是否插入大括号 "stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行 "stylusSupremacy.insertNewLineAroundBlocks": false, "prettier.useTabs": true, "files.autoSave": "off", "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "diffEditor.ignoreTrimWhitespace": false, "[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, // 两个选择器中是否换行 //在vue文件里设置html关联 "emmet.syntaxProfiles": { "vue-html": "html", "vue": "html" }, "explorer.confirmDragAndDrop": false, "terminal.integrated.rendererType": "dom", "files.associations": { "*.ejs": "html", "*.vue": "html" }, "emmet.triggerExpansionOnTab": true, "emmet.includeLanguages": { "vue-html": "html", "vue": "html" }, "editor.accessibilitySupport": "on", "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "editor.tokenColorCustomizations": null, "vetur.format.defaultFormatter.js": "vscode-typescript", "editor.fontLigatures": null

}



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有