查看原文
其他

学习这些前端代码规范,让你的代码更丝滑!

GUOZE 前端充电宝 2022-10-24

大家好,我是 CUGGZ。

不以规矩,不能成方圆。今天来推荐几个流行的前端代码规范,可以参考这些规范来制订适合自己团队的代码规范,也可以通过学习这些规范来编写更简洁清晰的代码,让你的代码更丝滑!

JavaScript

Airbnb JavaScript Style Guide

Airbnb JavaScript Style Guide 是由 Airbnb 开源的 JavaScript 代码风格指南。主要是为编写 JavaScript 代码提供规范的风格,方便开发者理解、阅读代码。

Github(英文):https://github.com/airbnb/javascript

Github(中文):https://github.com/sivan/javascript-style-guide

JavaScript Standard Style

JavaScript 标准风格,无需管理 .eslintrc,.jshintrc, 或 .jscsrc 文件即可运行,真正做到开箱即用。Github:https://github.com/standard/standard

idiomatic.js

编写具备一致风格、通俗易懂 JavaScript 的规则,提供了中文版。

Github:https://github.com/rwaldron/idiomatic.js

Google JavaScript Style Guide

谷歌 JavaScript 风格指南。

Github:https://google.github.io/styleguide/jsguide.html#terminology-notes

CSS

Airbnb CSS / Sass Styleguide

用更合理的方式编写 CSS 和 Sass。

Github:https://github.com/airbnb/css

Code Guide

开发灵活,稳定,可持续 HTML 和 CSS 代码的规范,提供了中文版。

Github:https://github.com/mdo/code-guide

Google HTML/CSS Style Guide

谷歌 HTML/CSS 风格指南,旨在改善协作和代码质量。

地址:https://google.github.io/styleguide/htmlcssguide.html

Sass Guidelines

编写健全、可维护和可扩展的 Sass 的指南。

Github:https://github.com/KittyGiraudel/sass-guidelines

Vue

Vue.js 风格指南

这是 Vue 官方提供的 Vue(2.x)特有代码的风格指南。

Github:https://v2.cn.vuejs.org/v2/style-guide/

Vue.js Component Style Guide

本规范提供了一种统一的编码规范来编写 Vue.js 代码。

Github:https://github.com/pablohpsilva/vuejs-component-style-guide

React

Airbnb React/JSX Style Guide

Airbnb React/JSX 风格指南,基于 JavaScript 当前流行的标准。

Github:https://github.com/airbnb/javascript/tree/master/react

TypeScript

Google TypeScript Style Guide

谷歌 TypeScript 风格指南。

地址:https://google.github.io/styleguide/tsguide.html

6. 其他

Node.js Style Guide

Node.js Style Guide 是编写一致且美观的 node.js 代码的指南。

Github:https://github.com/felixge/node-style-guide

Git Style Guide

Git 风格指南,这份风格指南受到 How to Get Your Change Into the Linux Kernel,git man pages 和大量社区通用实践的启发,提供了中文版。

Github:https://github.com/agis/git-style-guide

HTTP API Design Guide

本指南描述了一组 HTTP+JSON API 设计实践。它的目标是一致性和专注于业务逻辑,同时避免设计轮子。提供了中文版。

Github:https://github.com/interagent/http-api-design

Google JSON Style Guide

谷歌 JSON 风格指南。

地址:https://google.github.io/styleguide/jsoncstyleguide.xml

京东凹凸实验室前端规范

由凹凸实验室整理,基于 W3C、苹果开发者 等官方文档,并结合团队日常业务需求以及团队在日常开发过程中总结提炼出的经验而制定。

Github:https://github.com/o2team/guide

Document Style Guide

阮一峰开源的中文技术文档的写作规范。

Github:https://github.com/ruanyf/document-style-guide

往期推荐:

10分钟彻底掌握 CSS Flex 布局

鲜为人知但很有用的 HTML 属性

一文读懂TypeScript类型兼容性

盘点阿里巴巴 15 个顶级前端开源项目

使用 TypeScript 编写 React 的最佳实践!

推荐 8 个炫酷的数据可视化大屏项目!

盘点12个 yyds 的低代码开源项目

您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存