JavaScript Debugger – A tool that explains JavaScript errors in plain English

1 pointsposted 12 hours ago
by adham_monged

Item id: 46427029

1 Comments

genezeta

3 hours ago

I'm sorry to be so blunt but this seems almost useless.

I just tried something like...

  let someArray = [
    "one",
    "two",
    "three"
  ];
...and it warns that it's missing semicolons on all those lines -except for the last one, obviously-. And the fix is...

  Your code:
  let someArray = [
  Fix:
  let someArray = [; 
But then I tried something with an actual syntax error.

It says...

  Syntax Error
  Line 1
  ERROR
  JavaScript cannot read this line because something is typed wrong.
...which doesn't seem very helpful, not even pointing where in the line the error lies (which acorn does tell you). So I open the dropdown to see the explanation and fixes. The explanation is...

  The code breaks basic JavaScript rules.
...and the suggested fixes are...

  Fix the typo. Look for missing or extra symbols like ), }, ], or ;.
So I wonder, what does this actually say beyond the original "syntax error"? How is it helpful at all?

Also, looking at the code I find all sort of failing rules which just don't work.

"Assignment in condition":

This will show a warning, while being perfectly fine:

  if (flag) a = null;
This will not show a warning at all:

  if (a = 2) b = 3;
Then there's the rules for unused variables and for undeclared variables. Those simply do not work at all. They never find anything. It looks like you're expecting acorn to modify your code so that you can later go through it line by line but it just doesn't work that way.