Preparation of New Project (1)


开发环境

  1. vscode
  2. node
  3. typescript

项目初始化

  1. npm init
  2. npm install --save typescript
  3. npx tsc --init

导入 ESLint + Prettier

  1. npm install --save-dev eslint
  2. npx eslint --init
  3. npm install --save-dev prettier eslint-config-prettier
// .eslintrc.js
module.exports = {
  /* ****** */
  extends: [
    /* ****** */
    "prettier", //最後に追加する
  ],
};

安装插件

  1. ESLint(dbaeumer.vscode-eslint)
  2. Prettier(esbenp.prettier-vscode)

设定vscode

// .vscode/settings.json rootに
{
  "editor.defaultFormatter": "esbenp.prettier-vscode", 
  "editor.formatOnSave": true
}

demo

github repo


文章作者: せいい
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 せいい !
  目录