content icon indicating copy to clipboard operation
content copied to clipboard

Invalid assignment LHS can be a ReferenceError

Open Josh-Cena opened this issue 3 years ago • 2 comments

Description

Some more error cases, and a more complete description of its type.

Motivation

Additional details

Related issues and pull requests

Josh-Cena avatar Sep 09 '22 21:09 Josh-Cena

Preview URLs

(comment last updated: 2023-02-21 01:40:25)

github-actions[bot] avatar Sep 09 '22 21:09 github-actions[bot]

I would prefer to keep them on the same page, as the two error messages are tightly connected. Also consider the fact that in strict mode, Firefox also throws a syntax error:

(() => {
  "use strict";
  function foo() {
    return { a: 1 };
  }
  foo() = 1; // SyntaxError: invalid assignment left-hand side
})();

(() => {
  function foo() {
    return { a: 1 };
  }
  foo() = 1; // ReferenceError: cannot assign to function call
})();

Pinging @Elchi3 in case there's some more insight from the Mozilla team?

Josh-Cena avatar Nov 05 '22 18:11 Josh-Cena

This pull request has merge conflicts that must be resolved before it can be merged.

github-actions[bot] avatar Feb 01 '23 01:02 github-actions[bot]

This pull request has merge conflicts that must be resolved before it can be merged.

github-actions[bot] avatar Feb 21 '23 01:02 github-actions[bot]

Pinging @Elchi3 in case there's some more insight from the Mozilla team?

I'm not sure if the Firefox Developer Tools team still cares so much about links from error messages. It was a project back when I was at Mozilla. I wrote a blog post about it in 2016: https://hacks.mozilla.org/2016/06/helping-web-developers-with-javascript-errors/

I think this PR can be merged as is. We can have a separate discussion about the general usefulness of this set of docs, though. Maybe we want to make larger changes and if so we could try to find out if and how Firefox still links to MDN (and avoid breaking it, I remember how this helped a lot of people back in the day. We saw a big spike in the MDN traffic numbers for people coming from Firefox developer tools).

Elchi3 avatar Feb 23 '23 16:02 Elchi3