1. 代码风格规范

1.1 缩进与空格

1.2 换行

const result = someVeryLongFunctionName(argument1, argument2, argument3)
  .then(data => {
    // 处理数据
  })
  .catch(error => {
    // 处理错误
  });

1.3 命名规范

const MAX_COUNT = 100;

function getUserInfo(userId) {
  // 逻辑
}

class UserModel {
  constructor() {
    this._privateProperty = 'private';
  }

  _privateMethod() {
    // 私有方法
  }
}

1.4 引号

const name = 'John';
const message = "He's a developer";

1.5 分号

const a = 1;
const b = 2;

1.6 花括号

if (condition) {
  doSomething();
}

1.7 注释

/ 单行注释

/*
 * 多行注释
 */

/**
 * 获取用户信息
 * @param {string} userId - 用户 ID
 * @returns {Object} 用户信息
 */
function getUserInfo(userId) {
  // 逻辑
}