-
引入代码规范,ESLint、prettier
关闭所有不必要的规则或可能与Prettier冲突的规则
运行Prettier作为Eslint规则,并报告差异个别ESLint问题
yarn add -D eslint prettier eslint-config-prettier eslint-plugin-prettier # .eslintrc.json { "extends": ["plugin:prettier/recommended"] } # .vscode/settings.json { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "eslint.validate": ["typescript"], "files.eol": "\n" }
-
添加ts相关配置
一个利用TypeScript ESTree 允许ESLint整理TypeScript源代码的ESLint解析器
添加或扩展具有TypeScript特定功能的规则
yarn add typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin # .eslintrc.json { "parser": "@typescript-eslint/parser", "extends": ["plugin:prettier/recommended"], # 添加eslint对es6语法的识别 "parserOptions": { "ecmaVersion": 6 }, "plugins": ["@typescript-eslint"] }
-
配置webpack对ts代码的解析
yarn add ts-loader
ztxkutils
2.10.64 • Public • PublishedReadme
Keywords
nonePackage Sidebar
Install
npm i ztxkutils
Weekly Downloads
53
Version
2.10.64
License
MIT
Unpacked Size
1.08 MB
Total Files
66