项目代码规范

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"]
  }
}
相关推荐
慌途L8 小时前
Open Code Review 详解:阿里巴巴开源 AI 代码审查工具
ai·ocr·代码规范·code review·ai代码审查
bytemaster9 小时前
GitLab CE 团队卡不住 commit 规范?我用一个全局 Hook 把整个公司拦下了
代码规范
东风破_2 天前
ESLint 是什么?为什么你的项目需要它?
前端·后端·代码规范
先吃饱再说2 天前
代码写得好不好,谁说了算?ESLint 如何让团队代码风格“自动统一”
代码规范·eslint
懒人wsh2 天前
一个潜伏3天半才爆的bug-从502到Too-many-open-files的排查记录
代码规范
烬羽2 天前
ESLint 10 把 .eslintrc 删了:flat config 到底怎么配,我帮你踩完了
代码规范·eslint·前端工程化
_约书亚_2 天前
Chapter 4 并发同步操作 · 归纳总结
代码规范
Asize2 天前
ESLint 到底在帮我们守住什么?从规则配置到工程实践
代码规范·eslint
嘟嘟07172 天前
ESLint 入门:从 npm run lint 到 --fix 与规则级别一次讲清
javascript·代码规范·eslint
不好听6132 天前
ESLint 从零到落地:把"代码规范"变成机器的强制检查
代码规范