TSLint:关于现有规则的自定义错误消息

时间:2020-11-03 14:45:43

标签: angular typescript eslint 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>.

是否有可能?以及如何做到这一点?

谢谢!

0 个答案:

没有答案