前端 - 代码规范的工具

  1. EditorConfig
    EditorConfig,文字意译就是编辑器配置,用于跨编辑器保持同一份代码风格。常用于以下场景:假设你vscode空2格,如果粘贴一个新文件是空4格,此时新文件就保持4格,并不会自动改成编辑器默认的2格,editorConfig能帮你做到这一点

  2. Prettier
    Prettier 可以帮你统一项目风格。Prettier 拥有更多配置项,且能在发布流程中自动检查,帮助团队统一代码风格,在Prettier 的帮助下,你可以设置很多自定义格式
    需要注意的是:editorConfig 起作用于敲代码之前,prettier 起作用于保存代码之后

  3. Eslint
    Eslint 是代码静态分析工具,用于发现不符合规范的代码

  4. 规范链接
    typescript-eslint(https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin)
    airbnb(https://github.com/airbnb/javascript)
    eslint-plugin-react(https://github.com/yannickcr/eslint-plugin-react)
    eslint-plugin-jsx-a11y(https://github.com/evcohen/eslint-plugin-jsx-a11y)
    hooks-rules(https://reactjs.org/docs/hooks-rules.html)
    另一个规则腾讯alloy(https://github.com/AlloyTeam/eslint-config-alloy)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值