项目代码规范

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"]
  }
}
相关推荐
PPPHUANG3 天前
一次 CompletableFuture 误用,如何耗尽 IO 线程池并拖垮整个系统
java·后端·代码规范
zhouzhouya3 天前
码上星辰,人间烟火:我的2025
前端·程序员·代码规范
程序员Agions3 天前
程序员邪修手册:那些不能写进文档的骚操作
前端·后端·代码规范
晨米酱3 天前
轻量级 Git Hooks 管理工具 Husky
前端·代码规范
parade岁月4 天前
把 Git 提交变成“可执行规范”:Commit 规范体系与 Husky/Commitlint/Commitizen/Lint-staged 全链路介绍
前端·代码规范
哈基闻4 天前
想要更多,那就“多继承”
代码规范
zhz52145 天前
后端代码规范文档示例
重构·bug·代码规范·结对编程
卖火箭的小男孩7 天前
Flutter 开发代码规范(优化完善版)
flutter·代码规范
Piper蛋窝8 天前
AI 有你想不到,也它有做不到 | 2025 年深度使用 Cursor/Trae/CodeX 所得十条经验
前端·后端·代码规范
莫比乌斯环8 天前
【安全专项】如何成为一名“火眼金睛”的安卓侦探?
前端·代码规范