-
EditorConfig
EditorConfig,文字意译就是编辑器配置,用于跨编辑器保持同一份代码风格。常用于以下场景:假设你vscode空2格,如果粘贴一个新文件是空4格,此时新文件就保持4格,并不会自动改成编辑器默认的2格,editorConfig能帮你做到这一点 -
Prettier
Prettier 可以帮你统一项目风格。Prettier 拥有更多配置项,且能在发布流程中自动检查,帮助团队统一代码风格,在Prettier 的帮助下,你可以设置很多自定义格式
需要注意的是:editorConfig 起作用于敲代码之前,prettier 起作用于保存代码之后 -
Eslint
Eslint 是代码静态分析工具,用于发现不符合规范的代码 -
规范链接
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)
前端 - 代码规范的工具
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
猜你喜欢
转载自blog.csdn.net/kelly0721/article/details/100064487
今日推荐
周排行