Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jshint - Create custom warnings/rules

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

like image 645
Vijey Avatar asked Feb 17 '14 05:02

Vijey


2 Answers

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.

like image 91
DerZyklop Avatar answered Nov 20 '22 12:11

DerZyklop


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

like image 4
Mykle Hansen Avatar answered Nov 20 '22 12:11

Mykle Hansen