angular - TSLint:现有规则的自定义错误消息
问题描述
我想使用 ts-lint 的no-console规则,并带有一些自定义错误消息。
这个想法是为开发人员提供更加用户友好的输出,并让他们使用我们的工具进行日志记录,而不是控制台。
而不是这样的
> npm run lint
ERROR: src/app/app.component.ts:84:5 - Calls to 'console.info' are not allowed.
我希望有这个
> npm run lint
ERROR: src/app/app.component.ts:84:5 - Calls to 'console.info' are not allowed.
You should only use console.log for local development, and you have probably forgotten
to remove this line.
If you want to have logs on production or preproduction, please use instead the
`Logger` class. To know more about this Logger, please refer to this documentation <link>.
知道是否可能吗?以及如何做到这一点?
谢谢 !
解决方案
推荐阅读
- javascript - 此 Web3.js 调用没有结果
- react-native - 将 curl 语句更改为 axios
- python - Pandas Plot,从高到低排列条形图,并分别为各个条形图着色
- c++ - "(char*)&" 魔法是如何工作的?
- java - Java 中的 Snake 没有正确构建或增长
- php - symfony 中带有域名的 URL
- php - 带有命令的 PHP shell_exec 的行为方式与通过终端执行时不同
- python - 如何反转 Sklearn `plot_confusion_matrix` 函数中的混淆矩阵?
- python - Python中的Spacy正则表达式短语匹配器
- algorithm - 时间复杂度为 O(nlogk)