vscode:setting.json
{
"editor.renderIndentGuides": false,
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"git.confirmSync": false,
"launch": {
"configurations": [],
"compounds": [],
"search.exclude": {
"system/": true,
"!/system/**/*.ps*": true
}
},
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"terminal.integrated.automationShell.osx": "",
"security.workspace.trust.untrustedFiles": "open",
"sonarlint.ls.javaHome": "c:\\Users\\满船1167\\.vscode\\extensions\\sonarsource.sonarlint_managed-jre\\jre\\jdk-11.0.11+9-jre",
"tabnine.experimentalAutoImports": true,
"sonarlint.rules": {
"javascript:S4326": {
"level": "off"
},
"javascript:S125": {
"level": "off"
},
"javascript:S4138": {
"level": "off"
},
"javascript:S3776": {
"level": "off"
},
"javascript:S3626": {
"level": "off"
},
"javascript:S2310": {
"level": "off"
},
"javascript:S3358": {
"level": "off"
}
},
"workbench.iconTheme": "material-icon-theme",
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"vetur.format.defaultFormatter.js": "prettier",
"vetur.format.defaultFormatter.html": "prettyhtml",
"vetur.format.defaultFormatterOptions": {
"prettier": {
"semi": false,
"printWidth": 140,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
},
"prettyhtml": {
"printWidth": 140
}
},
"editor.formatOnSave": true,
"editor.tabSize": 4,
"prettier.semi": false,
"prettier.singleQuote": true,
"prettier.trailingComma": "none",
"prettier.printWidth": 140,
"prettier.arrowParens": "avoid",
}
项目根目录下新建文件.prettierrc.js
module.exports = {
printWidth: 140,
semi: false,
singleQuote: true,
tabWidth: 4,
trailingComma: 'none',
'prettier.eslintIntegration': true,
parser: 'babel',
bracketSpacing: true,
useTabs: true,
jsxBracketSameLine: false,
arrowParens: 'avoid',
requirePragma: false,
proseWrap: 'preserve',
'eslint.autoFixOnSave': true,
'eslint.validate': [
'javascript',
'javascriptreact',
{
language: 'vue',
autoFix: true
}
]
}
根目录下新建文件.editorconfig
# http://editorconfig.org
# editorconfig顶级配置文件,停止向上寻找配置文件
root = true
[*]
# 缩进风格tab或者space
indent_style = tab
# 缩进大小2或者4
indent_size = 4
# 换行符
end_of_line = lf
# 字符集
charset = utf-8
# 是否删除行尾的空格
trim_trailing_whitespace = true
# 是否在文件的最后插入一个空行
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
根目录下新建文件.eslintrc.js
module.exports = {
root: true,
env: {
browser: true,
node: true,
es6: true
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
indent: ['off', 2],
'no-irregular-whitespace': 'off',
'vue/script-indent': ['error', 4, { baseIndent: 1 }],
'space-before-function-paren': [0, 'always'],
'spaced-comment': 0,
'comma-dangle': [1, 'never'],
'no-mixed-spaces-and-tabs': [1, 'smart-tabs'],
'no-tabs': 0,
'linebreak-style': ['off', 'windows'],
quotes: ['error', 'single'],
semi: ['error', 'never']
}
}
vscode安装插件:
EditorConfig for VS Code
Prettier
|