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

babel-parser: Sort error keys with ESLint #13020

Merged
merged 1 commit into from Mar 18, 2021
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
4 changes: 3 additions & 1 deletion packages/babel-parser/src/plugins/jsx/index.js
Expand Up @@ -19,11 +19,12 @@ import { Errors } from "../../parser/error";
const HEX_NUMBER = /^[\da-fA-F]+$/;
const DECIMAL_NUMBER = /^\d+$/;

/* eslint sort-keys: "error" */
const JsxErrors = Object.freeze({
AttributeIsEmpty:
"JSX attributes must only be assigned a non-empty expression",
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>",
MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>",
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>",
UnexpectedSequenceExpression:
"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
UnsupportedJsxValue:
Expand All @@ -32,6 +33,7 @@ const JsxErrors = Object.freeze({
UnwrappedAdjacentJSXElements:
"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?",
});
/* eslint-disable sort-keys */

// Be aware that this file is always executed and not only when the plugin is enabled.
// Therefore this contexts and tokens do always exist.
Expand Down
6 changes: 4 additions & 2 deletions packages/babel-parser/src/plugins/typescript/index.js
Expand Up @@ -59,6 +59,7 @@ type ParsingContext =
| "TypeMembers"
| "TypeParametersOrArguments";

/* eslint sort-keys: "error" */
const TSErrors = Object.freeze({
AbstractMethodHasImplementation:
"Method '%0' cannot have an implementation because it is marked abstract.",
Expand All @@ -70,8 +71,8 @@ const TSErrors = Object.freeze({
"Initializers are not allowed in ambient contexts.",
DeclareFunctionHasImplementation:
"An implementation cannot be declared in ambient contexts.",
DuplicateModifier: "Duplicate modifier: '%0'",
DuplicateAccessibilityModifier: "Accessibility modifier already seen.",
DuplicateModifier: "Duplicate modifier: '%0'",
EmptyHeritageClauseType: "'%0' list cannot be empty.",
EmptyTypeArguments: "Type argument list cannot be empty.",
EmptyTypeParameters: "Type parameter list cannot be empty.",
Expand All @@ -82,9 +83,9 @@ const TSErrors = Object.freeze({
"Index signatures cannot have the 'abstract' modifier",
IndexSignatureHasAccessibility:
"Index signatures cannot have an accessibility modifier ('%0')",
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier",
IndexSignatureHasDeclare:
"Index signatures cannot have the 'declare' modifier",
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier",
InvalidModifierOnTypeMember: "'%0' modifier cannot appear on a type member.",
InvalidTupleMemberLabel:
"Tuple members must be labeled with a simple identifier.",
Expand Down Expand Up @@ -119,6 +120,7 @@ const TSErrors = Object.freeze({
UnsupportedSignatureParameterKind:
"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got %0",
});
/* eslint-disable sort-keys */

// Doesn't handle "void" or "null" because those are keywords, not identifiers.
// It also doesn't handle "intrinsic", since usually it's not a keyword.
Expand Down