【问题标题】:How can I debug eslint rules?如何调试 eslint 规则?
【发布时间】:2021-04-05 04:43:01
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    在命令行运行时可以使用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%
    

    文档:https://eslint.org/docs/1.0.0/developer-guide/working-with-rules#per-rule-performance

    【讨论】:

      猜你喜欢
      • 2016-08-29
      • 2023-01-05
      • 2021-04-14
      • 2019-11-10
      • 2011-12-10
      • 1970-01-01
      • 2020-08-04
      • 2016-04-14
      • 1970-01-01
      相关资源
      最近更新 更多