jshint - Create custom warnings/rules

给你一囗甜甜゛ 提交于 2019-12-08 17:03:42

问题


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

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

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().


回答1:


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.




回答2:


There's some vague reference to how to do this in the jshint-next project on GitHub, which was apparently merged back into jshint proper at some point.

https://github.com/jshint/jshint-next/wiki/Design



来源:https://stackoverflow.com/questions/21821528/jshint-create-custom-warnings-rules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!