jshint - 创建自定义警告/规则 [英] jshint - Create custom warnings/rules

查看:152
本文介绍了jshint - 创建自定义警告/规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以创建自定义jshint规则,将其添加到现有的内置规则,在项目中配置(打开或关闭)?

Is it possible to create a custom jshint rule, add it to existing inbuilt rules, configure it (on or off) in our projects?

jshint是否可扩展,比如我们如何在Grunt中创建自己的自定义任务?

Is jshint extendable, like how we create our own custom tasks in Grunt?

有时我们需要在我们的环境中强制执行javascript编码练习。例如,我们希望强制我们的开发人员使用Date.now()而不是Date.getTime()。

Sometimes we need to enforce a javascript coding practice just in our environment. For example, we want to enforce our developers to use Date.now() instead of Date.getTime().

推荐答案

你在这种情况下应该考虑使用 ESLint

You should consider using ESLint in that case.

每条规则都是独立。 甚至是默认规则。因此,您可以将其中一个默认规则作为蓝图,并编写自己的规则。

Every rule is standalone. Even the default rules. So you could take one of the default rules as a blueprint, and write your own.

这篇关于jshint - 创建自定义警告/规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆