You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TypeScript Team themselves also announced their plans to move the TypeScript codebase from TSLint to typescript-eslint, and they have been big supporters of this project. More details at microsoft/TypeScript#30553
No rules are enabled by default. The "extends": "eslint:recommended" property in a configuration file enables rules that report common problems, which have a check mark below.
在进行项目开发时统一代码规范十分的重要,这里记录的是我的一些相关操作的经验
eslint相关配置
随着tslint社区和eslint社区的推动,目前推荐使用eslint做ts的风格校验(安装对应的插件即可@typescript-eslint/eslint-plugin),所以不管是js项目还是ts项目,都使用eslint就对了。
不同文件类型的校验使用不同的插件
建议在eslint配置中加入
extends: ["eslint:recommended"]
eslint:recommended规则能够校验出常见的代码风格错误,其他的代码风格规则需要在配置中声明
eslint-plugin-react
eslint-plugin-vue
确保上述配置正确,如果你使用的是VsCode编辑器,安装eslint插件,并设置编辑器保存时进行fix操作,能够极大的提升工作效率。在代码编写阶段就能够解决代码风格问题,不必等到commit时在去处理风格不一致问题。
WebStorm
用户同样可以实现上述功能,我不太熟悉WebStorm的配置 : )...使用 husky+lint-staged+prettier 优化代码格式
The text was updated successfully, but these errors were encountered: