在ESLint 官方网站中,有一个叫做Per-rule Performance
的段落。
它说
“设置TIMING
环境变量将触发10条运行时间最长的规则的显示,以及它们各自的运行时间和相对性能影响(占整个规则处理时间的百分比)”。
$ TIMING=1 eslint lib
Rule | Time (ms) | Relative
:-----------------------|----------:|--------:
no-multi-spaces | 52.472 | 6.1%
camelcase | 48.684 | 5.7%
no-irregular-whitespace | 43.847 | 5.1%
valid-jsdoc | 40.346 | 4.7%
handle-callback-err | 39.153 | 4.6%
space-infix-ops | 35.444 | 4.1%
no-undefined | 25.693 | 3.0%
no-shadow | 22.759 | 2.7%
no-empty-class | 21.976 | 2.6%
semi | 19.359 | 2.3%
但是,当我添加
"lint-js": "TIMING=1 eslint --ext .js,.jsx,.ts,.tsx src/js --cache --cache-strategy metadata"
在"scripts"
中的package.json
中,并使用
npm run lint-js
在我的Windows OS
里,我得到
'TIMING' is not recognized as an internal or external command,
operable program or batch file.
如何在Windows中用TIMING=1
运行eslint
?
https://stackoverflow.com/questions/71908341
复制相似问题