对 JS 进行检查,我们需要对添加 eslint 设置,首先添加 .eslintrc.js ,这里添加 standard 风格,更多可以在 eslint 网站查看。这里我们使用命令行自动生成,运行eslint --init,然后选择 Use a popular style guide 按照提示操作,如下可做参考。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
? How would you like to configure ESLint? Use a popular style guide ? Which style guide do you want to follow? Standard ? What format do you want your config file to be in? JavaScript Checking peerDependencies of eslint-config-standard@latest Installing eslint-config-standard@latest, eslint-plugin-import@>=2.2.0, eslint-plugin-node@>=4.2.2, eslint-plugin-promise@>=3.5.0, eslint-plugin-standard@>=3.0.0 npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN eslint-config-standard@10.2.1 requires a peer of eslint@>=3.19.0 but none is installed. You must install peer dependencies yourself. npm WARN eslint-plugin-standard@3.0.1 requires a peer of eslint@>=3.19.0 but none is installed. You must install peer dependencies yourself. npm WARN eslint-plugin-node@5.2.1 requires a peer of eslint@>=3.1.0 but none is installed. You must install peer dependencies yourself. npm WARN eslint-plugin-import@2.8.0 requires a peer of eslint@2.x - 4.x but none is installed. You must install peer dependencies yourself.
+ eslint-config-standard@10.2.1 + eslint-plugin-standard@3.0.1 + eslint-plugin-promise@3.6.0 + eslint-plugin-node@5.2.1 + eslint-plugin-import@2.8.0 added 53 packages in 9.873s Successfully created .eslintrc.js file in C:\Users\Lishude\Desktop\project\express