question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should throw on invaid `(a = 1) = t`

See original GitHub issue

This should be invalid.

require("espree").parse('(a = 1) = 2', {sourceType: 'module', ecmaVersion: 2019}).body[0].expression
Node {
  type: 'AssignmentExpression',
  start: 0,
  end: 11,
  operator: '=',
  left: Node {
    type: 'AssignmentPattern',
    start: 1,
    end: 6,
    left: Node { type: 'Identifier', start: 1, end: 2, name: 'a' },
    right: Node { type: 'Literal', start: 5, end: 6, value: 1, raw: '1' }
  },
  right: Node { type: 'Literal', start: 10, end: 11, value: 2, raw: '2' }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Feb 26, 2021

I think this is the same as https://github.com/acornjs/acorn/issues/886 which has been fixed by https://github.com/acornjs/acorn/commit/1d5b531b9178aa6c84c346a8d7ed381c17e9a820 and released in Acorn 8.0.0.

We’ll update Acorn dependency in the next Espree major version (#456).

1reaction
aladdin-addcommented, Feb 26, 2021

as it’s also a bug in espree, I suggest to keep it open to track it.

we can close it when the issue was fixed in acorn, and espree update its dependency acorn.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What exceptions should be thrown for invalid or unexpected ...
The trick is to throw the exception that best expresses why the method cannot be called the way it is. Ideally, the exception...
Read more >
Creating and Throwing Exceptions | Microsoft Learn
Programmers should throw exceptions when one or more of the following conditions are true: The method can't complete its defined ...
Read more >
throw - JavaScript - MDN Web Docs - Mozilla
The throw statement throws a user-defined exception. Execution of the current function will stop (the statements after throw won't be ...
Read more >
Should a getter throw an exception if its object has invalid state?
It seems a good idea, doesn't it? I can add a exception-raising code to getCompleteName method. But in this way I'm violating an...
Read more >
Throwing ArgumentException and InvalidOperationException
When the exception is raised, it cancels the withdraw transaction and ... and should be thrown when a method argument receives an invalid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found