首先安装eslint
npm i -g eslint
然后在终端输入以下命令
eslint -f compact "src"> results.txt
这是将src下的文件检查后导出到results.txt文件中。如果有如下这样的报错,就检查一下.eslintignore文件。
You are linting "src", but all of the files matching the glob pattern "src" are ignored.
If you don't want to lint these files, remove the pattern "src" from the list of arguments passed to ESLint.
If you do want to lint these files, try the following solutions:
* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored.
* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument.
具体参考链接:
https://www.jianshu.com/p/4133063d1785
http://eslint.cn/docs/user-guide/command-line-interface