1/* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15namespace ts { 16export namespace Problems { 17 18export enum FaultID { 19 AnyType, SymbolType, ObjectLiteralNoContextType, ArrayLiteralNoContextType, 20 ComputedPropertyName, LiteralAsPropertyName, TypeQuery, RegexLiteral, IsOperator, 21 DestructuringParameter, YieldExpression, InterfaceMerging, EnumMerging, InterfaceExtendsClass, IndexMember, WithStatement, 22 ThrowStatement, IndexedAccessType, UnknownType, ForInStatement, InOperator, 23 ImportFromPath, FunctionExpression, IntersectionType, 24 ObjectTypeLiteral, CommaOperator, LimitedReturnTypeInference, 25 LambdaWithTypeParameters, ClassExpression, DestructuringAssignment, 26 DestructuringDeclaration, VarDeclaration, CatchWithUnsupportedType, DeleteOperator, 27 DeclWithDuplicateName, UnaryArithmNotNumber, ConstructorType, ConstructorIface, ConstructorFuncs, CallSignature, 28 TypeAssertion, PrivateIdentifier, LocalFunction, 29 ConditionalType, MappedType, NamespaceAsObject, ClassAsObject, 30 NonDeclarationInNamespace, GeneratorFunction, FunctionContainsThis, PropertyAccessByIndex, JsxElement, 31 EnumMemberNonConstInit, ImplementsClass, NoUndefinedPropAccess, MultipleStaticBlocks, ThisType, 32 IntefaceExtendDifProps, StructuralIdentity, TypeOnlyImport, TypeOnlyExport, DefaultImport, 33 ExportAssignment, ImportAssignment, 34 GenericCallNoTypeArgs, ParameterProperties, 35 InstanceofUnsupported, ShorthandAmbientModuleDecl, WildcardsInModuleName, UMDModuleDefinition, 36 NewTarget, DefiniteAssignment, Prototype, GlobalThis, 37 UtilityType, PropertyDeclOnFunction, FunctionApplyBindCall, ConstAssertion, ImportAssertion, 38 SpreadOperator, LimitedStdLibApi, ErrorSuppression, StrictDiagnostic, UnsupportedDecorators, ImportAfterStatement, 39 EsObjectType, EsObjectAssignment, EsObjectAccess, 40 LAST_ID, // this should always be last enum` 41} 42 43export class FaultAttributs { 44 migratable?: boolean; 45 warning?: boolean; 46 cookBookRef = "-1"; 47} 48 49export const faultsAttrs: FaultAttributs[] = []; 50 51faultsAttrs[FaultID.LiteralAsPropertyName] = { migratable: true, cookBookRef: "1", }; 52faultsAttrs[FaultID.ComputedPropertyName] = { cookBookRef: "1", }; 53faultsAttrs[FaultID.SymbolType] = { cookBookRef: "2", }; 54faultsAttrs[FaultID.PrivateIdentifier] = { migratable: true, cookBookRef: "3", }; 55faultsAttrs[FaultID.DeclWithDuplicateName] = { migratable: true, cookBookRef: "4", }; 56faultsAttrs[FaultID.VarDeclaration] = { migratable: true, cookBookRef: "5", }; 57faultsAttrs[FaultID.AnyType] = { cookBookRef: "8" }; 58faultsAttrs[FaultID.UnknownType] = { cookBookRef: "8", }; 59faultsAttrs[FaultID.CallSignature] = { cookBookRef: "14", }; 60faultsAttrs[FaultID.ConstructorType] = { cookBookRef: "15", }; 61faultsAttrs[FaultID.MultipleStaticBlocks] = { cookBookRef: "16", }; 62faultsAttrs[FaultID.IndexMember] = { cookBookRef: "17", }; 63faultsAttrs[FaultID.IntersectionType] = { cookBookRef: "19", }; 64faultsAttrs[FaultID.ThisType] = { cookBookRef: "21", }; 65faultsAttrs[FaultID.ConditionalType] = { cookBookRef: "22", }; 66faultsAttrs[FaultID.ParameterProperties] = { migratable: true, cookBookRef: "25", }; 67faultsAttrs[FaultID.ConstructorIface] = { cookBookRef: "27", }; 68faultsAttrs[FaultID.IndexedAccessType] = { cookBookRef: "28", }; 69faultsAttrs[FaultID.PropertyAccessByIndex] = { migratable: true, cookBookRef: "29", }; 70faultsAttrs[FaultID.StructuralIdentity] = { cookBookRef: "30", }; 71faultsAttrs[FaultID.GenericCallNoTypeArgs] = { cookBookRef: "34", }; 72faultsAttrs[FaultID.RegexLiteral] = { cookBookRef: "37", }; 73faultsAttrs[FaultID.ObjectLiteralNoContextType] = { cookBookRef: "38", }; 74faultsAttrs[FaultID.ObjectTypeLiteral] = { cookBookRef: "40", }; 75faultsAttrs[FaultID.ArrayLiteralNoContextType] = { cookBookRef: "43", }; 76faultsAttrs[FaultID.FunctionExpression] = { migratable: true, cookBookRef: "46", }; 77faultsAttrs[FaultID.LambdaWithTypeParameters] = { migratable: true, cookBookRef: "49", }; 78faultsAttrs[FaultID.ClassExpression] = { migratable: true, cookBookRef: "50", }; 79faultsAttrs[FaultID.ImplementsClass] = { cookBookRef: "51", }; 80faultsAttrs[FaultID.NoUndefinedPropAccess] = { cookBookRef: "52", }; 81faultsAttrs[FaultID.TypeAssertion] = { migratable: true, cookBookRef: "53", }; 82faultsAttrs[FaultID.JsxElement] = { cookBookRef: "54", }; 83faultsAttrs[FaultID.UnaryArithmNotNumber] = { cookBookRef: "55", }; 84faultsAttrs[FaultID.DeleteOperator] = { cookBookRef: "59", }; 85faultsAttrs[FaultID.TypeQuery] = { cookBookRef: "60", }; 86faultsAttrs[FaultID.InstanceofUnsupported] = { cookBookRef: "65", }; 87faultsAttrs[FaultID.InOperator] = { cookBookRef: "66", }; 88faultsAttrs[FaultID.DestructuringAssignment] = { migratable: true, cookBookRef: "69", }; 89faultsAttrs[FaultID.CommaOperator] = { cookBookRef: "71", }; 90faultsAttrs[FaultID.DestructuringDeclaration] = { migratable: true, cookBookRef: "74", }; 91faultsAttrs[FaultID.CatchWithUnsupportedType] = { migratable: true, cookBookRef: "79", }; 92faultsAttrs[FaultID.ForInStatement] = { cookBookRef: "80", }; 93faultsAttrs[FaultID.MappedType] = { cookBookRef: "83", }; 94faultsAttrs[FaultID.WithStatement] = { cookBookRef: "84", }; 95faultsAttrs[FaultID.ThrowStatement] = { migratable: true, cookBookRef: "87", }; 96faultsAttrs[FaultID.LimitedReturnTypeInference] = { migratable: true, cookBookRef: "90", }; 97faultsAttrs[FaultID.DestructuringParameter] = { cookBookRef: "91", }; 98faultsAttrs[FaultID.LocalFunction] = { migratable: true, cookBookRef: "92", }; 99faultsAttrs[FaultID.FunctionContainsThis] = { cookBookRef: "93", }; 100faultsAttrs[FaultID.GeneratorFunction] = { cookBookRef: "94", }; 101faultsAttrs[FaultID.YieldExpression] = { cookBookRef: "94", }; 102faultsAttrs[FaultID.IsOperator] = { cookBookRef: "96", }; 103faultsAttrs[FaultID.SpreadOperator] = { cookBookRef: "99", }; 104faultsAttrs[FaultID.IntefaceExtendDifProps] = { cookBookRef: "102", }; 105faultsAttrs[FaultID.InterfaceMerging] = { cookBookRef: "103", }; 106faultsAttrs[FaultID.InterfaceExtendsClass] = { cookBookRef: "104", }; 107faultsAttrs[FaultID.ConstructorFuncs] = { cookBookRef: "106", }; 108faultsAttrs[FaultID.EnumMemberNonConstInit] = { cookBookRef: "111", }; 109faultsAttrs[FaultID.EnumMerging] = { cookBookRef: "113", }; 110faultsAttrs[FaultID.NamespaceAsObject] = { cookBookRef: "114", }; 111faultsAttrs[FaultID.NonDeclarationInNamespace] = { cookBookRef: "116", }; 112faultsAttrs[FaultID.ImportFromPath] = { cookBookRef: "119", }; 113faultsAttrs[FaultID.TypeOnlyImport] = { migratable: true, cookBookRef: "118", }; 114faultsAttrs[FaultID.DefaultImport] = { migratable: true, cookBookRef: "120", }; 115faultsAttrs[FaultID.ImportAssignment] = { cookBookRef: "121", }; 116faultsAttrs[FaultID.ExportAssignment] = { cookBookRef: "126", }; 117faultsAttrs[FaultID.TypeOnlyExport] = { migratable: true, cookBookRef: "127", }; 118faultsAttrs[FaultID.ShorthandAmbientModuleDecl] = { cookBookRef: "128", }; 119faultsAttrs[FaultID.WildcardsInModuleName] = { cookBookRef: "129", }; 120faultsAttrs[FaultID.UMDModuleDefinition] = { cookBookRef: "130", }; 121faultsAttrs[FaultID.NewTarget] = { cookBookRef: "132", }; 122faultsAttrs[FaultID.DefiniteAssignment] = { warning: true, cookBookRef: "134", }; 123faultsAttrs[FaultID.Prototype] = { cookBookRef: "136", }; 124faultsAttrs[FaultID.GlobalThis] = { cookBookRef: "137", }; 125faultsAttrs[FaultID.UtilityType] = { cookBookRef: "138", }; 126faultsAttrs[FaultID.PropertyDeclOnFunction] = { cookBookRef: "139", }; 127faultsAttrs[FaultID.FunctionApplyBindCall] = { cookBookRef: "140", }; 128faultsAttrs[FaultID.ConstAssertion] = { cookBookRef: "142", }; 129faultsAttrs[FaultID.ImportAssertion] = { cookBookRef: "143", }; 130faultsAttrs[FaultID.LimitedStdLibApi] = { cookBookRef: "144", }; 131faultsAttrs[FaultID.StrictDiagnostic] = { cookBookRef: "145", }; 132faultsAttrs[FaultID.ErrorSuppression] = { cookBookRef: "146", }; 133faultsAttrs[FaultID.UnsupportedDecorators] = { warning: true, cookBookRef: "148", }; 134faultsAttrs[FaultID.ClassAsObject] = { cookBookRef: "149", }; 135faultsAttrs[FaultID.ImportAfterStatement] = { cookBookRef: "150", }; 136faultsAttrs[FaultID.EsObjectType] = { warning: true, cookBookRef: "8" }; 137faultsAttrs[FaultID.EsObjectAssignment] = { warning: true, cookBookRef: "8" }; 138faultsAttrs[FaultID.EsObjectAccess] = { warning: true, cookBookRef: "8" }; 139} 140}