1

I know of JSLint/JSHint, but are there JavaScript static analysis tools geared towards error checking rather the syntactical error?

For example:

new Date(2001, 12, 31) This is generally an error, since month in Date constructor is designed to take 0 to 11

f.apply(arguments) This is generally an error since the first argument of apply is this context rather than arguments.

function One(x) { return 1; } One(1, 2); This is generally an error since you are calling a function with known signature of 1 argument with 2 arguments.

I know what I mentioned are not deterministic, but a lot of the more useful static analysis tools in other languages are not deterministic either. They give confidence rating on the potential error.

voidvector
  • 1,976
  • 2
  • 18
  • 19
  • check https://github.com/eslint/eslint , you can define your own rules. – mpm May 13 '14 at 13:31
  • Check [DeepScan](https://deepscan.io/) (I develop it). It targets to detect possible runtime errors rather than coding convention. For example, it can check [too many arguments](https://deepscan.io/docs/rules/too-many-args) as you mentioned. Try it via your GitHub or in its [Demo](https://deepscan.io/demo/) page. – Kangho Kim Feb 15 '19 at 08:40

0 Answers0