vscode settings.json配置保存格式化成eslint规范

{
	"workbench.colorTheme": "Default Dark+",
	"workbench.iconTheme": "vscode-icons",
	"gitlens.advanced.messages": {
		"suppressGitMissingWarning": true
	},
	"editor.linkedEditing": true,
	"editor.formatOnSave": true,
	"[typescript]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"[html]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
  },
	"[less]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"editor.wordWrap": "on",
	"[javascript]": {
		"editor.defaultFormatter": "vscode.typescript-language-features"
	},
	"vetur.validation.template": false,
	"[scss]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
	"[vue]": {
		"editor.defaultFormatter": "octref.vetur"
	},
	"guides.enabled": false,
	"open-in-browser.default": "google chrome",
	"htmlhint.options": {
		"csslint": {
			"doctype-first": true
		}
  },
	"todo-tree.general.tags": [
		"BUG",
		"HACK",
		"FIXME",
		"TODO",
		"XXX",
		"[ ]",
		"[x]"
	],
	"todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|^\\s*(-|\\d+.))\\s*($TAGS)",
    // 网上找的 → vscode保存代码,自动按照eslint规范格式化代码设置
    "editor.fontSize": 14, // 设置字体大小,这个不多说都明白
    "editor.fontFamily": "Fira code", // 后边的引号中写上要设置的字体类型,个人比较喜欢Fira Code 
    "editor.fontLigatures": true,//这个控制是否启用字体连字,true启用,false不启用,这里选择启用
    "editor.fontWeight": "normal",//这个设置字体粗细,可选normal,bold,"100"~"900"等,选择合适的就行
    "eslint.enable": true, //是否开启vscode的eslint
    "eslint.options": { //指定vscode的eslint所处理的文件的后缀
        "extensions": [
        ".js",
        ".vue",
        ".ts",
        ".tsx"
        ]
    },
    // 确定校验准则
    "eslint.validate": [ 
        "javascript",
        "javascriptreact",
        "vue",
        "html",
        "typescript",
        "typescriptreact"
    ],
    "files.autoSave": "off",
    "files.associations": {
        "*.wpy": "vue",
        "*.wxml": "wxml",
        "*.cjson": "jsonc",
        "*.wxss": "css",
        "*.wxs": "javascript",
        "*.html": "html"
    },
    "emmet.includeLanguages": {
        "wxml": "html"
    },
    "minapp-vscode.disableAutoConfig": true,
    // vscode默认启用了根据文件类型自动设置tabsize的选项
    "editor.detectIndentation": false,
    // 重新设定tabsize
    "editor.tabSize": 2,
    "vetur.format.options.tabSize": 2, // vue的缩进2个
    "prettier.tabWidth": 2, // prettier插件保存自动格式化 1tab=2空格
    //  #让prettier使用eslint的代码格式进行校验 
    // "prettier.eslintIntegration": true,
    //  #让函数(名)和后面的括号之间加个空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
    // #让vue中的js按编辑器自带的ts格式进行格式化 
    "vetur.format.defaultFormatter.js": "vscode-typescript",
    "git.enableSmartCommit": true,
    "editor.quickSuggestions": {
        "strings": true
    },
    //一定要在vutur.defaultFormatterOptions参数中设置,单独修改prettier扩展的设置是无法解决这个问题的,因为perttier默认忽略了vue文件(事实上从忽略列表移除vue也不能解决这个问题)
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
        // force-aligned | force-expand-multiline
        "wrap_attributes": "force-aligned"
        },
        "prettyhtml": {
        "printWidth": 100,
        "singleQuote": false,
        "wrapAttributes": false,
        "sortAttributes": true
        },
        "prettier": {
        //  #去掉代码结尾的分号 
        "semi": true,
        //  #使用单引号替代双引号 
        "singleQuote": true,
        //  #让prettier使用eslint的代码格式进行校验 
        "eslintIntegration":true,
        }
    },
    // 插件KoroFileHeader
    // 文件头部注释-快捷键crtl+alt+i(window),ctrl+cmd+t (mac)
    "fileheader.customMade": {
        "autoAdd": false,  // 关闭自动生成头部注释
        "Descripttion": "",
        //"version": "",
        "Author": "voanit",
        "Date": "Do not edit",
        "LastEditors": "voanit",
        "LastEditTime": "Do not Edit"
    },
    // 函数注释-快捷键ctrl+alt+t (window), ctrl+alt+t(mac)
    // "fileheader.cursorMode": {
    //     "name": "",
    //     // "test": "test font",
    //     // "msg": "",
    //     "param": "",
    //     "return": ""
    // },
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true //是否在保存的时候自动fix eslint
    },
    "terminal.integrated.gpuAcceleration": "off",
    "powermode.shakeIntensity": 0, // 屏幕震动的强度
    "powermode.enabled": true, // 启用以激活电源模式
    "vscode_vibrancy.opacity": 0.98, // 毛玻璃透明度
    "vscode_vibrancy.theme": "Default Dark", // 毛玻璃使用的主题样式
    "prettier.singleQuote": true, // true:使用单引号
    "typescript.format.insertSpaceBeforeAndAfterBinaryOperators": false,
    "terminal.integrated.fontFamily": "monospace",
    "bracketPairColorizer.depreciation-notice": false, // 箭头函数一个参数时也加()包裹
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值