mozilla / scanjs

[DEPRECATED] Static analysis tool for javascript code.
Other
429 stars 39 forks source link

Sources Rules a='b'; #175

Closed amotmot closed 9 years ago

amotmot commented 9 years ago

foo.bar.flag = "0"; foo.bar.flag = "1";

The following rule matches both above cases $_any.flag = "0"

ScanJS results in Experiment Tab: http://imgur.com/88omUeW

Is it possible to write a rule that checks if a variable is set to a particular value? I'm trying to create a rule that checks to see if a variable is set to false or true in numeric equivalents as strings .

mozfreddyb commented 9 years ago

Maybe using https://github.com/eslint/eslint with a custom rule as a plugin is more interesting to you?

amotmot commented 9 years ago

@mozfreddyb thanks. I'll look into writing a custom rule with eslint.