eslint - 如何调试 eslint 规则?
问题描述
我想调试 eslint 规则以进行性能优化。有什么方法可以使用浏览器/命令行/工具对其进行调试?
解决方案
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
推荐阅读
- python - 使用 Python 在 Linux 中仅删除具有指定权限的文件
- apache-spark - pyspark 仅在第二个表有条目时才加入 2 个表并更改列值
- react-native - React 无法识别 DOM 元素上的 `enterKeyHint` 属性
- swift - 捕获使用 ! 引发的错误 迅速
- node.js - 在 node-db-migrate (PostgreSQL) 中使用新创建的数据库进行迁移
- fragment - 片段内的Textview和活动内的片段
- node.js - Bullmq 手动重试已完成的作业
- python - 为什么 Pandas 不能从行数据中删除未知字符?
- javascript - 如何将对象与模型对象匹配并创建缺失的属性
- python - python将.txt/list 2文件连接到一个新文件中