Sort error keys with ESLint (#13020)

This commit is contained in:
Sosuke Suzuki 2021-03-19 05:01:57 +09:00 committed by GitHub
parent 21e8e59f7d
commit beb7cf8b24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -19,11 +19,12 @@ import { Errors } from "../../parser/error";
const HEX_NUMBER = /^[\da-fA-F]+$/; const HEX_NUMBER = /^[\da-fA-F]+$/;
const DECIMAL_NUMBER = /^\d+$/; const DECIMAL_NUMBER = /^\d+$/;
/* eslint sort-keys: "error" */
const JsxErrors = Object.freeze({ const JsxErrors = Object.freeze({
AttributeIsEmpty: AttributeIsEmpty:
"JSX attributes must only be assigned a non-empty expression", "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>", MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>",
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>",
UnexpectedSequenceExpression: UnexpectedSequenceExpression:
"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?", "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
UnsupportedJsxValue: UnsupportedJsxValue:
@ -32,6 +33,7 @@ const JsxErrors = Object.freeze({
UnwrappedAdjacentJSXElements: UnwrappedAdjacentJSXElements:
"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?", "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. // Be aware that this file is always executed and not only when the plugin is enabled.
// Therefore this contexts and tokens do always exist. // Therefore this contexts and tokens do always exist.

View File

@ -59,6 +59,7 @@ type ParsingContext =
| "TypeMembers" | "TypeMembers"
| "TypeParametersOrArguments"; | "TypeParametersOrArguments";
/* eslint sort-keys: "error" */
const TSErrors = Object.freeze({ const TSErrors = Object.freeze({
AbstractMethodHasImplementation: AbstractMethodHasImplementation:
"Method '%0' cannot have an implementation because it is marked abstract.", "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.", "Initializers are not allowed in ambient contexts.",
DeclareFunctionHasImplementation: DeclareFunctionHasImplementation:
"An implementation cannot be declared in ambient contexts.", "An implementation cannot be declared in ambient contexts.",
DuplicateModifier: "Duplicate modifier: '%0'",
DuplicateAccessibilityModifier: "Accessibility modifier already seen.", DuplicateAccessibilityModifier: "Accessibility modifier already seen.",
DuplicateModifier: "Duplicate modifier: '%0'",
EmptyHeritageClauseType: "'%0' list cannot be empty.", EmptyHeritageClauseType: "'%0' list cannot be empty.",
EmptyTypeArguments: "Type argument list cannot be empty.", EmptyTypeArguments: "Type argument list cannot be empty.",
EmptyTypeParameters: "Type parameter 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", "Index signatures cannot have the 'abstract' modifier",
IndexSignatureHasAccessibility: IndexSignatureHasAccessibility:
"Index signatures cannot have an accessibility modifier ('%0')", "Index signatures cannot have an accessibility modifier ('%0')",
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier",
IndexSignatureHasDeclare: IndexSignatureHasDeclare:
"Index signatures cannot have the 'declare' modifier", "Index signatures cannot have the 'declare' modifier",
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier",
InvalidModifierOnTypeMember: "'%0' modifier cannot appear on a type member.", InvalidModifierOnTypeMember: "'%0' modifier cannot appear on a type member.",
InvalidTupleMemberLabel: InvalidTupleMemberLabel:
"Tuple members must be labeled with a simple identifier.", "Tuple members must be labeled with a simple identifier.",
@ -119,6 +120,7 @@ const TSErrors = Object.freeze({
UnsupportedSignatureParameterKind: UnsupportedSignatureParameterKind:
"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got %0", "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. // 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. // It also doesn't handle "intrinsic", since usually it's not a keyword.