控制代码规范
settings
{
"debug.console.fontFamily": "",
"typescript.locale": "zh-CN",
"minapp-vscode.disableAutoConfig": true,
// "vetur.format.defaultFormatter.html": "js-beautify-html",
"git.autofetch": true,
"editor.fontSize": 16,
"files.associations": {
"*.vue": "vue",
"*.wxss": "css",
"*.ttss": "css"
},
"emmet.triggerExpansionOnTab": true,
"emmet.includeLanguages": {
"vue-html": "html",
"vue": "html",
"ttml": "html"
},
// "javascript.updateImportsOnFileMove.enabled": "always", //更改文件名-自动更新文件名
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"prettier.semi": true, // 句末加分号
"prettier.printWidth": 200, //因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行
"prettier.jsxBracketSameLine": false, // 在jsx中把'>' 是否单独放一行
"prettier.arrowParens": "avoid", // (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号
"prettier.endOfLine": "auto", // 结尾是 \n \r \n\r auto
"prettier.htmlWhitespaceSensitivity": "ignore",
// "vetur.format.defaultFormatter.js": "js-beautify-html",
// "editor.codeActionsOnSave": {
// "source.fixAll.eslint": true
// },
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
// "[vue]": {
// "editor.defaultFormatter": "esbenp.prettier-vscode"
// },
"editor.tabSize": 2,
"editor.formatOnType": true,
// "eslint.options": {
// "configFile": "C:/Users/seek/.vscode/.eslintrc.js"
// },
// "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
// "workbench.colorTheme": "Monokai Pro (Filter Spectrum)",
"workbench.iconTheme": "vscode-icons",
"workbench.editor.enablePreview": false,
"explorer.confirmDelete": false,
// "javascript.implicitProjectConfig.experimentalDecorators": true,
"terminal.integrated.rendererType": "dom",
"window.zoomLevel": 0,
"workbench.activityBar.visible": true,
"diffEditor.ignoreTrimWhitespace": false,
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.minimap.enabled": false,
"tabnine.experimentalAutoImports": true,
// "auto-close-tag.disableOnLanguage": [],
"auto-close-tag.activationOnLanguage": [
"xml",
"php",
"blade",
"ejs",
"jinja",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"plaintext",
"markdown",
"vue",
"liquid",
"erb",
"lang-cfml",
"cfml",
"HTML (EEx)",
"HTML (Eex)",
"plist"
],
"files.autoSave": "onFocusChange",
"git.ignoreWindowsGit27Warning": true,
"editor.fontLigatures": null
}
module.exports = {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {
// "indent":['error',2],
// "prettier/prettier": "error",
"vue/no-reserved-keys": "off",
"vue/no-mutating-props": "off",
"vue/require-v-for-key": "error", //必须设置v-for的键值;否则报错
"no-unused-vars": "off",
"no-undef": "off",
"no-useless-escape": "off",
"no-debugger": "warn", //禁用 debugger;警告
"vue/no-unused-components": "off",
"vue/html-self-closing": "off",
"vue/no-v-html": "off",
"no-constant-condition": "off",
"no-redeclare": "off",
"no-self-assign": "off",
"vue/singleline-html-element-content-newline": "off",
"no-case-declarations": "off",
"vue/no-unused-vars": "off",
"no-useless-catch": "off",
"vue/custom-event-name-casing": "off",
"vue/html-quotes": ["error", "double"],
"vue/no-parsing-error": "off",
"vue/html-indent": ["error", 2, {
"attribute": 1,
"baseIndent": 1,
"closeBracket": 0,
"alignAttributesVertically": true,
"ignores": []
}],
"vue/max-attributes-per-line": [ //多个特性的元素的规则;否则报错
"error",
{
singleline: 8,
multiline: {
max: 1,
allowFirstLine: false
}
}
]
},
"globals": {
"$": true,
"_": true,
"dsf": true,
"Vue": true,
"$$webRoot": true,
"$$config": true,
"$$validate": true,
"$$form": true,
"flow": true,
"ui": true,
"UE": true,
"monaco": true,
"uParse": true,
},
"overrides": [{
"files": [
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)"
],
"env": {
"jest": true
}
}]
};
设置完成后,如果不生效
.vue文件右键选择使用什么标准格式化文档
.js文件右键选择使用什么标准格式化文档