项目代码规范

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"]
  }
}
相关推荐
UIUV21 小时前
JavaScript中的LHS和RHS查询机制详解
前端·javascript·代码规范
San301 天前
Trae Que:用智能提示词提升编程效率的新范式
javascript·人工智能·代码规范
Hilaku2 天前
别再吹性能优化了:你的应用卡顿,纯粹是因为产品设计烂🤷‍♂️
前端·javascript·代码规范
奋进的电子工程师3 天前
如何实现开源组件的安全与合规治理?
安全·开源·代码规范·设计规范·代码复审
San30.4 天前
从代码规范到 AI Agent:现代前端开发的智能化演进
javascript·人工智能·代码规范
IT界的奇葩4 天前
代码规范 spring-javaformat使用
java·spring·代码规范
花生Peadar4 天前
AI编程从入门到精通
前端·后端·代码规范
jump_jump5 天前
Claude vs Doubao Seek Code 产码能力对比
ai编程·claude·代码规范
千桐科技7 天前
数据库设计最佳实践:我们团队沉淀下来的规范
数据库·代码规范·设计
JaneHe8 天前
最新Eslint9+prettier+Husky暂存区配置(基于Vue)
代码规范