editorconfig
EditorConfig 是一种用于统一不同编辑器和 IDE 的代码风格的文件格式和插件,帮助开发人员在不同的编辑器和 IDE 中保持一致的代码风格,从而提高代码的可读性和可维护性
bash
# EditorConfig is awesome: https://EditorConfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
prettier
Prettier 是一款代码格式化工具,可以帮助开发人员自动格式化代码,从而提高代码的可读性和可维护性。
bash
{
"semi": false,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "es5",
"printWidth": 100,
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf",
"overrides": [
{
"files": "*.json",
"options": {
"printWidth": 200
}
}
],
"vueIndentScriptAndStyle": true
}
ESlint
ESLint 是一款 JavaScript 代码检查工具,在编写代码时发现和修复常见的代码错误和风格问题,从而提高代码的质量和可维护性。
bash
{
"env": {
"browser": true,
"es6": true
},
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-console": "off",
"indent": ["error", 2],
"quotes": ["error", "single"],
"semi": ["error", "always"]
}
}