Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update UnexpectedPrivateField error message #13975

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/babel-parser/src/parser/error-message.js
Expand Up @@ -213,8 +213,7 @@ export const ErrorMessages = makeErrorTemplates(
"`new.target` can only be used in functions or class properties.",
UnexpectedNumericSeparator:
"A numeric separator is only allowed between two digits.",
UnexpectedPrivateField:
"Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p).",
UnexpectedPrivateField: "Unexpected private name.",
UnexpectedReservedWord: "Unexpected reserved word '%0'.",
UnexpectedSuper: "'super' is only allowed in object methods and classes.",
UnexpectedToken: "Unexpected token '%0'.",
Expand Down
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (3:11)"
"SyntaxError: Unexpected private name. (3:11)"
],
"program": {
"type": "Program",
Expand Down Expand Up @@ -107,4 +107,4 @@
],
"directives": []
}
}
}
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
"errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (4:12)"
"SyntaxError: Unexpected private name. (4:12)"
],
"program": {
"type": "Program",
Expand Down Expand Up @@ -116,4 +116,4 @@
],
"directives": []
}
}
}
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:11)"
"SyntaxError: Unexpected private name. (2:11)"
],
"program": {
"type": "Program",
Expand Down Expand Up @@ -78,4 +78,4 @@
],
"directives": []
}
}
}
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:11)"
"SyntaxError: Unexpected private name. (2:11)"
],
"program": {
"type": "Program",
Expand Down Expand Up @@ -77,4 +77,4 @@
],
"directives": []
}
}
}
Expand Up @@ -2,7 +2,7 @@
"type": "File",
"start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [
"SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:3)"
"SyntaxError: Unexpected private name. (2:3)"
],
"program": {
"type": "Program",
Expand Down Expand Up @@ -49,4 +49,4 @@
],
"directives": []
}
}
}