如何调试 eslint 规则?

时间:2020-12-28 11:46:54

标签: eslint eslintrc babel-eslint eslint-loader eslint-plugin-react

我想调试 eslint 规则以优化性能。 有什么办法可以使用浏览器/命令行/工具调试它吗?

1 个答案:

答案 0 :(得分:0)

在命令行上运行时可以使用 TIMING=1

$ 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%

文档:result