Skip to content

Commit

Permalink
Refine LetInLexicalBinding error message (#15910)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Aug 31, 2023
1 parent 2ce1d11 commit 8ba5c67
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions packages/babel-parser/src/parse-error/standard-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ export default {
InvalidRestAssignmentPattern: "Invalid rest operator's argument.",
LabelRedeclaration: ({ labelName }: { labelName: string }) =>
`Label '${labelName}' is already declared.`,
LetInLexicalBinding:
"'let' is not allowed to be used as a name in 'let' or 'const' declarations.",
LetInLexicalBinding: "'let' is disallowed as a lexically bound name.",
LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
MalformedRegExpFlags: "Invalid regular expression flag.",
MissingClassName: "A class name is required.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":17,"index":17}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:6)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":22,"index":22}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:7)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:7)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":18,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":18,"index":18}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:8)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":20,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":20,"index":20}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:10)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:10)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":19,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":19,"index":19}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:8)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":15,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":15,"index":15}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:5)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:5)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":17,"index":17}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:7)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:7)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":7,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":7,"index":7}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:4)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:4)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":14,"index":14}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:6)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":22,"index":22}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:6)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":24,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":24,"index":24}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:8)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":20,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":20,"index":20}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:5)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (1:5)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":33,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":33}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (2:6)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (2:6)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":47,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":47}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (2:14)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (2:14)"
],
"program": {
"type": "Program",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":3,"column":1,"index":22}},
"errors": [
"SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (2:8)"
"SyntaxError: 'let' is disallowed as a lexically bound name. (2:8)"
],
"program": {
"type": "Program",
Expand Down

0 comments on commit 8ba5c67

Please sign in to comment.