From beb7cf8b24029a31fbadb148d5176ed84bb7a2e1 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Fri, 19 Mar 2021 05:01:57 +0900 Subject: [PATCH] Sort error keys with ESLint (#13020) --- packages/babel-parser/src/plugins/jsx/index.js | 4 +++- packages/babel-parser/src/plugins/typescript/index.js | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/babel-parser/src/plugins/jsx/index.js b/packages/babel-parser/src/plugins/jsx/index.js index a5ac5e90eafd..f8b6a3dd888b 100644 --- a/packages/babel-parser/src/plugins/jsx/index.js +++ b/packages/babel-parser/src/plugins/jsx/index.js @@ -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: @@ -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. diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 474a29c0dce7..b0e72093ab98 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -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.", @@ -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.", @@ -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.", @@ -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.