![](/img/trans.png)
[英]How to selectively enable eslint rules from eslint-config-airbnb
[英]Which eslint rules in my config are slow?
我有一個包含大約100條規則的配置,並且在我的項目上使用所有這些規則運行eslint大約需要10秒。 我想確定最慢的規則並消除其中的一些規則。 我該怎么做呢? 是否有任何用於eslint的分析器工具?
如果設置了環境變量TIMING
則eslint顯示規則的花費時間。 例如:
$ TIMING=1 eslint lib
Rule | Time (ms) | Relative
:----------------------------|----------:|--------:
valid-jsdoc | 203.798 | 6.7%
camelcase | 142.146 | 4.6%
no-unmodified-loop-condition | 136.811 | 4.5%
indent | 127.138 | 4.2%
no-undefined | 124.525 | 4.1%
keyword-spacing | 85.397 | 2.8%
space-in-parens | 76.179 | 2.5%
no-this-before-super | 72.317 | 2.4%
no-implied-eval | 69.945 | 2.3%
space-infix-ops | 57.128 | 1.9%
另請參閱有關Per-rule性能的官方文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.