From ea74ee0748ef3ee0a3298ca8e191ba10529cb68e Mon Sep 17 00:00:00 2001 From: Konstantin Baladurin Date: Tue, 5 Sep 2023 03:13:49 +0300 Subject: [PATCH] linter: introduce checks for ESObject usage - Allow to use ESObject only as a type of local variables - Forbid to operators ".", "[]" and "()" - Forbid casts to ESObject - Forbid implicit casts from ESObject - Forbid using ESObject as type argument - Forbid inheritance from ESObject Signed-off-by: Konstantin Baladurin --- linter-4.2/src/Problems.ts | 4 + linter-4.2/src/TypeScriptLinter.ts | 58 +++ linter-4.2/src/TypeScriptLinterConfig.ts | 3 + linter-4.2/src/Utils.ts | 59 ++- linter-4.2/test/es_object.ts | 174 +++++++ linter-4.2/test/es_object.ts.autofix.skip | 0 linter-4.2/test/es_object.ts.relax.json | 606 ++++++++++++++++++++++ linter-4.2/test/es_object.ts.strict.json | 606 ++++++++++++++++++++++ linter/src/FaultAttrs.ts | 3 + linter/src/FaultDesc.ts | 3 + linter/src/Problems.ts | 1 + linter/src/TypeScriptLinter.ts | 59 ++- linter/src/utils/TsUtils.ts | 58 ++- linter/src/utils/consts/ESObject.ts | 16 + linter/test/es_object.ts | 174 +++++++ linter/test/es_object.ts.autofix.skip | 0 linter/test/es_object.ts.relax.json | 606 ++++++++++++++++++++++ linter/test/es_object.ts.strict.json | 606 ++++++++++++++++++++++ 18 files changed, 3033 insertions(+), 3 deletions(-) create mode 100644 linter-4.2/test/es_object.ts create mode 100644 linter-4.2/test/es_object.ts.autofix.skip create mode 100644 linter-4.2/test/es_object.ts.relax.json create mode 100644 linter-4.2/test/es_object.ts.strict.json create mode 100644 linter/src/utils/consts/ESObject.ts create mode 100644 linter/test/es_object.ts create mode 100644 linter/test/es_object.ts.autofix.skip create mode 100644 linter/test/es_object.ts.relax.json create mode 100644 linter/test/es_object.ts.strict.json diff --git a/linter-4.2/src/Problems.ts b/linter-4.2/src/Problems.ts index 9a1bcd8fc..4cca65179 100644 --- a/linter-4.2/src/Problems.ts +++ b/linter-4.2/src/Problems.ts @@ -34,6 +34,7 @@ export enum FaultID { JSExtensionInModuleIdent, NewTarget, DynamicImport, DefiniteAssignment, IifeAsNamespace, Prototype, GlobalThis, UtilityType, PropertyDeclOnFunction, FunctionApplyBindCall, ReadonlyArr, ConstAssertion, ImportAssertion, SpreadOperator, LimitedStdLibApi, ErrorSuppression, StrictDiagnostic, UnsupportedDecorators, ImportAfterStatement, + EsObjectType, EsObjectAssignment, EsObjectAccess, LAST_ID, // this should always be last enum` } @@ -144,3 +145,6 @@ faultsAttrs[FaultID.StrictDiagnostic] = {cookBookRef: '145',}; faultsAttrs[FaultID.ErrorSuppression] = {cookBookRef: '146',}; faultsAttrs[FaultID.UnsupportedDecorators] = {cookBookRef: '148',}; faultsAttrs[FaultID.ImportAfterStatement] = {cookBookRef: '-1',}; +faultsAttrs[FaultID.EsObjectType] = {cookBookRef: '8'}; +faultsAttrs[FaultID.EsObjectAssignment] = {cookBookRef: '8'}; +faultsAttrs[FaultID.EsObjectAccess] = {cookBookRef: '8'}; \ No newline at end of file diff --git a/linter-4.2/src/TypeScriptLinter.ts b/linter-4.2/src/TypeScriptLinter.ts index d7622bcc4..be743e9b4 100644 --- a/linter-4.2/src/TypeScriptLinter.ts +++ b/linter-4.2/src/TypeScriptLinter.ts @@ -136,6 +136,7 @@ export class TypeScriptLinter { [ts.SyntaxKind.GetAccessor, this.handleGetAccessor], [ts.SyntaxKind.SetAccessor, this.handleSetAccessor], [ts.SyntaxKind.ConstructSignature, this.handleConstructSignature], + [ts.SyntaxKind.ExpressionWithTypeArguments, this.handleExpressionWithTypeArguments], ]); public incrementCounters( @@ -789,6 +790,10 @@ export class TypeScriptLinter { if (!!symbol && this.tsUtils.isSymbolAPI(symbol)) { this.incrementCounters(node, FaultID.SymbolType); } + + if (this.tsUtils.hasEsObjectType(propertyAccessNode.expression)) { + this.incrementCounters(node, FaultID.EsObjectAccess); + } } private handlePropertyAssignmentOrDeclaration(node: ts.Node) { @@ -1246,6 +1251,11 @@ export class TypeScriptLinter { ) ) this.incrementCounters(tsBinaryExpr, FaultID.StructuralIdentity); + + const typeNode = this.tsUtils.getVariableDeclarationTypeNode(tsLhsExpr); + if (!!typeNode) { + this.handleEsObjectAssignment(tsBinaryExpr, typeNode, tsRhsExpr); + } } } @@ -1295,12 +1305,41 @@ export class TypeScriptLinter { !this.tsUtils.relatedByInheritanceOrIdentical(tsInitType, tsVarType) ) this.incrementCounters(tsVarDecl, FaultID.StructuralIdentity); + + this.handleEsObjectAssignment(tsVarDecl, tsVarDecl.type, tsVarInit); } this.handleDeclarationInferredType(tsVarDecl); this.handleDefiniteAssignmentAssertion(tsVarDecl); } + private handleEsObjectAssignment(node: ts.Node, type: ts.TypeNode, value: ts.Node) { + if (!this.tsUtils.isEsObjectType(type)) { + let valueTypeNode = this.tsUtils.getVariableDeclarationTypeNode(value); + if (!!valueTypeNode && this.tsUtils.isEsObjectType(valueTypeNode)) { + this.incrementCounters(node, FaultID.EsObjectAssignment); + } + + return + } + + if (ts.isArrayLiteralExpression(value) || ts.isObjectLiteralExpression(value)) { + this.incrementCounters(node, FaultID.EsObjectAssignment); + return; + } + + const valueType = this.tsTypeChecker.getTypeAtLocation(value); + if (this.tsUtils.isUnsupportedType(valueType)) { + return; + } + + if (this.tsUtils.isAnonymousType(valueType)) { + return; + } + + this.incrementCounters(node, FaultID.EsObjectAssignment); + } + private handleCatchClause(node: ts.Node) { let tsCatch = node as ts.CatchClause; // In TS catch clause doesn't permit specification of the exception varible type except 'any' or 'unknown'. @@ -1753,6 +1792,10 @@ export class TypeScriptLinter { autofix ); } + + if (this.tsUtils.hasEsObjectType(tsElementAccessExpr.expression)) { + this.incrementCounters(node, FaultID.EsObjectAccess); + } } private handleEnumMember(node: ts.Node) { @@ -1827,6 +1870,10 @@ export class TypeScriptLinter { this.handleGenericCallWithNoTypeArgs(tsCallExpr); this.handleStructIdentAndUndefinedInArgs(tsCallExpr); this.handleStdlibAPICall(tsCallExpr); + + if (this.tsUtils.hasEsObjectType(tsCallExpr.expression)) { + this.incrementCounters(node, FaultID.EsObjectAccess); + } } private handleImportCall(tsCallExpr: ts.CallExpression) { @@ -2035,6 +2082,9 @@ export class TypeScriptLinter { TsUtils.LIMITED_STANDARD_UTILITY_TYPES.includes(typeRef.typeName.text) ) this.incrementCounters(node, FaultID.UtilityType); + else if (this.tsUtils.isEsObjectType(typeRef) && !this.tsUtils.isEsObjectAllowed(typeRef)) { + this.incrementCounters(node, FaultID.EsObjectType); + } else if ( ts.isIdentifier(typeRef.typeName) && typeRef.typeName.text === "Partial" && @@ -2138,6 +2188,14 @@ export class TypeScriptLinter { } } + private handleExpressionWithTypeArguments(node: ts.Node) { + let tsTypeExpr = node as ts.ExpressionWithTypeArguments; + let symbol = this.tsTypeChecker.getSymbolAtLocation(tsTypeExpr.expression); + if (!!symbol && this.tsUtils.isEsObjectSymbol(symbol)) { + this.incrementCounters(tsTypeExpr, FaultID.EsObjectType); + } + } + private checkErrorSuppressingAnnotation( comment: ts.CommentRange, srcText: string diff --git a/linter-4.2/src/TypeScriptLinterConfig.ts b/linter-4.2/src/TypeScriptLinterConfig.ts index 9482de3dd..b501e803b 100644 --- a/linter-4.2/src/TypeScriptLinterConfig.ts +++ b/linter-4.2/src/TypeScriptLinterConfig.ts @@ -131,6 +131,9 @@ export class LinterConfig { LinterConfig.nodeDesc[FaultID.StrictDiagnostic] = 'Strict diagnostic'; LinterConfig.nodeDesc[FaultID.UnsupportedDecorators] = 'Unsupported decorators'; LinterConfig.nodeDesc[FaultID.ImportAfterStatement] = 'Import declaration after other declaration or statement'; + LinterConfig.nodeDesc[FaultID.EsObjectType] = '"ESObject" type'; + LinterConfig.nodeDesc[FaultID.EsObjectAssignment] = '"ESObject" type assignment'; + LinterConfig.nodeDesc[FaultID.EsObjectAccess] = '"ESObject" access'; LinterConfig.initTsSyntaxKindNames(); } diff --git a/linter-4.2/src/Utils.ts b/linter-4.2/src/Utils.ts index 2ca1cdc8a..cb7acce1b 100644 --- a/linter-4.2/src/Utils.ts +++ b/linter-4.2/src/Utils.ts @@ -91,6 +91,8 @@ export class TsUtils { ts.SyntaxKind.TryStatement,ts.SyntaxKind.DebuggerStatement, ]; + static ES_OBJECT = 'ESObject' + static LIMITED_STD_GLOBAL_FUNC = [ 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', /* 'encodeURI', */ /* 'encodeURIComponent', */ 'Encode', /* 'decodeURI', */ /* 'decodeURIComponent', */ 'Decode', /* 'escape', */ /* 'unescape', */ 'ParseHexOctet' @@ -449,7 +451,7 @@ export class TsUtils { return null; } - private isVarDeclaration(tsDecl: ts.Declaration): boolean { + private isVarDeclaration(tsDecl: ts.Node): boolean { return ts.isVariableDeclaration(tsDecl) && ts.isVariableDeclarationList(tsDecl.parent); } @@ -1153,4 +1155,59 @@ export class TsUtils { return false; } + + public isEsObjectType(typeNode: ts.TypeNode): boolean { + return ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName) && + typeNode.typeName.text == TsUtils.ES_OBJECT; + } + + public isEsObjectAllowed(typeRef: ts.TypeReferenceNode): boolean { + let node = typeRef.parent; + + if (!this.isVarDeclaration(node)) { + return false; + } + + while (node) { + if (ts.isBlock(node)) { + return true; + } + node = node.parent; + } + return false; + } + + public getVariableDeclarationTypeNode(node: ts.Node): ts.TypeNode | undefined { + const symbol = this.tsTypeChecker.getSymbolAtLocation(node); + const decl = this.getDeclaration(symbol); + if (!!decl && ts.isVariableDeclaration(decl)) { + return decl.type; + } + return undefined; + } + + public hasEsObjectType(node: ts.Node): boolean { + const typeNode = this.getVariableDeclarationTypeNode(node) + return typeNode !== undefined && this.isEsObjectType(typeNode); + } + + public isEsObjectSymbol(sym: ts.Symbol): boolean { + let decl = this.getDeclaration(sym); + return !!decl && ts.isTypeAliasDeclaration(decl) && decl.name.escapedText == TsUtils.ES_OBJECT && + decl.type.kind == ts.SyntaxKind.AnyKeyword; + } + + public isAnonymousType(type: ts.Type): boolean { + if (type.isUnionOrIntersection()) { + for (let compType of type.types) { + if (this.isAnonymousType(compType)) { + return true; + } + } + return false; + } + + return (type.flags & ts.TypeFlags.Object) !== 0 && + ((type as ts.ObjectType).objectFlags & ts.ObjectFlags.Anonymous) !== 0; + } } diff --git a/linter-4.2/test/es_object.ts b/linter-4.2/test/es_object.ts new file mode 100644 index 000000000..76d6dc684 --- /dev/null +++ b/linter-4.2/test/es_object.ts @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +type ESObject = any + +class A {} + +let g1: ESObject +let g2: ESObject[] +let g3: A + +class B { + f1: ESObject + f2: ESObject[] + f3: A + + constructor(p1: ESObject, p2: ESObject[], p3: A) { + this.f1 = p1 + this.f2 = p2 + this.f3 = p3 + } + + foo1(p1: ESObject, p2: ESObject[], p3: A): ESObject { + return p1 + } + + foo2(p1: ESObject, p2: ESObject[], p3: A): ESObject[] { + return p2 + } + + foo3(p1: ESObject, p2: ESObject[], p3: A): A { + return p3 + } +} + +function bar1(p1: ESObject, p2: ESObject[], p3: A): ESObject { + return p1 +} + +function bar2(p1: ESObject, p2: ESObject[], p3: A): ESObject[] { + return p2 +} + +function bar3(p1: ESObject, p2: ESObject[], p3: A): A { + return p3 +} + +function ff(): {x: number} { + return {x: 10} +} + +function baz(p1: ESObject, p2: ESObject[], p3: A): void { + const c1: ESObject = p1; + const c2: ESObject[] = p2 + const c3: A = p3 + + let v1: ESObject = p1 + let v2: ESObject[] = p2 + let v3: A = p3 + + v1 = c1 + v2 = c2 + v3 = c3 + + v1.x = 10 + v1.foo() + v1[10] = 20 + v1(20) + + v1 = {} + v1 = "abc" + v1 = ff() + v1 = [1, 2] + v1 = [p1, c1] + v1 = [p1, c1, "abc"] + v1 = new A() + + let v11: ESObject = {} + let v12: ESObject = "abc" + let v13: ESObject = ff() + let v14: ESObject = [1, 2] + let v15: ESObject = [p1, c1] + let v16: ESObject = [p1, c1, "abc"] + let v17: ESObject = new A() + + let n1: number = v1 + n1 = v1 + let n2: number = p1 as number +} + +export let obj = new ESObject(); + +type t1 = ESObject +type t2 = ESObject[] + +export type t3 = ESObject +export type t4 = ESObject[] + +export type t5 = t3 +export type t6 = t4[] + +export function foo1(): any { + let a: ESObject = "STRING"; + return a +} + +export function foo2(a: ESObject): ESObject { + return a; +} + +export function foo3(a: t3): t3 { + return a; +} + +foo2(5) +foo3(5) +foo2("asd") +foo3("asd") +foo2(null) +foo3(null) +foo2(undefined) +foo3(undefined) + +export function foo4(a: ESObject[]): ESObject { + return a; +} + +export function foo5(a: t3[]): t3 { + return a; +} + +foo4([2, 3]) +foo5([2, 3]) +foo4(["str1", "str2"]) +foo5(["str1", "str2"]) +let n = new ESObject[0] +n = null + +foo4(n) +foo5(n) + +export function foo6(a: ESObject[]): ESObject { + return a; +} + +export function foo7(a: t3[]): t3 { + return a; +} + +export function foo8(a: ESObject[]): ESObject { + return a; +} + +export function foo9(a: t3[]): t3 { + return a; +} + +export class Cls {} + +interface CL extends ESObject {} + +export interface CLS extends ESObject {} \ No newline at end of file diff --git a/linter-4.2/test/es_object.ts.autofix.skip b/linter-4.2/test/es_object.ts.autofix.skip new file mode 100644 index 000000000..e69de29bb diff --git a/linter-4.2/test/es_object.ts.relax.json b/linter-4.2/test/es_object.ts.relax.json new file mode 100644 index 000000000..afba54e2d --- /dev/null +++ b/linter-4.2/test/es_object.ts.relax.json @@ -0,0 +1,606 @@ +{ + "copyright": [ + "Copyright (c) 2023-2023 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "nodes": [ + { + "line": 16, + "column": 17, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 20, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 21, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 22, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 25, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 26, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 27, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 21, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 35, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 53, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 60, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 63, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 63, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 65, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 60, + "column": 16, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" + }, + { + "line": 61, + "column": 12, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 64, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 64, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 64, + "column": 50, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 66, + "column": 15, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 67, + "column": 17, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 70, + "column": 13, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 71, + "column": 15, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 77, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 78, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 79, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 80, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 82, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 82, + "column": 10, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 83, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 85, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 86, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 87, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 88, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 90, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 90, + "column": 25, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 91, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 93, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 94, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 95, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 96, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 98, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 99, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 103, + "column": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 105, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 106, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 108, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 109, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 114, + "column": 25, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 115, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 119, + "column": 25, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 119, + "column": 36, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 136, + "column": 25, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 136, + "column": 38, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 148, + "column": 5, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 45, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 47, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 60, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 170, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 172, + "column": 22, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 174, + "column": 30, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} \ No newline at end of file diff --git a/linter-4.2/test/es_object.ts.strict.json b/linter-4.2/test/es_object.ts.strict.json new file mode 100644 index 000000000..afba54e2d --- /dev/null +++ b/linter-4.2/test/es_object.ts.strict.json @@ -0,0 +1,606 @@ +{ + "copyright": [ + "Copyright (c) 2023-2023 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "nodes": [ + { + "line": 16, + "column": 17, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 20, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 21, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 22, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 25, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 26, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 27, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 21, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 35, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 53, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 60, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 63, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 63, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 65, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 60, + "column": 16, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" + }, + { + "line": 61, + "column": 12, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 64, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 64, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 64, + "column": 50, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 66, + "column": 15, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 67, + "column": 17, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 70, + "column": 13, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 71, + "column": 15, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 77, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 78, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 79, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 80, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 82, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 82, + "column": 10, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 83, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 85, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 86, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 87, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 88, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 90, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 90, + "column": 25, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 91, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 93, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 94, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 95, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 96, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 98, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 99, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 103, + "column": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 105, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 106, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 108, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 109, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 114, + "column": 25, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 115, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 119, + "column": 25, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 119, + "column": 36, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 136, + "column": 25, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 136, + "column": 38, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 148, + "column": 5, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 45, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 47, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 60, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 170, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 172, + "column": 22, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 174, + "column": 30, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} \ No newline at end of file diff --git a/linter/src/FaultAttrs.ts b/linter/src/FaultAttrs.ts index 27f2c23d4..29e9c2c17 100644 --- a/linter/src/FaultAttrs.ts +++ b/linter/src/FaultAttrs.ts @@ -121,3 +121,6 @@ faultsAttrs[FaultID.StrictDiagnostic] = {cookBookRef: '145',}; faultsAttrs[FaultID.ErrorSuppression] = {cookBookRef: '146',}; faultsAttrs[FaultID.UnsupportedDecorators] = {cookBookRef: '148',}; faultsAttrs[FaultID.ImportAfterStatement] = {cookBookRef: '150',}; +faultsAttrs[FaultID.EsObjectType] = {cookBookRef: '8'}; +faultsAttrs[FaultID.EsObjectAssignment] = {cookBookRef: '8'}; +faultsAttrs[FaultID.EsObjectAccess] = {cookBookRef: '8'}; diff --git a/linter/src/FaultDesc.ts b/linter/src/FaultDesc.ts index befb4cf76..3b4eb1488 100644 --- a/linter/src/FaultDesc.ts +++ b/linter/src/FaultDesc.ts @@ -115,3 +115,6 @@ faultDesc[FaultID.ErrorSuppression] = 'Error suppression annotation'; faultDesc[FaultID.StrictDiagnostic] = 'Strict diagnostic'; faultDesc[FaultID.UnsupportedDecorators] = 'Unsupported decorators'; faultDesc[FaultID.ImportAfterStatement] = 'Import declaration after other declaration or statement'; +faultDesc[FaultID.EsObjectType] = '"ESObject" type'; +faultDesc[FaultID.EsObjectAssignment] = '"ESObject" type assignment'; +faultDesc[FaultID.EsObjectAccess] = '"ESObject" access'; \ No newline at end of file diff --git a/linter/src/Problems.ts b/linter/src/Problems.ts index ef4618dea..d497db507 100644 --- a/linter/src/Problems.ts +++ b/linter/src/Problems.ts @@ -34,5 +34,6 @@ export enum FaultID { JSExtensionInModuleIdent, NewTarget, DynamicImport, DefiniteAssignment, IifeAsNamespace, Prototype, GlobalThis, UtilityType, PropertyDeclOnFunction, FunctionApplyBindCall, ReadonlyArr, ConstAssertion, ImportAssertion, SpreadOperator, LimitedStdLibApi, ErrorSuppression, StrictDiagnostic, UnsupportedDecorators, ImportAfterStatement, + EsObjectType, EsObjectAssignment, EsObjectAccess, LAST_ID, // this should always be last enum` } diff --git a/linter/src/TypeScriptLinter.ts b/linter/src/TypeScriptLinter.ts index ee117b90f..7ded35de5 100644 --- a/linter/src/TypeScriptLinter.ts +++ b/linter/src/TypeScriptLinter.ts @@ -144,6 +144,7 @@ export class TypeScriptLinter { [ts.SyntaxKind.SpreadElement, this.handleSpreadOp], [ts.SyntaxKind.SpreadAssignment, this.handleSpreadOp], [ts.SyntaxKind.GetAccessor, this.handleGetAccessor], [ts.SyntaxKind.SetAccessor, this.handleSetAccessor], [ts.SyntaxKind.ConstructSignature, this.handleConstructSignature], + [ts.SyntaxKind.ExpressionWithTypeArguments, this.handleExpressionWithTypeArguments], ]); public incrementCounters(node: ts.Node | ts.CommentRange, faultId: number, autofixable: boolean = false, autofix?: Autofix[],) { @@ -639,6 +640,10 @@ export class TypeScriptLinter { if(!!symbol && this.tsUtils.isSymbolAPI(symbol)) { this.incrementCounters(node, FaultID.SymbolType); } + + if (this.tsUtils.hasEsObjectType(propertyAccessNode.expression)) { + this.incrementCounters(node, FaultID.EsObjectAccess); + } } private handlePropertyAssignmentOrDeclaration(node: ts.Node) { @@ -902,6 +907,11 @@ export class TypeScriptLinter { !this.tsUtils.relatedByInheritanceOrIdentical(rightOperandType, leftOperandType) ) this.incrementCounters(tsBinaryExpr, FaultID.StructuralIdentity); + + const typeNode = this.tsUtils.getVariableDeclarationTypeNode(tsLhsExpr); + if (!!typeNode) { + this.handleEsObjectAssignment(tsBinaryExpr, typeNode, tsRhsExpr); + } break; default: return; @@ -1008,11 +1018,40 @@ export class TypeScriptLinter { !this.tsUtils.relatedByInheritanceOrIdentical(tsInitType, tsVarType) ) this.incrementCounters(tsVarDecl, FaultID.StructuralIdentity); + + this.handleEsObjectAssignment(tsVarDecl, tsVarDecl.type, tsVarInit); } this.handleDeclarationInferredType(tsVarDecl); this.handleDefiniteAssignmentAssertion(tsVarDecl); } + private handleEsObjectAssignment(node: ts.Node, type: ts.TypeNode, value: ts.Node) { + if (!this.tsUtils.isEsObjectType(type)) { + let valueTypeNode = this.tsUtils.getVariableDeclarationTypeNode(value); + if (!!valueTypeNode && this.tsUtils.isEsObjectType(valueTypeNode)) { + this.incrementCounters(node, FaultID.EsObjectAssignment); + } + + return + } + + if (ts.isArrayLiteralExpression(value) || ts.isObjectLiteralExpression(value)) { + this.incrementCounters(node, FaultID.EsObjectAssignment); + return; + } + + const valueType = this.tsTypeChecker.getTypeAtLocation(value); + if (this.tsUtils.isUnsupportedType(valueType)) { + return; + } + + if (this.tsUtils.isAnonymousType(valueType)) { + return; + } + + this.incrementCounters(node, FaultID.EsObjectAssignment); + } + private handleCatchClause(node: ts.Node) { let tsCatch = node as ts.CatchClause; // In TS catch clause doesn't permit specification of the exception varible type except 'any' or 'unknown'. @@ -1339,6 +1378,10 @@ export class TypeScriptLinter { this.incrementCounters(node, FaultID.PropertyAccessByIndex, autofixable, autofix); } + + if (this.tsUtils.hasEsObjectType(tsElementAccessExpr.expression)) { + this.incrementCounters(node, FaultID.EsObjectAccess); + } } private handleEnumMember(node: ts.Node) { @@ -1407,6 +1450,10 @@ export class TypeScriptLinter { this.handleGenericCallWithNoTypeArgs(tsCallExpr); this.handleStructIdentAndUndefinedInArgs(tsCallExpr); this.handleStdlibAPICall(tsCallExpr); + + if (this.tsUtils.hasEsObjectType(tsCallExpr.expression)) { + this.incrementCounters(node, FaultID.EsObjectAccess); + } } private handleImportCall(tsCallExpr: ts.CallExpression) { @@ -1572,7 +1619,9 @@ export class TypeScriptLinter { private handleTypeReference(node: ts.Node) { let typeRef = node as ts.TypeReferenceNode; - if (ts.isIdentifier(typeRef.typeName) && LIMITED_STANDARD_UTILITY_TYPES.includes(typeRef.typeName.text)) + if (this.tsUtils.isEsObjectType(typeRef) && !this.tsUtils.isEsObjectAllowed(typeRef)) { + this.incrementCounters(node, FaultID.EsObjectType); + } else if (ts.isIdentifier(typeRef.typeName) && LIMITED_STANDARD_UTILITY_TYPES.includes(typeRef.typeName.text)) this.incrementCounters(node, FaultID.UtilityType); else if ( ts.isIdentifier(typeRef.typeName) && typeRef.typeName.text === 'Partial' && @@ -1653,6 +1702,14 @@ export class TypeScriptLinter { } } + private handleExpressionWithTypeArguments(node: ts.Node) { + let tsTypeExpr = node as ts.ExpressionWithTypeArguments; + let symbol = this.tsTypeChecker.getSymbolAtLocation(tsTypeExpr.expression); + if (!!symbol && this.tsUtils.isEsObjectSymbol(symbol)) { + this.incrementCounters(tsTypeExpr, FaultID.EsObjectType); + } + } + private checkErrorSuppressingAnnotation(comment: ts.CommentRange, srcText: string) { const commentContent = comment.kind === ts.SyntaxKind.MultiLineCommentTrivia ? srcText.slice(comment.pos + 2, comment.end - 2) diff --git a/linter/src/utils/TsUtils.ts b/linter/src/utils/TsUtils.ts index 0ded4c929..5ea6a6fc2 100644 --- a/linter/src/utils/TsUtils.ts +++ b/linter/src/utils/TsUtils.ts @@ -18,6 +18,7 @@ import * as path from 'node:path'; import { STANDARD_LIBRARIES } from './consts/StandardLibraries'; import { STATEMENT_KINDS } from './consts/StatementKinds'; import { TYPED_ARRAYS } from './consts/TypedArrays'; +import { ES_OBJECT } from './consts/ESObject'; import { getScriptKind } from './functions/GetScriptKind'; import { isBuiltinType } from './functions/IsBuiltinType'; import { isStdLibraryType } from './functions/IsStdLibrary'; @@ -309,7 +310,7 @@ export class TsUtils { return null; } - private isVarDeclaration(tsDecl: ts.Declaration): boolean { + private isVarDeclaration(tsDecl: ts.Node): boolean { return ts.isVariableDeclaration(tsDecl) && ts.isVariableDeclarationList(tsDecl.parent); } @@ -944,4 +945,59 @@ export class TsUtils { return false; } + + public isEsObjectType(typeNode: ts.TypeNode): boolean { + return ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName) && + typeNode.typeName.text == ES_OBJECT; + } + + public isEsObjectAllowed(typeRef: ts.TypeReferenceNode): boolean { + let node = typeRef.parent; + + if (!this.isVarDeclaration(node)) { + return false; + } + + while (node) { + if (ts.isBlock(node)) { + return true; + } + node = node.parent; + } + return false; + } + + public getVariableDeclarationTypeNode(node: ts.Node): ts.TypeNode | undefined { + const symbol = this.tsTypeChecker.getSymbolAtLocation(node); + const decl = this.getDeclaration(symbol); + if (!!decl && ts.isVariableDeclaration(decl)) { + return decl.type; + } + return undefined; + } + + public hasEsObjectType(node: ts.Node): boolean { + const typeNode = this.getVariableDeclarationTypeNode(node) + return typeNode !== undefined && this.isEsObjectType(typeNode); + } + + public isEsObjectSymbol(sym: ts.Symbol): boolean { + let decl = this.getDeclaration(sym); + return !!decl && ts.isTypeAliasDeclaration(decl) && decl.name.escapedText == ES_OBJECT && + decl.type.kind == ts.SyntaxKind.AnyKeyword; + } + + public isAnonymousType(type: ts.Type): boolean { + if (type.isUnionOrIntersection()) { + for (let compType of type.types) { + if (this.isAnonymousType(compType)) { + return true; + } + } + return false; + } + + return (type.flags & ts.TypeFlags.Object) !== 0 && + ((type as ts.ObjectType).objectFlags & ts.ObjectFlags.Anonymous) !== 0; + } } diff --git a/linter/src/utils/consts/ESObject.ts b/linter/src/utils/consts/ESObject.ts new file mode 100644 index 000000000..e1c9a2b10 --- /dev/null +++ b/linter/src/utils/consts/ESObject.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const ES_OBJECT = 'ESObject' diff --git a/linter/test/es_object.ts b/linter/test/es_object.ts new file mode 100644 index 000000000..76d6dc684 --- /dev/null +++ b/linter/test/es_object.ts @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +type ESObject = any + +class A {} + +let g1: ESObject +let g2: ESObject[] +let g3: A + +class B { + f1: ESObject + f2: ESObject[] + f3: A + + constructor(p1: ESObject, p2: ESObject[], p3: A) { + this.f1 = p1 + this.f2 = p2 + this.f3 = p3 + } + + foo1(p1: ESObject, p2: ESObject[], p3: A): ESObject { + return p1 + } + + foo2(p1: ESObject, p2: ESObject[], p3: A): ESObject[] { + return p2 + } + + foo3(p1: ESObject, p2: ESObject[], p3: A): A { + return p3 + } +} + +function bar1(p1: ESObject, p2: ESObject[], p3: A): ESObject { + return p1 +} + +function bar2(p1: ESObject, p2: ESObject[], p3: A): ESObject[] { + return p2 +} + +function bar3(p1: ESObject, p2: ESObject[], p3: A): A { + return p3 +} + +function ff(): {x: number} { + return {x: 10} +} + +function baz(p1: ESObject, p2: ESObject[], p3: A): void { + const c1: ESObject = p1; + const c2: ESObject[] = p2 + const c3: A = p3 + + let v1: ESObject = p1 + let v2: ESObject[] = p2 + let v3: A = p3 + + v1 = c1 + v2 = c2 + v3 = c3 + + v1.x = 10 + v1.foo() + v1[10] = 20 + v1(20) + + v1 = {} + v1 = "abc" + v1 = ff() + v1 = [1, 2] + v1 = [p1, c1] + v1 = [p1, c1, "abc"] + v1 = new A() + + let v11: ESObject = {} + let v12: ESObject = "abc" + let v13: ESObject = ff() + let v14: ESObject = [1, 2] + let v15: ESObject = [p1, c1] + let v16: ESObject = [p1, c1, "abc"] + let v17: ESObject = new A() + + let n1: number = v1 + n1 = v1 + let n2: number = p1 as number +} + +export let obj = new ESObject(); + +type t1 = ESObject +type t2 = ESObject[] + +export type t3 = ESObject +export type t4 = ESObject[] + +export type t5 = t3 +export type t6 = t4[] + +export function foo1(): any { + let a: ESObject = "STRING"; + return a +} + +export function foo2(a: ESObject): ESObject { + return a; +} + +export function foo3(a: t3): t3 { + return a; +} + +foo2(5) +foo3(5) +foo2("asd") +foo3("asd") +foo2(null) +foo3(null) +foo2(undefined) +foo3(undefined) + +export function foo4(a: ESObject[]): ESObject { + return a; +} + +export function foo5(a: t3[]): t3 { + return a; +} + +foo4([2, 3]) +foo5([2, 3]) +foo4(["str1", "str2"]) +foo5(["str1", "str2"]) +let n = new ESObject[0] +n = null + +foo4(n) +foo5(n) + +export function foo6(a: ESObject[]): ESObject { + return a; +} + +export function foo7(a: t3[]): t3 { + return a; +} + +export function foo8(a: ESObject[]): ESObject { + return a; +} + +export function foo9(a: t3[]): t3 { + return a; +} + +export class Cls {} + +interface CL extends ESObject {} + +export interface CLS extends ESObject {} \ No newline at end of file diff --git a/linter/test/es_object.ts.autofix.skip b/linter/test/es_object.ts.autofix.skip new file mode 100644 index 000000000..e69de29bb diff --git a/linter/test/es_object.ts.relax.json b/linter/test/es_object.ts.relax.json new file mode 100644 index 000000000..afba54e2d --- /dev/null +++ b/linter/test/es_object.ts.relax.json @@ -0,0 +1,606 @@ +{ + "copyright": [ + "Copyright (c) 2023-2023 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "nodes": [ + { + "line": 16, + "column": 17, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 20, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 21, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 22, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 25, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 26, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 27, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 21, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 35, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 53, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 60, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 63, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 63, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 65, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 60, + "column": 16, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" + }, + { + "line": 61, + "column": 12, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 64, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 64, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 64, + "column": 50, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 66, + "column": 15, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 67, + "column": 17, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 70, + "column": 13, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 71, + "column": 15, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 77, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 78, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 79, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 80, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 82, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 82, + "column": 10, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 83, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 85, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 86, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 87, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 88, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 90, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 90, + "column": 25, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 91, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 93, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 94, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 95, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 96, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 98, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 99, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 103, + "column": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 105, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 106, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 108, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 109, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 114, + "column": 25, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 115, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 119, + "column": 25, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 119, + "column": 36, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 136, + "column": 25, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 136, + "column": 38, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 148, + "column": 5, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 45, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 47, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 60, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 170, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 172, + "column": 22, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 174, + "column": 30, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} \ No newline at end of file diff --git a/linter/test/es_object.ts.strict.json b/linter/test/es_object.ts.strict.json new file mode 100644 index 000000000..afba54e2d --- /dev/null +++ b/linter/test/es_object.ts.strict.json @@ -0,0 +1,606 @@ +{ + "copyright": [ + "Copyright (c) 2023-2023 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "nodes": [ + { + "line": 16, + "column": 17, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 20, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 21, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 22, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 25, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 26, + "column": 9, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 27, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 21, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 35, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 29, + "column": 53, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 35, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 39, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 14, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 46, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 43, + "column": 60, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 63, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 52, + "column": 63, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 19, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 33, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 51, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 56, + "column": 65, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 60, + "column": 16, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" + }, + { + "line": 61, + "column": 12, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 64, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 64, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 64, + "column": 50, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 66, + "column": 15, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 67, + "column": 17, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 70, + "column": 13, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 71, + "column": 15, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 77, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 78, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 79, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 80, + "column": 5, + "problem": "EsObjectAccess", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 82, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 82, + "column": 10, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 83, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 85, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 86, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 87, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 88, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 90, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 90, + "column": 25, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)" + }, + { + "line": 91, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 93, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 94, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 95, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 96, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 98, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 99, + "column": 5, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 103, + "column": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 105, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 106, + "column": 11, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 108, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 109, + "column": 18, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 114, + "column": 25, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 115, + "column": 9, + "problem": "EsObjectAssignment", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 119, + "column": 25, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 119, + "column": 36, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 136, + "column": 25, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 136, + "column": 38, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 148, + "column": 5, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 45, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 154, + "column": 58, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 32, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 47, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 162, + "column": 60, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 170, + "column": 28, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 172, + "column": 22, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 174, + "column": 30, + "problem": "EsObjectType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} \ No newline at end of file -- Gitee