From 34e1b7fe43f99757446f303888bc846488f9fad3 Mon Sep 17 00:00:00 2001 From: Utku Enes GURSEL Date: Thu, 29 May 2025 20:25:35 +0300 Subject: [PATCH] fix js2s-access-js-prop-rule Issue: ICBJA3 Description: fix js2s-access-js-prop-rule and remove js2s-object-usage rule. Signed-off-by: Utku Enes GURSEL --- ets2panda/linter/src/lib/CookBookMsg.ts | 1 - ets2panda/linter/src/lib/FaultAttrs.ts | 1 - ets2panda/linter/src/lib/FaultDesc.ts | 1 - ets2panda/linter/src/lib/Problems.ts | 1 - ets2panda/linter/src/lib/TypeScriptLinter.ts | 223 +- ets2panda/linter/src/lib/utils/TsUtils.ts | 2 +- .../binary_operation_js_obj.ets.args.json | 42 +- .../binary_operation_js_obj.ets.arkts2.json | 50 +- .../binary_operation_js_obj.ets.autofix.json | 72 +- ...increases_decreases_js_obj.ets.arkts2.json | 110 +- ...ncreases_decreases_js_obj.ets.autofix.json | 198 +- ...increases_decreases_js_obj.ets.migrate.ets | 8 +- .../interop_convert_import.ets.arkts2.json | 82 +- .../interop_convert_import.ets.autofix.json | 172 +- .../interop_import_js_compare.ets.arkts2.json | 88 +- .../interop_import_js_index.ets.arkts2.json | 26 +- .../interop_import_js_index.ets.autofix.json | 61 +- .../interop_import_js_rules.ets.arkts2.json | 60 - .../interop_import_js_rules.ets.autofix.json | 2048 ++++++++--------- .../interop/interop_import_js_rules.ets.json | 28 +- .../interop_import_typeof_js.ets.arkts2.json | 912 ++++---- .../interop_import_typeof_js.ets.autofix.json | 1736 +++++++------- ...p_not_have_property_arkts2.ets.arkts2.json | 52 +- ..._not_have_property_arkts2.ets.autofix.json | 107 +- ...t_have_property_num_arkts2.ets.arkts2.json | 190 +- ..._have_property_num_arkts2.ets.autofix.json | 372 +-- .../interop/no_js_instanceof.ets.arkts2.json | 32 +- 27 files changed, 2490 insertions(+), 4185 deletions(-) mode change 100755 => 100644 ets2panda/linter/test/interop/binary_operation_js_obj.ets.arkts2.json mode change 100755 => 100644 ets2panda/linter/test/interop/binary_operation_js_obj.ets.autofix.json mode change 100755 => 100644 ets2panda/linter/test/interop/increases_decreases_js_obj.ets.arkts2.json mode change 100755 => 100644 ets2panda/linter/test/interop/increases_decreases_js_obj.ets.autofix.json mode change 100755 => 100644 ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json mode change 100755 => 100644 ets2panda/linter/test/interop/interop_import_typeof_js.ets.arkts2.json mode change 100755 => 100644 ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json mode change 100755 => 100644 ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.arkts2.json mode change 100755 => 100644 ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json mode change 100755 => 100644 ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.arkts2.json mode change 100755 => 100644 ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.autofix.json mode change 100755 => 100644 ets2panda/linter/test/interop/no_js_instanceof.ets.arkts2.json diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index 4fe5be46599..b17bdae5643 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -270,7 +270,6 @@ cookBookTag[260] = 'The "@Entry" annotation does not support dynamic parameters cookBookTag[262] = 'The makeObserved function is not supported (arkui-no-makeobserved-function)'; cookBookTag[263] = 'The "@Provide" annotation does not support dynamic parameters (arkui-provide-annotation-parameters)'; -cookBookTag[264] = 'Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)'; cookBookTag[265] = 'Direct inheritance of interop JS classes is not supported (arkts-interop-js2s-inherit-js-class)'; cookBookTag[266] = 'Direct usage of interop JS objects is not supported (arkts-interop-js2s-traverse-js-instance)'; cookBookTag[267] = 'Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-call-static-function)'; diff --git a/ets2panda/linter/src/lib/FaultAttrs.ts b/ets2panda/linter/src/lib/FaultAttrs.ts index e198eb4e83e..2d555b1a2ac 100644 --- a/ets2panda/linter/src/lib/FaultAttrs.ts +++ b/ets2panda/linter/src/lib/FaultAttrs.ts @@ -186,7 +186,6 @@ faultsAttrs[FaultID.UIInterfaceImport] = new FaultAttributes(259); faultsAttrs[FaultID.EntryAnnotation] = new FaultAttributes(260); faultsAttrs[FaultID.MakeObservedIsNotSupported] = new FaultAttributes(262); faultsAttrs[FaultID.ProvideAnnotation] = new FaultAttributes(263); -faultsAttrs[FaultID.InteropJsObjectUsage] = new FaultAttributes(264); faultsAttrs[FaultID.InteropJsObjectInheritance] = new FaultAttributes(265); faultsAttrs[FaultID.InteropJsObjectTraverseJsInstance] = new FaultAttributes(266); faultsAttrs[FaultID.InteropJsObjectCallStaticFunc] = new FaultAttributes(267); diff --git a/ets2panda/linter/src/lib/FaultDesc.ts b/ets2panda/linter/src/lib/FaultDesc.ts index 1dd89ea9683..d33c364676a 100644 --- a/ets2panda/linter/src/lib/FaultDesc.ts +++ b/ets2panda/linter/src/lib/FaultDesc.ts @@ -190,7 +190,6 @@ faultDesc[FaultID.UseConcurrentDeprecated] = '"use concurrent" is not supported' faultDesc[FaultID.MethodInheritRule] = 'Method parameters/returns violate inheritance principles'; faultDesc[FaultID.EntryAnnotation] = '"@Entry" decorator parameter'; faultDesc[FaultID.ProvideAnnotation] = '"@Provide" decorator parameter'; -faultDesc[FaultID.InteropJsObjectUsage] = 'Interop JS object usage'; faultDesc[FaultID.InteropJsObjectInheritance] = 'Interop JS class inheritance'; faultDesc[FaultID.InteropJsObjectTraverseJsInstance] = 'Interop JS object traverse usage'; faultDesc[FaultID.InteropJsObjectCallStaticFunc] = 'Interop JS function usage'; diff --git a/ets2panda/linter/src/lib/Problems.ts b/ets2panda/linter/src/lib/Problems.ts index efdc8dacaad..0620a0c8373 100644 --- a/ets2panda/linter/src/lib/Problems.ts +++ b/ets2panda/linter/src/lib/Problems.ts @@ -198,7 +198,6 @@ export enum FaultID { SdkTypeQuery, IsConcurrentDeprecated, InteropStaticObjectLiterals, - InteropJsObjectUsage, InteropJsObjectInheritance, InteropJsObjectTraverseJsInstance, InteropJsObjectCallStaticFunc, diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index ce3a05264e1..90ae2448430 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -226,7 +226,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private initEtsHandlers(): void { - /* * some syntax elements are ArkTs-specific and are only implemented inside patched * compiler, so we initialize those handlers if corresponding properties do exist @@ -420,7 +419,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } else { const handler = this.handlersMap.get(node.kind); if (handler !== undefined) { - /* * possibly requested cancellation will be checked in a limited number of handlers * checked nodes are selected as construct nodes, similar to how TSC does @@ -528,7 +526,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { * X.prototype.prototype.prototype = ... */ const baseExprTypeNode = this.tsTypeChecker.typeToTypeNode(baseExprType, undefined, ts.NodeBuilderFlags.None); - return baseExprTypeNode && ts.isFunctionTypeNode(baseExprTypeNode) || TsUtils.isAnyType(baseExprType); + return (baseExprTypeNode && ts.isFunctionTypeNode(baseExprTypeNode)) || TsUtils.isAnyType(baseExprType); } private interfaceInheritanceLint(node: ts.Node, heritageClauses: ts.NodeArray): void { @@ -613,15 +611,14 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (ts.isShorthandPropertyAssignment(prop) && !TsUtils.isAnyType(this.tsTypeChecker.getTypeAtLocation(prop))) { continue; } - const autofix = ts.isShorthandPropertyAssignment(prop) ? - this.autofixer?.fixShorthandPropertyAssignment(prop) : - objLiteralAutofix; + const autofix = ts.isShorthandPropertyAssignment(prop) + ? this.autofixer?.fixShorthandPropertyAssignment(prop) + : objLiteralAutofix; this.incrementCounters(prop, FaultID.ObjectLiteralProperty, autofix); } } private handleArrayLiteralExpression(node: ts.Node): void { - /* * If array literal is a part of destructuring assignment, then * don't process it further. @@ -743,7 +740,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const iSymbol = this.tsUtils.trueSymbolAtLocation(interfaceNode.name); const iDecls = iSymbol ? iSymbol.getDeclarations() : null; if (iDecls) { - /* * Since type checker merges all declarations with the same name * into one symbol, we need to check that there's more than one @@ -1224,7 +1220,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleImportModule(importDeclNode); if (this.options.arkts2) { const importClause = importDeclNode.importClause; - if (!importClause || !importClause.name && !importClause.namedBindings) { + if (!importClause || (!importClause.name && !importClause.namedBindings)) { this.incrementCounters(node, FaultID.NoSideEffectImport); } else { this.updateDataSdkJsonInfo(importDeclNode, importClause); @@ -1300,7 +1296,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const modulePath = importDeclNode.moduleSpecifier.getText().slice(1, -1); if (modulePath.startsWith('./') || modulePath.startsWith('../')) { - /* * Reason for this method to check the oh module imports, * We do not use relative paths when importing from OhModules, @@ -1424,20 +1419,28 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } return current; - } + }; const firstObjNode = getFirstObjectNode(propertyAccessNode); - const isFromJs = this.tsUtils.isJsImport(firstObjNode); + if (!this.tsUtils.isJsImport(firstObjNode)) { + return; + } - if(isFromJs) { - if (ts.isBinaryExpression(propertyAccessNode.parent) && - propertyAccessNode.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken) { - const autofix = this.autofixer?.fixInteropBinaryExpression(propertyAccessNode.parent); - this.incrementCounters(propertyAccessNode.parent, FaultID.InteropObjectProperty, autofix); - } else { - const autofix = this.autofixer?.fixInteropPropertyAccessExpression(propertyAccessNode); - this.incrementCounters(propertyAccessNode, FaultID.InteropObjectProperty, autofix); + if ( + ts.isBinaryExpression(propertyAccessNode.parent) && + propertyAccessNode.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken + ) { + if (!ts.isExpressionStatement(propertyAccessNode.parent.parent)) { + return; } + const autofix = this.autofixer?.fixInteropBinaryExpression(propertyAccessNode.parent); + this.incrementCounters(propertyAccessNode.parent, FaultID.InteropObjectProperty, autofix); + } else if ( + ts.isExpressionStatement(propertyAccessNode.parent) || + ts.isVariableDeclaration(propertyAccessNode.parent) + ) { + const autofix = this.autofixer?.fixInteropPropertyAccessExpression(propertyAccessNode); + this.incrementCounters(propertyAccessNode, FaultID.InteropObjectProperty, autofix); } } @@ -1490,9 +1493,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } if ( - baseExprSym && TsUtils.isFunctionSymbol(baseExprSym) || + (baseExprSym && TsUtils.isFunctionSymbol(baseExprSym)) || this.tsUtils.isStdFunctionType(baseExprType) || - TsUtils.isFunctionalType(baseExprType) && TsUtils.isAnonymousType(baseExprType) + (TsUtils.isFunctionalType(baseExprType) && TsUtils.isAnonymousType(baseExprType)) ) { this.incrementCounters(node.expression, FaultID.PropertyDeclOnFunction); } @@ -1570,7 +1573,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private handleLiteralAsPropertyName(node: ts.PropertyDeclaration | ts.PropertySignature): void { const propName = node.name; - if (!!propName && (ts.isNumericLiteral(propName) || this.options.arkts2 && ts.isStringLiteral(propName))) { + if (!!propName && (ts.isNumericLiteral(propName) || (this.options.arkts2 && ts.isStringLiteral(propName)))) { const autofix = this.autofixer?.fixLiteralAsPropertyNamePropertyName(propName); this.incrementCounters(node.name, FaultID.LiteralAsPropertyName, autofix); } @@ -1637,7 +1640,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleQuotedHyphenPropsDeprecated(node); const propName = node.name; - if (!propName || !(ts.isNumericLiteral(propName) || this.options.arkts2 && ts.isStringLiteral(propName))) { + if (!propName || !(ts.isNumericLiteral(propName) || (this.options.arkts2 && ts.isStringLiteral(propName)))) { return; } @@ -1965,8 +1968,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const tsRetType = this.tsTypeChecker.getReturnTypeOfSignature(tsSignature); if ( !tsRetType || - !this.options.arkts2 && TsUtils.isUnsupportedType(tsRetType) || - this.options.arkts2 && this.tsUtils.isUnsupportedTypeArkts2(tsRetType) + (!this.options.arkts2 && TsUtils.isUnsupportedType(tsRetType)) || + (this.options.arkts2 && this.tsUtils.isUnsupportedTypeArkts2(tsRetType)) ) { hasLimitedRetTypeInference = true; } else if (hasLimitedRetTypeInference) { @@ -2548,7 +2551,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleVariableDeclarationForProp(tsVarDecl); if ( !this.options.useRtLogic || - ts.isVariableDeclarationList(tsVarDecl.parent) && ts.isVariableStatement(tsVarDecl.parent.parent) + (ts.isVariableDeclarationList(tsVarDecl.parent) && ts.isVariableStatement(tsVarDecl.parent.parent)) ) { this.handleDeclarationDestructuring(tsVarDecl); } @@ -2828,9 +2831,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private handleDeclarationDestructuring(decl: ts.VariableDeclaration | ts.ParameterDeclaration): void { const faultId = ts.isVariableDeclaration(decl) ? FaultID.DestructuringDeclaration : FaultID.DestructuringParameter; if (ts.isObjectBindingPattern(decl.name)) { - const autofix = ts.isVariableDeclaration(decl) ? - this.autofixer?.fixObjectBindingPatternDeclarations(decl) : - undefined; + const autofix = ts.isVariableDeclaration(decl) + ? this.autofixer?.fixObjectBindingPatternDeclarations(decl) + : undefined; this.incrementCounters(decl, faultId, autofix); } else if (ts.isArrayBindingPattern(decl.name)) { // Array destructuring is allowed only for Arrays/Tuples and without spread operator. @@ -2847,9 +2850,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { hasNestedObjectDestructuring || TsUtils.destructuringDeclarationHasSpreadOperator(decl.name) ) { - const autofix = ts.isVariableDeclaration(decl) ? - this.autofixer?.fixArrayBindingPatternDeclarations(decl, isArrayOrTuple) : - undefined; + const autofix = ts.isVariableDeclaration(decl) + ? this.autofixer?.fixArrayBindingPatternDeclarations(decl, isArrayOrTuple) + : undefined; this.incrementCounters(decl, faultId, autofix); } } @@ -3019,7 +3022,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { * Handle comment directive '@ts-nocheck' */ while ((currentNode as any).expression) { - /* * CC-OFFNXT(no_explicit_any) std lib * Handle comment directive '@ts-nocheck' @@ -3219,7 +3221,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private checkClassDeclarationHeritageClause(hClause: ts.HeritageClause, isSendableClass: boolean): void { for (const tsTypeExpr of hClause.types) { - /* * Always resolve type from 'tsTypeExpr' node, not from 'tsTypeExpr.expression' node, * as for the latter, type checker will return incorrect type result for classes in @@ -3350,10 +3351,10 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const names = new Set(); if ( - ts.isFunctionDeclaration(statement) && statement.name && statement.body || - ts.isClassDeclaration(statement) && statement.name || - ts.isInterfaceDeclaration(statement) && statement.name || - ts.isEnumDeclaration(statement) && statement.name + (ts.isFunctionDeclaration(statement) && statement.name && statement.body) || + (ts.isClassDeclaration(statement) && statement.name) || + (ts.isInterfaceDeclaration(statement) && statement.name) || + (ts.isEnumDeclaration(statement) && statement.name) ) { names.add(statement.name.text); return names; @@ -3899,7 +3900,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private isStdlibClassVarDecl(ident: ts.Identifier, sym: ts.Symbol): boolean { - /* * Most standard JS classes are defined in TS stdlib as ambient global * variables with interface constructor type and require special check @@ -3950,7 +3950,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } if ( - (tsIdentSym.flags & illegalValues) === 0 && !this.isStdlibClassVarDecl(tsIdentifier, tsIdentSym) || + ((tsIdentSym.flags & illegalValues) === 0 && !this.isStdlibClassVarDecl(tsIdentifier, tsIdentSym)) || isStruct(tsIdentSym) || !identiferUseInValueContext(tsIdentifier, tsIdentSym) ) { @@ -3995,8 +3995,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.tsUtils.isOrDerivedFrom(type, TsUtils.isTuple) || this.tsUtils.isOrDerivedFrom(type, this.tsUtils.isStdRecordType) || this.tsUtils.isOrDerivedFrom(type, this.tsUtils.isStringType) || - !this.options.arkts2 && - (this.tsUtils.isOrDerivedFrom(type, this.tsUtils.isStdMapType) || TsUtils.isIntrinsicObjectType(type)) || + (!this.options.arkts2 && + (this.tsUtils.isOrDerivedFrom(type, this.tsUtils.isStdMapType) || TsUtils.isIntrinsicObjectType(type))) || TsUtils.isEnumType(type) || // we allow EsObject here beacuse it is reported later using FaultId.EsObjectType TsUtils.isEsValueType(typeNode) @@ -4736,7 +4736,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { callLikeExpr: ts.CallExpression | ts.NewExpression, callSignature: ts.Signature ): void { - /* * Note: The PR!716 has led to a significant performance degradation. * Since initial problem was fixed in a more general way, this change @@ -4766,9 +4765,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (ts.isNewExpression(callLikeExpr) && this.isNonGenericClass(callLikeExpr)) { return; } - const tsSyntaxKind = ts.isNewExpression(callLikeExpr) ? - ts.SyntaxKind.Constructor : - ts.SyntaxKind.FunctionDeclaration; + const tsSyntaxKind = ts.isNewExpression(callLikeExpr) + ? ts.SyntaxKind.Constructor + : ts.SyntaxKind.FunctionDeclaration; const signFlags = ts.NodeBuilderFlags.WriteTypeArgumentsOfSignature | ts.NodeBuilderFlags.IgnoreErrors; const signDecl = this.tsTypeChecker.signatureToSignatureDeclaration( callSignature, @@ -4981,7 +4980,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { expr, this.tsUtils.isLibraryType(this.tsTypeChecker.getTypeAtLocation(expr.expression)), (diagnostic, errorType) => { - /* * When a diagnostic meets the filter criteria, If it happens in an ets file in the 'oh_modules' directory. * the diagnostic is downgraded to warning. For other files, downgraded to nothing. @@ -5126,8 +5124,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const exprType = this.tsTypeChecker.getTypeAtLocation(tsAsExpr.expression).getNonNullableType(); // check for rule#65: 'number as Number' and 'boolean as Boolean' are disabled if ( - this.tsUtils.isNumberLikeType(exprType) && this.tsUtils.isStdNumberType(targetType) || - TsUtils.isBooleanLikeType(exprType) && this.tsUtils.isStdBooleanType(targetType) + (this.tsUtils.isNumberLikeType(exprType) && this.tsUtils.isStdNumberType(targetType)) || + (TsUtils.isBooleanLikeType(exprType) && this.tsUtils.isStdBooleanType(targetType)) ) { this.incrementCounters(node, FaultID.TypeAssertion); } @@ -5173,7 +5171,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const isRestrictedPrimitive = restrictedPrimitiveTypes.includes(type.kind); const isRestrictedArrayType = type.kind === ts.SyntaxKind.ArrayType || - ts.isTypeReferenceNode(type) && ts.isIdentifier(type.typeName) && type.typeName.text === 'Array'; + (ts.isTypeReferenceNode(type) && ts.isIdentifier(type.typeName) && type.typeName.text === 'Array'); if (!isRestrictedPrimitive && !isRestrictedArrayType) { return; @@ -5200,7 +5198,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const type = tsAsExpr.type; const isNullAssertion = type.kind === ts.SyntaxKind.NullKeyword || - ts.isLiteralTypeNode(type) && type.literal.kind === ts.SyntaxKind.NullKeyword || + (ts.isLiteralTypeNode(type) && type.literal.kind === ts.SyntaxKind.NullKeyword) || type.getText() === 'null'; if (isNullAssertion) { this.incrementCounters(tsAsExpr, FaultID.InterOpConvertImport); @@ -5362,7 +5360,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private handleSpreadOp(node: ts.Node): void { - /* * spread assignment is disabled * spread element is allowed only for arrays as rest parameter @@ -5457,7 +5454,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { decl: ts.VariableDeclaration | ts.PropertyDeclaration | ts.ParameterDeclaration ): boolean | undefined { if ( - (ts.isVariableDeclaration(decl) && ts.isVariableStatement(decl.parent.parent) || + ((ts.isVariableDeclaration(decl) && ts.isVariableStatement(decl.parent.parent)) || ts.isPropertyDeclaration(decl)) && !decl.initializer ) { @@ -5580,7 +5577,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private handleCommentDirectives(sourceFile: ts.SourceFile): void { - /* * We use a dirty hack to retrieve list of parsed comment directives by accessing * internal properties of SourceFile node. @@ -5591,7 +5587,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (pragmas && pragmas instanceof Map) { const noCheckPragma = pragmas.get('ts-nocheck'); if (noCheckPragma) { - /* * The value is either a single entry or an array of entries. * Wrap up single entry with array to simplify processing. @@ -5615,9 +5610,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const range = directive.range as ts.TextRange; const kind: ts.SyntaxKind = - sourceFile.text.slice(range.pos, range.pos + 2) === '/*' ? - ts.SyntaxKind.MultiLineCommentTrivia : - ts.SyntaxKind.SingleLineCommentTrivia; + sourceFile.text.slice(range.pos, range.pos + 2) === '/*' + ? ts.SyntaxKind.MultiLineCommentTrivia + : ts.SyntaxKind.SingleLineCommentTrivia; const commentRange: ts.CommentRange = { pos: range.pos, end: range.end, @@ -5765,7 +5760,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const declPosition = decl.getStart(); if ( decl.getSourceFile().fileName !== node.getSourceFile().fileName || - declPosition !== undefined && declPosition >= scope.getStart() && declPosition < scope.getEnd() + (declPosition !== undefined && declPosition >= scope.getStart() && declPosition < scope.getEnd()) ) { return; } @@ -6002,8 +5997,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private isSendableDecoratorValid(decl: ts.FunctionDeclaration | ts.TypeAliasDeclaration): boolean { if ( this.compatibleSdkVersion > SENDBALE_FUNCTION_START_VERSION || - this.compatibleSdkVersion === SENDBALE_FUNCTION_START_VERSION && - !SENDABLE_FUNCTION_UNSUPPORTED_STAGES_IN_API12.includes(this.compatibleSdkVersionStage) + (this.compatibleSdkVersion === SENDBALE_FUNCTION_START_VERSION && + !SENDABLE_FUNCTION_UNSUPPORTED_STAGES_IN_API12.includes(this.compatibleSdkVersionStage)) ) { return true; } @@ -6123,7 +6118,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return ts.isFunctionDeclaration(name) || ts.isMethodDeclaration(name); }); const isInternalFunction = decl.name && ts.isIdentifier(decl.name) && interanlFunction.includes(decl.name.text); - if (isInternalFunction && filterDecl.length > 2 || !isInternalFunction && filterDecl.length > 1) { + if ((isInternalFunction && filterDecl.length > 2) || (!isInternalFunction && filterDecl.length > 1)) { this.incrementCounters(decl, FaultID.TsOverload); } } else if (ts.isConstructorDeclaration(decl) && decl.getText()) { @@ -6168,8 +6163,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return Boolean( t.flags & ts.TypeFlags.StringLike || typeText === 'String' || - t.flags & ts.TypeFlags.NumberLike && (/^\d+$/).test(typeText) || - isLiteralInitialized && !hasExplicitTypeAnnotation && !isFloatLiteral || + (t.flags & ts.TypeFlags.NumberLike && /^\d+$/.test(typeText)) || + (isLiteralInitialized && !hasExplicitTypeAnnotation && !isFloatLiteral) || t.flags & ts.TypeFlags.EnumLike ); }; @@ -6221,8 +6216,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { let isFloatLiteral = false; if (ts.isNumericLiteral(initializer)) { const literalText = initializer.getText(); - if (!(/^0[xX]/).test(literalText)) { - isFloatLiteral = (/\.|e[-+]|\dE[-+]/i).test(literalText); + if (!/^0[xX]/.test(literalText)) { + isFloatLiteral = /\.|e[-+]|\dE[-+]/i.test(literalText); } } @@ -6313,7 +6308,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private evaluateNumericValueFromPrefixUnaryExpression(node: ts.PrefixUnaryExpression): number | null { if (node.operator === ts.SyntaxKind.MinusToken) { - if (ts.isNumericLiteral(node.operand) || ts.isIdentifier(node.operand) && node.operand.text === 'Infinity') { + if (ts.isNumericLiteral(node.operand) || (ts.isIdentifier(node.operand) && node.operand.text === 'Infinity')) { return node.operand.text === 'Infinity' ? Number.NEGATIVE_INFINITY : -Number(node.operand.text); } const operandValue = this.evaluateNumericValue(node.operand); @@ -6328,7 +6323,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const typeNode = node.type; if ( typeNode.kind === ts.SyntaxKind.NumberKeyword || - ts.isTypeReferenceNode(typeNode) && typeNode.typeName.getText() === 'Number' + (ts.isTypeReferenceNode(typeNode) && typeNode.typeName.getText() === 'Number') ) { return this.evaluateNumericValue(node.expression); } @@ -6441,10 +6436,10 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } if ( - this.tsUtils.isOrDerivedFrom(lhsType, this.tsUtils.isArray) && - this.tsUtils.isOrDerivedFrom(rhsType, TsUtils.isTuple) || - this.tsUtils.isOrDerivedFrom(rhsType, this.tsUtils.isArray) && - this.tsUtils.isOrDerivedFrom(lhsType, TsUtils.isTuple) + (this.tsUtils.isOrDerivedFrom(lhsType, this.tsUtils.isArray) && + this.tsUtils.isOrDerivedFrom(rhsType, TsUtils.isTuple)) || + (this.tsUtils.isOrDerivedFrom(rhsType, this.tsUtils.isArray) && + this.tsUtils.isOrDerivedFrom(lhsType, TsUtils.isTuple)) ) { this.incrementCounters(node, FaultID.NoTuplesArrays); } @@ -6547,7 +6542,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const text = node.initializer.getText(); - if (!(/^\$.+$/).test(text)) { + if (!/^\$.+$/.test(text)) { return; } @@ -7429,7 +7424,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private shouldWarn(symbol: ts.Symbol): boolean { const parentApiName = this.getLocalApiListItemByKey(SdkNameInfo.ParentApiName); - return symbol && this.isHeritageClauseisThirdPartyBySymbol(symbol) || symbol.name === parentApiName; + return (symbol && this.isHeritageClauseisThirdPartyBySymbol(symbol)) || symbol.name === parentApiName; } private getFinalSymOnQuotedHyphenPropsDeprecated(node: ts.Node): ts.Symbol | undefined { @@ -7477,9 +7472,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private getTypeOfVariable(variable: ts.VariableDeclaration): ts.Symbol | undefined { if (variable.type) { - return ts.isArrayTypeNode(variable.type) ? - this.resolveTypeNodeSymbol(variable.type.elementType) : - this.resolveTypeNodeSymbol(variable.type); + return ts.isArrayTypeNode(variable.type) + ? this.resolveTypeNodeSymbol(variable.type.elementType) + : this.resolveTypeNodeSymbol(variable.type); } return variable.initializer ? this.tsTypeChecker.getTypeAtLocation(variable.initializer).getSymbol() : undefined; } @@ -7831,7 +7826,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return false; } - const propertyName = ts.isIdentifier(decl.expression.name) && decl.expression.name.text || ''; + const propertyName = (ts.isIdentifier(decl.expression.name) && decl.expression.name.text) || ''; if (propertyName !== 'self') { return false; } @@ -7845,13 +7840,13 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } - const importApiName = ts.isIdentifier(decl.expression.expression) && decl.expression.expression.text || ''; + const importApiName = (ts.isIdentifier(decl.expression.expression) && decl.expression.expression.text) || ''; const sdkInfos = importApiName && this.interfaceMap.get(importApiName); if (!sdkInfos) { return; } - const apiName = ts.isIdentifier(decl.name) && decl.name.text || ''; + const apiName = (ts.isIdentifier(decl.name) && decl.name.text) || ''; const matchedApi = [...sdkInfos].find((sdkInfo) => { return sdkInfo.api_name === apiName; }); @@ -7913,7 +7908,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if ( decl && (ts.isFunctionDeclaration(decl) || - ts.isVariableDeclaration(decl) && decl.initializer && ts.isArrowFunction(decl.initializer)) + (ts.isVariableDeclaration(decl) && decl.initializer && ts.isArrowFunction(decl.initializer))) ) { this.incrementCounters(arg, FaultID.InteropJsObjectCallStaticFunc); } @@ -7956,27 +7951,16 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } // Try direct check first - if (this.tsUtils.isImportedFromJS(identifier)) { - const autofix = this.autofixer?.createReplacementForJsImportPropertyAccessExpression( - node as ts.PropertyAccessExpression - ); - - this.incrementCounters( - node, - TsUtils.isInsideIfCondition(node) ? FaultID.InteropJsObjectConditionJudgment : FaultID.InteropJsObjectUsage, - autofix - ); + if (!this.tsUtils.isImportedFromJS(identifier)) { return; } - - // Try indirect reference (e.g., const foo = importedObj;) - const originalIdentifier = this.tsUtils.findOriginalIdentifier(identifier); - if (originalIdentifier && this.tsUtils.isImportedFromJS(originalIdentifier)) { - const autofix = this.autofixer?.createReplacementForJsIndirectImportPropertyAccessExpression( - node as ts.PropertyAccessExpression - ); - this.incrementCounters(node, FaultID.InteropJsObjectUsage, autofix); + const autofix = this.autofixer?.createReplacementForJsImportPropertyAccessExpression( + node as ts.PropertyAccessExpression + ); + if (!TsUtils.isInsideIfCondition(node)) { + return; } + this.incrementCounters(node, FaultID.InteropJsObjectConditionJudgment, autofix); } private fixJsImportElementAccessExpression(elementAccessExpr: ts.ElementAccessExpression): void { @@ -7984,16 +7968,16 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } - const variableDeclaration = ts.isIdentifier(elementAccessExpr.expression) ? - this.tsUtils.findVariableDeclaration(elementAccessExpr.expression) : - undefined; + const variableDeclaration = ts.isIdentifier(elementAccessExpr.expression) + ? this.tsUtils.findVariableDeclaration(elementAccessExpr.expression) + : undefined; if (!variableDeclaration?.initializer) { return; } - const identifier = ts.isPropertyAccessExpression(variableDeclaration.initializer) ? - (variableDeclaration.initializer.expression as ts.Identifier) : - undefined; + const identifier = ts.isPropertyAccessExpression(variableDeclaration.initializer) + ? (variableDeclaration.initializer.expression as ts.Identifier) + : undefined; if (!identifier) { return; } @@ -8044,9 +8028,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const faultId = - propertyAccess.name.text === DEPRECATED_TASKPOOL_METHOD_SETCLONELIST ? - FaultID.SetCloneListDeprecated : - FaultID.SetTransferListDeprecated; + propertyAccess.name.text === DEPRECATED_TASKPOOL_METHOD_SETCLONELIST + ? FaultID.SetCloneListDeprecated + : FaultID.SetTransferListDeprecated; this.incrementCounters(node.parent, faultId); } @@ -8128,9 +8112,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { defaultImport: ts.Identifier | undefined ): boolean { return ( - defaultIsForbidden && forbiddenNamedCount === namedImportsCount || - defaultIsForbidden && namedImportsCount === 0 || - !defaultImport && forbiddenNamedCount === namedImportsCount && namedImportsCount > 0 + (defaultIsForbidden && forbiddenNamedCount === namedImportsCount) || + (defaultIsForbidden && namedImportsCount === 0) || + (!defaultImport && forbiddenNamedCount === namedImportsCount && namedImportsCount > 0) ); } @@ -8629,9 +8613,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } - const parentType = node.type ? - this.tsTypeChecker.getTypeAtLocation(node.type) : - this.tsTypeChecker.getTypeAtLocation(node.initializer); + const parentType = node.type + ? this.tsTypeChecker.getTypeAtLocation(node.type) + : this.tsTypeChecker.getTypeAtLocation(node.initializer); this.processNestedObjectLiterals(node.initializer, parentType); } @@ -8983,7 +8967,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return (type.flags & ts.TypeFlags.Number) !== 0 || (type.flags & ts.TypeFlags.NumberLiteral) !== 0; }; - const isBigIntAndNumberOperand = isNumber(leftType) && isBigInt(rightType) || isBigInt(leftType) && isNumber(rightType); + const isBigIntAndNumberOperand = + (isNumber(leftType) && isBigInt(rightType)) || (isBigInt(leftType) && isNumber(rightType)); if (isBigIntAndNumberOperand) { this.incrementCounters(node, FaultID.NumericBigintCompare); } @@ -8995,7 +8980,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const literalText = node.getText(); - if ((/^0[box]/i).test(literalText)) { + if (/^0[box]/i.test(literalText)) { this.incrementCounters(node, FaultID.NondecimalBigint); } } @@ -9084,13 +9069,13 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const isNoNeedFix = isInElementAccessExpression(node) || ts.isEnumMember(node.parent) || - 'name' in node.parent && node.parent.name === node; + ('name' in node.parent && node.parent.name === node); if (isNoNeedFix) { return; } const value = parseFloat(node.text); const nodeText = node.getText(); - const hasScientificOrRadixNotation = (/[a-zA-Z]/).test(nodeText); + const hasScientificOrRadixNotation = /[a-zA-Z]/.test(nodeText); const isIntegerWithoutZero = Number.isInteger(value) && !nodeText.endsWith('.0'); if (isIntegerWithoutZero && !hasScientificOrRadixNotation) { const autofix = this.autofixer?.fixNumericLiteralIntToNumber(node); diff --git a/ets2panda/linter/src/lib/utils/TsUtils.ts b/ets2panda/linter/src/lib/utils/TsUtils.ts index 2327bf026c6..00466a8740e 100644 --- a/ets2panda/linter/src/lib/utils/TsUtils.ts +++ b/ets2panda/linter/src/lib/utils/TsUtils.ts @@ -3654,7 +3654,7 @@ export class TsUtils { ) { return false; } - + return true; } current = current.parent; diff --git a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.args.json b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.args.json index 3318ebbbcfd..b13bb90d5b5 100755 --- a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.args.json +++ b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.args.json @@ -1,21 +1,21 @@ -{ - "copyright": [ - "Copyright (c) 2025 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." - ], - "mode": { - "arkts2": "", - "autofix": "--arkts-2", - "migrate": "--arkts-2" - } -} +{ + "copyright": [ + "Copyright (c) 2025 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." + ], + "mode": { + "arkts2": "", + "autofix": "--arkts-2", + "migrate": "--arkts-2" + } +} diff --git a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.arkts2.json b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.arkts2.json old mode 100755 new mode 100644 index f069ac9eeb2..0c62298c9df --- a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.arkts2.json +++ b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.arkts2.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 16, @@ -44,16 +44,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 17, - "column": 9, - "endLine": 17, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 18, "column": 9, @@ -64,16 +54,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 18, - "column": 9, - "endLine": 18, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 19, "column": 1, @@ -205,4 +185,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.autofix.json b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.autofix.json old mode 100755 new mode 100644 index 18043cd8a08..42626913be8 --- a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.autofix.json +++ b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.autofix.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 16, @@ -75,27 +75,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 17, - "column": 9, - "endLine": 17, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('a').toNumber()", - "start": 674, - "end": 679, - "line": 17, - "column": 9, - "endLine": 17, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 18, "column": 9, @@ -117,27 +96,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 18, - "column": 9, - "endLine": 18, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('b').toNumber()", - "start": 688, - "end": 693, - "line": 18, - "column": 9, - "endLine": 18, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 19, "column": 1, @@ -280,4 +238,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.arkts2.json b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.arkts2.json old mode 100755 new mode 100644 index 5e29c71a765..b5b1113e620 --- a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.arkts2.json +++ b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.arkts2.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 16, @@ -54,26 +54,6 @@ "rule": "Interop objects can't be incremented or decremented (arkts-interop-js2s-self-addtion-reduction)", "severity": "ERROR" }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 12, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 12, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 19, "column": 5, @@ -84,26 +64,6 @@ "rule": "Interop objects can't be incremented or decremented (arkts-interop-js2s-self-addtion-reduction)", "severity": "ERROR" }, - { - "line": 19, - "column": 7, - "endLine": 19, - "endColumn": 14, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 7, - "endLine": 19, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 5, @@ -114,26 +74,6 @@ "rule": "Interop objects can't be incremented or decremented (arkts-interop-js2s-self-addtion-reduction)", "severity": "ERROR" }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 12, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 12, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 5, @@ -143,26 +83,6 @@ "suggest": "", "rule": "Interop objects can't be incremented or decremented (arkts-interop-js2s-self-addtion-reduction)", "severity": "ERROR" - }, - { - "line": 21, - "column": 7, - "endLine": 21, - "endColumn": 14, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 7, - "endLine": 21, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.autofix.json b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.autofix.json old mode 100755 new mode 100644 index 06540703433..cb8b5aa5f16 --- a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.autofix.json +++ b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.autofix.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 16, @@ -85,48 +85,6 @@ "rule": "Interop objects can't be incremented or decremented (arkts-interop-js2s-self-addtion-reduction)", "severity": "ERROR" }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 12, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 690, - "end": 697, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 12 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 12, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 690, - "end": 697, - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 12 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 19, "column": 5, @@ -137,48 +95,6 @@ "rule": "Interop objects can't be incremented or decremented (arkts-interop-js2s-self-addtion-reduction)", "severity": "ERROR" }, - { - "line": 19, - "column": 7, - "endLine": 19, - "endColumn": 14, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 706, - "end": 713, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 19, - "column": 7, - "endLine": 19, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 7, - "endLine": 19, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 706, - "end": 713, - "line": 19, - "column": 7, - "endLine": 19, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 5, @@ -189,48 +105,6 @@ "rule": "Interop objects can't be incremented or decremented (arkts-interop-js2s-self-addtion-reduction)", "severity": "ERROR" }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 12, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 718, - "end": 725, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 12 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 12, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 718, - "end": 725, - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 12 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 5, @@ -240,48 +114,6 @@ "suggest": "", "rule": "Interop objects can't be incremented or decremented (arkts-interop-js2s-self-addtion-reduction)", "severity": "ERROR" - }, - { - "line": 21, - "column": 7, - "endLine": 21, - "endColumn": 14, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 734, - "end": 741, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 21, - "column": 7, - "endLine": 21, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 7, - "endLine": 21, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 734, - "end": 741, - "line": 21, - "column": 7, - "endLine": 21, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.ets b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.ets index 3be959d07a4..a5a2a4f6656 100644 --- a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.ets +++ b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.ets @@ -17,7 +17,7 @@ let GeneratedImportVar_1 = ESValue.load('./increases_decreases_js_obj_js'); let foo = GeneratedImportVar_1.getPropertyByName('foo'); let a: number =0.0 -a = foo.getPropertyByName("num")++ -a = ++foo.getPropertyByName("num") -a = foo.getPropertyByName("num")-- -a = --foo.getPropertyByName("num") +a = foo.num++ +a = ++foo.num +a = foo.num-- +a = --foo.num diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json b/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json old mode 100755 new mode 100644 index b6255d07e7a..5d17ccc9578 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json @@ -44,26 +44,6 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, - { - "line": 19, - "column": 18, - "endLine": 19, - "endColumn": 25, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 18, - "endLine": 19, - "endColumn": 25, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 20, @@ -74,26 +54,6 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, - { - "line": 20, - "column": 20, - "endLine": 20, - "endColumn": 29, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 20, - "endLine": 20, - "endColumn": 29, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 19, @@ -104,26 +64,6 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, - { - "line": 21, - "column": 19, - "endLine": 21, - "endColumn": 27, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 19, - "endLine": 21, - "endColumn": 27, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 22, "column": 19, @@ -134,26 +74,6 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, - { - "line": 22, - "column": 19, - "endLine": 22, - "endColumn": 27, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 19, - "endLine": 22, - "endColumn": 27, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 25, "column": 9, @@ -265,4 +185,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json b/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json index 5aca1b631b2..97d2c4c956a 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json @@ -13,7 +13,7 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], -"result": [ + "result": [ { "line": 17, "column": 2, @@ -75,48 +75,6 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, - { - "line": 19, - "column": 18, - "endLine": 19, - "endColumn": 25, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 761, - "end": 768, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 19, - "column": 18, - "endLine": 19, - "endColumn": 25 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 18, - "endLine": 19, - "endColumn": 25, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num')", - "start": 761, - "end": 768, - "line": 19, - "column": 18, - "endLine": 19, - "endColumn": 25 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 20, @@ -138,48 +96,6 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, - { - "line": 20, - "column": 20, - "endLine": 20, - "endColumn": 29, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 799, - "end": 808, - "replacementText": "foo2.getPropertyByName(\"bool\")", - "line": 20, - "column": 20, - "endLine": 20, - "endColumn": 29 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 20, - "endLine": 20, - "endColumn": 29, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo2.getPropertyByName('bool').toBoolean()", - "start": 799, - "end": 808, - "line": 20, - "column": 20, - "endLine": 20, - "endColumn": 29 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 19, @@ -201,48 +117,6 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, - { - "line": 21, - "column": 19, - "endLine": 21, - "endColumn": 27, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 840, - "end": 848, - "replacementText": "foo3.getPropertyByName(\"str\")", - "line": 21, - "column": 19, - "endLine": 21, - "endColumn": 27 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 19, - "endLine": 21, - "endColumn": 27, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo3.getPropertyByName('str').toString()", - "start": 840, - "end": 848, - "line": 21, - "column": 19, - "endLine": 21, - "endColumn": 27 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 22, "column": 19, @@ -264,48 +138,6 @@ "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, - { - "line": 22, - "column": 19, - "endLine": 22, - "endColumn": 27, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 879, - "end": 887, - "replacementText": "foo4.getPropertyByName(\"big\")", - "line": 22, - "column": 19, - "endLine": 22, - "endColumn": 27 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 19, - "endLine": 22, - "endColumn": 27, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo4.getPropertyByName('big')", - "start": 879, - "end": 887, - "line": 22, - "column": 19, - "endLine": 22, - "endColumn": 27 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 25, "column": 9, @@ -483,4 +315,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/interop_import_js_compare.ets.arkts2.json b/ets2panda/linter/test/interop/interop_import_js_compare.ets.arkts2.json index 4ce217d61eb..01f68ccd15f 100644 --- a/ets2panda/linter/test/interop/interop_import_js_compare.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_import_js_compare.ets.arkts2.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 18, @@ -44,16 +44,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 19, - "column": 9, - "endLine": 19, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 9, @@ -64,16 +54,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 20, - "column": 9, - "endLine": 20, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 1, @@ -303,46 +283,6 @@ "suggest": "", "rule": "Importing data directly from the \"JS\" module for comparison is not supported (arkts-interop-js2s-compare-js-data)", "severity": "ERROR" - }, - { - "line": 44, - "column": 1, - "endLine": 44, - "endColumn": 6, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 44, - "column": 1, - "endLine": 44, - "endColumn": 6, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 44, - "column": 9, - "endLine": 44, - "endColumn": 14, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 44, - "column": 9, - "endLine": 44, - "endColumn": 14, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" } ] } diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.arkts2.json b/ets2panda/linter/test/interop/interop_import_js_index.ets.arkts2.json index 01e50a4c695..936f74d4e90 100644 --- a/ets2panda/linter/test/interop/interop_import_js_index.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_import_js_index.ets.arkts2.json @@ -1,4 +1,18 @@ { + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 17, @@ -30,16 +44,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 18, - "column": 11, - "endLine": 18, - "endColumn": 18, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 19, "column": 1, @@ -111,4 +115,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json index f5e605ca862..9f7afd6daec 100644 --- a/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 17, @@ -43,7 +43,11 @@ { "start": 667, "end": 667, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_index_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n" + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_index_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 49 } ], "suggest": "", @@ -71,27 +75,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 18, - "column": 11, - "endLine": 18, - "endColumn": 18, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('arr')", - "start": 678, - "end": 685, - "line": 18, - "column": 11, - "endLine": 18, - "endColumn": 18 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 19, "column": 1, @@ -185,7 +168,11 @@ { "start": 693, "end": 703, - "replacementText": "arr.setPropertyByIndex(3, ESValue.wrap(4))" + "replacementText": "arr.setPropertyByIndex(3, ESValue.wrap(4))", + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 11 } ], "suggest": "", diff --git a/ets2panda/linter/test/interop/interop_import_js_rules.ets.arkts2.json b/ets2panda/linter/test/interop/interop_import_js_rules.ets.arkts2.json index 299b2732c88..10502d4c5a4 100644 --- a/ets2panda/linter/test/interop/interop_import_js_rules.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_import_js_rules.ets.arkts2.json @@ -194,16 +194,6 @@ "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, - { - "line": 31, - "column": 5, - "endLine": 31, - "endColumn": 15, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, { "line": 31, "column": 5, @@ -224,16 +214,6 @@ "rule": "Importing data directly from the \"JS\" module for comparison is not supported (arkts-interop-js2s-compare-js-data)", "severity": "ERROR" }, - { - "line": 33, - "column": 5, - "endLine": 33, - "endColumn": 11, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, { "line": 33, "column": 5, @@ -314,26 +294,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 49, - "column": 11, - "endLine": 49, - "endColumn": 18, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 50, - "column": 11, - "endLine": 50, - "endColumn": 21, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 53, "column": 3, @@ -594,26 +554,6 @@ "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", "severity": "ERROR" }, - { - "line": 79, - "column": 5, - "endLine": 79, - "endColumn": 24, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 79, - "column": 5, - "endLine": 79, - "endColumn": 24, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 79, "column": 29, diff --git a/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json index 4e7f1b6c7ac..39594fb1332 100644 --- a/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json @@ -1,1149 +1,1023 @@ { "copyright": [ - "Copyright (c) 2025 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." + "Copyright (c) 2025 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." ], - "result": [ - { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 51, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 51, - "problem": "InterOpImportJs", - "autofix": [ + "result": [ + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 51, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 619, - "end": 669, - "replacementText": "", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 51 + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 51, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 619, + "end": 669, + "replacementText": "", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 51 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_rules_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 51 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_rules_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 51 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 56, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 56, - "problem": "InterOpImportJs", - "autofix": [ + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 56, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 670, - "end": 725, - "replacementText": "", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 56 + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 56, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 670, + "end": 725, + "replacementText": "", + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 56 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_rules_js');\nlet ff1 = GeneratedImportVar_2.getPropertyByName('ff1');\nlet ff2 = GeneratedImportVar_2.getPropertyByName('ff2');\n", + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 56 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_rules_js');\nlet ff1 = GeneratedImportVar_2.getPropertyByName('ff1');\nlet ff2 = GeneratedImportVar_2.getPropertyByName('ff2');\n", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 56 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 49, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 49, - "problem": "InterOpImportJs", - "autofix": [ + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 49, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 727, - "end": 775, - "replacementText": "", - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 49 + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 49, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 727, + "end": 775, + "replacementText": "", + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 49 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_3 = ESValue.load('./interop_import_js_rules_js');\nlet A = GeneratedImportVar_3.getPropertyByName('A');\n", + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 49 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_3 = ESValue.load('./interop_import_js_rules_js');\nlet A = GeneratedImportVar_3.getPropertyByName('A');\n", - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 49 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 49, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 49, - "problem": "InterOpImportJs", - "autofix": [ + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 49, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 776, - "end": 824, - "replacementText": "", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 49 + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 49, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 776, + "end": 824, + "replacementText": "", + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 49 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_4 = ESValue.load('./interop_import_js_rules_js');\nlet C = GeneratedImportVar_4.getPropertyByName('C');\n", + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 49 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_4 = ESValue.load('./interop_import_js_rules_js');\nlet C = GeneratedImportVar_4.getPropertyByName('C');\n", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 49 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 51, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 51, - "problem": "InterOpImportJs", - "autofix": [ + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 51, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 826, - "end": 876, - "replacementText": "", - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 51 + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 51, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 826, + "end": 876, + "replacementText": "", + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 51 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_5 = ESValue.load('./interop_import_js_rules_js');\nlet ff3 = GeneratedImportVar_5.getPropertyByName('ff3');\n", + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 51 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_5 = ESValue.load('./interop_import_js_rules_js');\nlet ff3 = GeneratedImportVar_5.getPropertyByName('ff3');\n", - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 51 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 51, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 51, - "problem": "InterOpImportJs", - "autofix": [ + "line": 25, + "column": 1, + "endLine": 25, + "endColumn": 51, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 878, - "end": 928, - "replacementText": "", - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 51 + "line": 25, + "column": 1, + "endLine": 25, + "endColumn": 51, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 878, + "end": 928, + "replacementText": "", + "line": 25, + "column": 1, + "endLine": 25, + "endColumn": 51 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_6 = ESValue.load('./interop_import_js_rules_js');\nlet ff4 = GeneratedImportVar_6.getPropertyByName('ff4');\n", + "line": 25, + "column": 1, + "endLine": 25, + "endColumn": 51 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_6 = ESValue.load('./interop_import_js_rules_js');\nlet ff4 = GeneratedImportVar_6.getPropertyByName('ff4');\n", - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 51 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 54, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 54, - "problem": "InterOpImportJs", - "autofix": [ + "line": 27, + "column": 1, + "endLine": 27, + "endColumn": 54, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 930, - "end": 983, - "replacementText": "", - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 54 + "line": 27, + "column": 1, + "endLine": 27, + "endColumn": 54, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 930, + "end": 983, + "replacementText": "", + "line": 27, + "column": 1, + "endLine": 27, + "endColumn": 54 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_7 = ESValue.load('./interop_import_js_rules_js');\nlet handle = GeneratedImportVar_7.getPropertyByName('handle');\n", + "line": 27, + "column": 1, + "endLine": 27, + "endColumn": 54 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_7 = ESValue.load('./interop_import_js_rules_js');\nlet handle = GeneratedImportVar_7.getPropertyByName('handle');\n", - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 54 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 54, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 54, - "problem": "InterOpImportJs", - "autofix": [ + "line": 29, + "column": 1, + "endLine": 29, + "endColumn": 54, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 985, - "end": 1038, - "replacementText": "", - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 54 + "line": 29, + "column": 1, + "endLine": 29, + "endColumn": 54, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 985, + "end": 1038, + "replacementText": "", + "line": 29, + "column": 1, + "endLine": 29, + "endColumn": 54 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_8 = ESValue.load('./interop_import_js_rules_js');\nlet expand = GeneratedImportVar_8.getPropertyByName('expand');\n", + "line": 29, + "column": 1, + "endLine": 29, + "endColumn": 54 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_8 = ESValue.load('./interop_import_js_rules_js');\nlet expand = GeneratedImportVar_8.getPropertyByName('expand');\n", - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 54 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 30, - "column": 1, - "endLine": 30, - "endColumn": 54, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 30, - "column": 1, - "endLine": 30, - "endColumn": 54, - "problem": "InterOpImportJs", - "autofix": [ + "line": 30, + "column": 1, + "endLine": 30, + "endColumn": 54, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, { - "start": 1039, - "end": 1092, - "replacementText": "", - "line": 30, - "column": 1, - "endLine": 30, - "endColumn": 54 + "line": 30, + "column": 1, + "endLine": 30, + "endColumn": 54, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 1039, + "end": 1092, + "replacementText": "", + "line": 30, + "column": 1, + "endLine": 30, + "endColumn": 54 + }, + { + "start": 1092, + "end": 1092, + "replacementText": "let GeneratedImportVar_9 = ESValue.load('./interop_import_js_rules_js');\nlet orange = GeneratedImportVar_9.getPropertyByName('orange');\n", + "line": 30, + "column": 1, + "endLine": 30, + "endColumn": 54 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 1092, - "end": 1092, - "replacementText": "let GeneratedImportVar_9 = ESValue.load('./interop_import_js_rules_js');\nlet orange = GeneratedImportVar_9.getPropertyByName('orange');\n", - "line": 30, - "column": 1, - "endLine": 30, - "endColumn": 54 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 31, - "column": 5, - "endLine": 31, - "endColumn": 15, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 31, + "column": 5, + "endLine": 31, + "endColumn": 15, + "problem": "InteropJsObjectConditionJudgment", + "autofix": [ + { + "replacementText": "foo.getPropertyByName('isGood').toBoolean()", + "start": 1097, + "end": 1107, + "line": 31, + "column": 5, + "endLine": 31, + "endColumn": 15 + } + ], + "suggest": "", + "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-condition-judgment)", + "severity": "ERROR" + }, { - "start": 1097, - "end": 1107, - "replacementText": "foo.getPropertyByName(\"isGood\")", - "line": 31, - "column": 5, - "endLine": 31, - "endColumn": 15 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 31, - "column": 5, - "endLine": 31, - "endColumn": 15, - "problem": "InteropJsObjectConditionJudgment", - "autofix": [ + "line": 33, + "column": 5, + "endLine": 33, + "endColumn": 11, + "problem": "InterOpImportJsDataCompare", + "suggest": "", + "rule": "Importing data directly from the \"JS\" module for comparison is not supported (arkts-interop-js2s-compare-js-data)", + "severity": "ERROR" + }, { - "replacementText": "foo.getPropertyByName('isGood').toBoolean()", - "start": 1097, - "end": 1107, - "line": 31, - "column": 5, - "endLine": 31, - "endColumn": 15 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-condition-judgment)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 5, - "endLine": 33, - "endColumn": 11, - "problem": "InterOpImportJsDataCompare", - "suggest": "", - "rule": "Importing data directly from the \"JS\" module for comparison is not supported (arkts-interop-js2s-compare-js-data)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 5, - "endLine": 33, - "endColumn": 11, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 33, + "column": 5, + "endLine": 33, + "endColumn": 11, + "problem": "InteropJsObjectConditionJudgment", + "autofix": [ + { + "replacementText": "ff1.getPropertyByName('f1').toNumber()", + "start": 1117, + "end": 1123, + "line": 33, + "column": 5, + "endLine": 33, + "endColumn": 11 + } + ], + "suggest": "", + "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-condition-judgment)", + "severity": "ERROR" + }, { - "start": 1117, - "end": 1123, - "replacementText": "ff1.getPropertyByName(\"f1\")", - "line": 33, - "column": 5, - "endLine": 33, - "endColumn": 11 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 5, - "endLine": 33, - "endColumn": 11, - "problem": "InteropJsObjectConditionJudgment", - "autofix": [ + "line": 33, + "column": 14, + "endLine": 33, + "endColumn": 16, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1126, + "end": 1128, + "replacementText": "18.0", + "line": 33, + "column": 14, + "endLine": 33, + "endColumn": 16 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "replacementText": "ff1.getPropertyByName('f1').toNumber()", - "start": 1117, - "end": 1123, - "line": 33, - "column": 5, - "endLine": 33, - "endColumn": 11 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-condition-judgment)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 14, - "endLine": 33, - "endColumn": 16, - "problem": "NumericSemantics", - "autofix": [ + "line": 37, + "column": 1, + "endLine": 37, + "endColumn": 21, + "problem": "InteropJsObjectInheritance", + "suggest": "", + "rule": "Direct inheritance of interop JS classes is not supported (arkts-interop-js2s-inherit-js-class)", + "severity": "ERROR" + }, { - "start": 1126, - "end": 1128, - "replacementText": "18.0", - "line": 33, - "column": 14, - "endLine": 33, - "endColumn": 16 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 37, - "column": 1, - "endLine": 37, - "endColumn": 21, - "problem": "InteropJsObjectInheritance", - "suggest": "", - "rule": "Direct inheritance of interop JS classes is not supported (arkts-interop-js2s-inherit-js-class)", - "severity": "ERROR" - }, - { - "line": 41, - "column": 1, - "endLine": 41, - "endColumn": 21, - "problem": "InteropJsObjectInheritance", - "suggest": "", - "rule": "Direct inheritance of interop JS classes is not supported (arkts-interop-js2s-inherit-js-class)", - "severity": "ERROR" - }, - { - "line": 44, - "column": 3, - "endLine": 44, - "endColumn": 8, - "problem": "InteropJSFunctionInvoke", - "suggest": "", - "rule": "Trying to catch JS errors is not permitted (arkts-interop-js2s-js-exception)", - "severity": "ERROR" - }, - { - "line": 44, - "column": 3, - "endLine": 44, - "endColumn": 8, - "problem": "CallJSFunction", - "autofix": [ + "line": 41, + "column": 1, + "endLine": 41, + "endColumn": 21, + "problem": "InteropJsObjectInheritance", + "suggest": "", + "rule": "Direct inheritance of interop JS classes is not supported (arkts-interop-js2s-inherit-js-class)", + "severity": "ERROR" + }, { - "start": 1288, - "end": 1293, - "replacementText": "ff4.invoke()", - "line": 44, - "column": 3, - "endLine": 44, - "endColumn": 8 - } - ], - "suggest": "", - "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", - "severity": "ERROR" - }, - { - "line": 45, - "column": 3, - "endLine": 47, - "endColumn": 2, - "problem": "TsLikeCatchType", - "suggest": "", - "rule": "TS catch type are not supported (arkts-no-ts-like-catch-type)", - "severity": "ERROR" - }, - { - "line": 49, - "column": 11, - "endLine": 49, - "endColumn": 18, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 44, + "column": 3, + "endLine": 44, + "endColumn": 8, + "problem": "InteropJSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch JS errors is not permitted (arkts-interop-js2s-js-exception)", + "severity": "ERROR" + }, { - "start": 1343, - "end": 1350, - "replacementText": "ff3.getPropertyByName(\"arr\")", - "line": 49, - "column": 11, - "endLine": 49, - "endColumn": 18 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 49, - "column": 11, - "endLine": 49, - "endColumn": 18, - "problem": "InteropJsObjectUsage", - "autofix": [ + "line": 44, + "column": 3, + "endLine": 44, + "endColumn": 8, + "problem": "CallJSFunction", + "autofix": [ + { + "start": 1288, + "end": 1293, + "replacementText": "ff4.invoke()", + "line": 44, + "column": 3, + "endLine": 44, + "endColumn": 8 + } + ], + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, { - "replacementText": "ff3.getPropertyByName('arr')", - "start": 1343, - "end": 1350, - "line": 49, - "column": 11, - "endLine": 49, - "endColumn": 18 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 50, - "column": 11, - "endLine": 50, - "endColumn": 21, - "problem": "InteropJsObjectUsage", - "autofix": [ + "line": 45, + "column": 3, + "endLine": 47, + "endColumn": 2, + "problem": "TsLikeCatchType", + "suggest": "", + "rule": "TS catch type are not supported (arkts-no-ts-like-catch-type)", + "severity": "ERROR" + }, { - "replacementText": "arr.getPropertyByName('length').toNumber()", - "start": 1361, - "end": 1381, - "line": 50, - "column": 11, - "endLine": 50, - "endColumn": 21 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 53, - "column": 3, - "endLine": 53, - "endColumn": 9, - "problem": "RuntimeArrayCheck", - "suggest": "", - "rule": "Array bound not checked. (arkts-runtime-array-check)", - "severity": "ERROR" - }, - { - "line": 51, - "column": 10, - "endLine": 51, - "endColumn": 15, - "problem": "NumericSemantics", - "autofix": [ + "line": 49, + "column": 11, + "endLine": 49, + "endColumn": 18, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 1343, + "end": 1350, + "replacementText": "ff3.getPropertyByName(\"arr\")", + "line": 49, + "column": 11, + "endLine": 49, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, { - "start": 1391, - "end": 1396, - "replacementText": "i: number = 0", - "line": 51, - "column": 10, - "endLine": 51, - "endColumn": 15 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 51, - "column": 14, - "endLine": 51, - "endColumn": 15, - "problem": "NumericSemantics", - "autofix": [ + "line": 53, + "column": 3, + "endLine": 53, + "endColumn": 9, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, { - "start": 1395, - "end": 1396, - "replacementText": "0.0", - "line": 51, - "column": 14, - "endLine": 51, - "endColumn": 15 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 52, - "column": 11, - "endLine": 52, - "endColumn": 17, - "problem": "RuntimeArrayCheck", - "suggest": "", - "rule": "Array bound not checked. (arkts-runtime-array-check)", - "severity": "ERROR" - }, - { - "line": 52, - "column": 11, - "endLine": 52, - "endColumn": 17, - "problem": "InteropJsObjectTraverseJsInstance", - "autofix": [ + "line": 51, + "column": 10, + "endLine": 51, + "endColumn": 15, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1391, + "end": 1396, + "replacementText": "i: number = 0", + "line": 51, + "column": 10, + "endLine": 51, + "endColumn": 15 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "replacementText": "arr.getPropertyByIndex(i).toNumber()", - "start": 1424, - "end": 1430, - "line": 52, - "column": 11, - "endLine": 52, - "endColumn": 17 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-traverse-js-instance)", - "severity": "ERROR" - }, - { - "line": 52, - "column": 11, - "endLine": 52, - "endColumn": 17, - "problem": "InterOpImportJsIndex", - "autofix": [ + "line": 51, + "column": 14, + "endLine": 51, + "endColumn": 15, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1395, + "end": 1396, + "replacementText": "0.0", + "line": 51, + "column": 14, + "endLine": 51, + "endColumn": 15 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "start": 1424, - "end": 1430, - "replacementText": "arr.getPropertyByIndex(i)", - "line": 52, - "column": 11, - "endLine": 52, - "endColumn": 17 - } - ], - "suggest": "", - "rule": "Interop objects can't be indexed directly (arkts-interop-js2s-access-js-index)", - "severity": "ERROR" - }, - { - "line": 53, - "column": 3, - "endLine": 53, - "endColumn": 9, - "problem": "InteropJsObjectTraverseJsInstance", - "autofix": [ + "line": 52, + "column": 11, + "endLine": 52, + "endColumn": 17, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, { - "replacementText": "arr.setPropertyByIndex(i, ESValue.wrap(0))", - "start": 1433, - "end": 1443, - "line": 53, - "column": 3, - "endLine": 53, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-traverse-js-instance)", - "severity": "ERROR" - }, - { - "line": 53, - "column": 3, - "endLine": 53, - "endColumn": 13, - "problem": "InterOpImportJsIndex", - "autofix": [ + "line": 52, + "column": 11, + "endLine": 52, + "endColumn": 17, + "problem": "InteropJsObjectTraverseJsInstance", + "autofix": [ + { + "replacementText": "arr.getPropertyByIndex(i).toNumber()", + "start": 1424, + "end": 1430, + "line": 52, + "column": 11, + "endLine": 52, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-traverse-js-instance)", + "severity": "ERROR" + }, { - "start": 1433, - "end": 1443, - "replacementText": "arr.setPropertyByIndex(i, ESValue.wrap(0))", - "line": 53, - "column": 3, - "endLine": 53, - "endColumn": 13 - } - ], - "suggest": "", - "rule": "Interop objects can't be indexed directly (arkts-interop-js2s-access-js-index)", - "severity": "ERROR" - }, - { - "line": 53, - "column": 12, - "endLine": 53, - "endColumn": 13, - "problem": "NumericSemantics", - "autofix": [ + "line": 52, + "column": 11, + "endLine": 52, + "endColumn": 17, + "problem": "InterOpImportJsIndex", + "autofix": [ + { + "start": 1424, + "end": 1430, + "replacementText": "arr.getPropertyByIndex(i)", + "line": 52, + "column": 11, + "endLine": 52, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "Interop objects can't be indexed directly (arkts-interop-js2s-access-js-index)", + "severity": "ERROR" + }, { - "start": 1442, - "end": 1443, - "replacementText": "0.0", - "line": 53, - "column": 12, - "endLine": 53, - "endColumn": 13 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 63, - "column": 8, - "endLine": 63, - "endColumn": 12, - "problem": "InteropJsObjectCallStaticFunc", - "suggest": "", - "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-call-static-function)", - "severity": "ERROR" - }, - { - "line": 63, - "column": 1, - "endLine": 63, - "endColumn": 13, - "problem": "CallJSFunction", - "autofix": [ + "line": 53, + "column": 3, + "endLine": 53, + "endColumn": 9, + "problem": "InteropJsObjectTraverseJsInstance", + "autofix": [ + { + "replacementText": "arr.setPropertyByIndex(i, ESValue.wrap(0))", + "start": 1433, + "end": 1443, + "line": 53, + "column": 3, + "endLine": 53, + "endColumn": 9 + } + ], + "suggest": "", + "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-traverse-js-instance)", + "severity": "ERROR" + }, { - "start": 1544, - "end": 1556, - "replacementText": "handle.invoke(ESValue.wrap(foo2))", - "line": 63, - "column": 1, - "endLine": 63, - "endColumn": 13 - } - ], - "suggest": "", - "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", - "severity": "ERROR" - }, - { - "line": 64, - "column": 8, - "endLine": 64, - "endColumn": 14, - "problem": "InteropJsObjectCallStaticFunc", - "suggest": "", - "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-call-static-function)", - "severity": "ERROR" - }, - { - "line": 64, - "column": 1, - "endLine": 64, - "endColumn": 15, - "problem": "CallJSFunction", - "autofix": [ + "line": 53, + "column": 3, + "endLine": 53, + "endColumn": 13, + "problem": "InterOpImportJsIndex", + "autofix": [ + { + "start": 1433, + "end": 1443, + "replacementText": "arr.setPropertyByIndex(i, ESValue.wrap(0))", + "line": 53, + "column": 3, + "endLine": 53, + "endColumn": 13 + } + ], + "suggest": "", + "rule": "Interop objects can't be indexed directly (arkts-interop-js2s-access-js-index)", + "severity": "ERROR" + }, { - "start": 1557, - "end": 1571, - "replacementText": "handle.invoke(ESValue.wrap(lambda))", - "line": 64, - "column": 1, - "endLine": 64, - "endColumn": 15 - } - ], - "suggest": "", - "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 9, - "endLine": 66, - "endColumn": 15, - "problem": "NumericSemantics", - "autofix": [ + "line": 53, + "column": 12, + "endLine": 53, + "endColumn": 13, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1442, + "end": 1443, + "replacementText": "0.0", + "line": 53, + "column": 12, + "endLine": 53, + "endColumn": 13 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "start": 1581, - "end": 1587, - "replacementText": "a: number = 1;", - "line": 66, - "column": 9, - "endLine": 66, - "endColumn": 15 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 13, - "endLine": 66, - "endColumn": 14, - "problem": "NumericSemantics", - "autofix": [ + "line": 63, + "column": 8, + "endLine": 63, + "endColumn": 12, + "problem": "InteropJsObjectCallStaticFunc", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-call-static-function)", + "severity": "ERROR" + }, { - "start": 1585, - "end": 1586, - "replacementText": "1.0", - "line": 66, - "column": 13, - "endLine": 66, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 16, - "endLine": 66, - "endColumn": 21, - "problem": "NumericSemantics", - "autofix": [ + "line": 63, + "column": 1, + "endLine": 63, + "endColumn": 13, + "problem": "CallJSFunction", + "autofix": [ + { + "start": 1544, + "end": 1556, + "replacementText": "handle.invoke(ESValue.wrap(foo2))", + "line": 63, + "column": 1, + "endLine": 63, + "endColumn": 13 + } + ], + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, { - "start": 1588, - "end": 1593, - "replacementText": "b: number = 2;", - "line": 66, - "column": 16, - "endLine": 66, - "endColumn": 21 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 19, - "endLine": 66, - "endColumn": 20, - "problem": "NumericSemantics", - "autofix": [ + "line": 64, + "column": 8, + "endLine": 64, + "endColumn": 14, + "problem": "InteropJsObjectCallStaticFunc", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-call-static-function)", + "severity": "ERROR" + }, { - "start": 1591, - "end": 1592, - "replacementText": "2.0", - "line": 66, - "column": 19, - "endLine": 66, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 22, - "endLine": 66, - "endColumn": 26, - "problem": "NumericSemantics", - "autofix": [ + "line": 64, + "column": 1, + "endLine": 64, + "endColumn": 15, + "problem": "CallJSFunction", + "autofix": [ + { + "start": 1557, + "end": 1571, + "replacementText": "handle.invoke(ESValue.wrap(lambda))", + "line": 64, + "column": 1, + "endLine": 64, + "endColumn": 15 + } + ], + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, { - "start": 1594, - "end": 1598, - "replacementText": "c: number = 3;", - "line": 66, - "column": 22, - "endLine": 66, - "endColumn": 26 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 25, - "endLine": 66, - "endColumn": 26, - "problem": "NumericSemantics", - "autofix": [ + "line": 66, + "column": 9, + "endLine": 66, + "endColumn": 15, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1581, + "end": 1587, + "replacementText": "a: number = 1;", + "line": 66, + "column": 9, + "endLine": 66, + "endColumn": 15 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "start": 1597, - "end": 1598, - "replacementText": "3.0", - "line": 66, - "column": 25, - "endLine": 66, - "endColumn": 26 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 67, - "column": 8, - "endLine": 67, - "endColumn": 15, - "problem": "InteropJsObjectExpandStaticInstance", - "suggest": "", - "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", - "severity": "ERROR" - }, - { - "line": 67, - "column": 1, - "endLine": 67, - "endColumn": 16, - "problem": "CallJSFunction", - "autofix": [ + "line": 66, + "column": 13, + "endLine": 66, + "endColumn": 14, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1585, + "end": 1586, + "replacementText": "1.0", + "line": 66, + "column": 13, + "endLine": 66, + "endColumn": 14 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "start": 1600, - "end": 1615, - "replacementText": "expand.invoke(ESValue.wrap(new X()))", - "line": 67, - "column": 1, - "endLine": 67, - "endColumn": 16 - } - ], - "suggest": "", - "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", - "severity": "ERROR" - }, - { - "line": 76, - "column": 8, - "endLine": 76, - "endColumn": 13, - "problem": "InteropJsObjectExpandStaticInstance", - "suggest": "", - "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", - "severity": "ERROR" - }, - { - "line": 76, - "column": 1, - "endLine": 76, - "endColumn": 14, - "problem": "CallJSFunction", - "autofix": [ + "line": 66, + "column": 16, + "endLine": 66, + "endColumn": 21, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1588, + "end": 1593, + "replacementText": "b: number = 2;", + "line": 66, + "column": 16, + "endLine": 66, + "endColumn": 21 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "start": 1749, - "end": 1762, - "replacementText": "expand.invoke(ESValue.wrap(testY))", - "line": 76, - "column": 1, - "endLine": 76, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", - "severity": "ERROR" - }, - { - "line": 77, - "column": 8, - "endLine": 77, - "endColumn": 38, - "problem": "InteropJsObjectExpandStaticInstance", - "suggest": "", - "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", - "severity": "ERROR" - }, - { - "line": 77, - "column": 1, - "endLine": 77, - "endColumn": 39, - "problem": "CallJSFunction", - "autofix": [ + "line": 66, + "column": 19, + "endLine": 66, + "endColumn": 20, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1591, + "end": 1592, + "replacementText": "2.0", + "line": 66, + "column": 19, + "endLine": 66, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "start": 1764, - "end": 1802, - "replacementText": "expand.invoke(ESValue.wrap({x: '1', y: \"hello\", z: false}))", - "line": 77, - "column": 1, - "endLine": 77, - "endColumn": 39 - } - ], - "suggest": "", - "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", - "severity": "ERROR" - }, - { - "line": 79, - "column": 5, - "endLine": 79, - "endColumn": 32, - "problem": "InteropEqualityJudgment", - "autofix": [ + "line": 66, + "column": 22, + "endLine": 66, + "endColumn": 26, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1594, + "end": 1598, + "replacementText": "c: number = 3;", + "line": 66, + "column": 22, + "endLine": 66, + "endColumn": 26 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "start": 1826, - "end": 1853, - "replacementText": "orange.isVegetable1.areStrictlyEqual(123)", - "line": 79, - "column": 5, - "endLine": 79, - "endColumn": 32 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 79, - "column": 5, - "endLine": 79, - "endColumn": 24, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 66, + "column": 25, + "endLine": 66, + "endColumn": 26, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1597, + "end": 1598, + "replacementText": "3.0", + "line": 66, + "column": 25, + "endLine": 66, + "endColumn": 26 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, { - "start": 1826, - "end": 1845, - "replacementText": "orange.getPropertyByName(\"isVegetable1\")", - "line": 79, - "column": 5, - "endLine": 79, - "endColumn": 24 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 79, - "column": 5, - "endLine": 79, - "endColumn": 24, - "problem": "InteropJsObjectUsage", - "autofix": [ + "line": 67, + "column": 8, + "endLine": 67, + "endColumn": 15, + "problem": "InteropJsObjectExpandStaticInstance", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", + "severity": "ERROR" + }, { - "replacementText": "orange.getPropertyByName('isVegetable1').toNumber()", - "start": 1826, - "end": 1845, - "line": 79, - "column": 5, - "endLine": 79, - "endColumn": 24 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 79, - "column": 29, - "endLine": 79, - "endColumn": 32, - "problem": "NumericSemantics", - "autofix": [ + "line": 67, + "column": 1, + "endLine": 67, + "endColumn": 16, + "problem": "CallJSFunction", + "autofix": [ + { + "start": 1600, + "end": 1615, + "replacementText": "expand.invoke(ESValue.wrap(new X()))", + "line": 67, + "column": 1, + "endLine": 67, + "endColumn": 16 + } + ], + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, { - "start": 1850, - "end": 1853, - "replacementText": "123.0", - "line": 79, - "column": 29, - "endLine": 79, - "endColumn": 32 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - } - ] + "line": 76, + "column": 8, + "endLine": 76, + "endColumn": 13, + "problem": "InteropJsObjectExpandStaticInstance", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", + "severity": "ERROR" + }, + { + "line": 76, + "column": 1, + "endLine": 76, + "endColumn": 14, + "problem": "CallJSFunction", + "autofix": [ + { + "start": 1749, + "end": 1762, + "replacementText": "expand.invoke(ESValue.wrap(testY))", + "line": 76, + "column": 1, + "endLine": 76, + "endColumn": 14 + } + ], + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, + { + "line": 77, + "column": 8, + "endLine": 77, + "endColumn": 38, + "problem": "InteropJsObjectExpandStaticInstance", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", + "severity": "ERROR" + }, + { + "line": 77, + "column": 1, + "endLine": 77, + "endColumn": 39, + "problem": "CallJSFunction", + "autofix": [ + { + "start": 1764, + "end": 1802, + "replacementText": "expand.invoke(ESValue.wrap({x: '1', y: \"hello\", z: false}))", + "line": 77, + "column": 1, + "endLine": 77, + "endColumn": 39 + } + ], + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, + { + "line": 79, + "column": 5, + "endLine": 79, + "endColumn": 32, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 1826, + "end": 1853, + "replacementText": "orange.isVegetable1.areStrictlyEqual(123)", + "line": 79, + "column": 5, + "endLine": 79, + "endColumn": 32 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 79, + "column": 29, + "endLine": 79, + "endColumn": 32, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1850, + "end": 1853, + "replacementText": "123.0", + "line": 79, + "column": 29, + "endLine": 79, + "endColumn": 32 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] } diff --git a/ets2panda/linter/test/interop/interop_import_js_rules.ets.json b/ets2panda/linter/test/interop/interop_import_js_rules.ets.json index 097539546e6..ab212bc3f39 100644 --- a/ets2panda/linter/test/interop/interop_import_js_rules.ets.json +++ b/ets2panda/linter/test/interop/interop_import_js_rules.ets.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 17, diff --git a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.arkts2.json b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.arkts2.json old mode 100755 new mode 100644 index 07bd2108126..ed93f8dd36e --- a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.arkts2.json @@ -1,488 +1,428 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], - "result": [ - { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 69, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 69, - "problem": "InterOpImportJs", - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 54, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 54, - "problem": "InterOpImportJs", - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 55, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 55, - "problem": "InterOpImportJs", - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 15, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 11, - "endLine": 22, - "endColumn": 18, - "problem": "CallJSFunction", - "suggest": "", - "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 11, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 19, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 8, - "endLine": 25, - "endColumn": 19, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 1, - "endLine": 26, - "endColumn": 20, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 8, - "endLine": 26, - "endColumn": 20, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 12, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 1, - "endLine": 28, - "endColumn": 17, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 8, - "endLine": 28, - "endColumn": 17, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 8, - "endLine": 28, - "endColumn": 17, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 12, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 30, - "column": 11, - "endLine": 30, - "endColumn": 20, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 30, - "column": 11, - "endLine": 30, - "endColumn": 20, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 32, - "column": 23, - "endLine": 32, - "endColumn": 35, - "problem": "InstantiatedJsOjbect", - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 1, - "endLine": 33, - "endColumn": 20, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 8, - "endLine": 33, - "endColumn": 20, - "problem": "InstantiatedJsOjbect", - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 35, - "column": 21, - "endLine": 35, - "endColumn": 33, - "problem": "InstantiatedJsOjbect", - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 37, - "column": 12, - "endLine": 37, - "endColumn": 28, - "problem": "InteropCallObjectMethods", - "suggest": "", - "rule": "Calling methods of JS Object directly in interop is not allowed (arkts-interop-js2s-call-js-method)", - "severity": "ERROR" - }, - { - "line": 43, - "column": 10, - "endLine": 43, - "endColumn": 28, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 43, - "column": 24, - "endLine": 43, - "endColumn": 27, - "problem": "NumericSemantics", - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 45, - "column": 3, - "endLine": 45, - "endColumn": 22, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 45, - "column": 10, - "endLine": 45, - "endColumn": 22, - "problem": "InstantiatedJsOjbect", - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 48, - "column": 21, - "endLine": 48, - "endColumn": 39, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 48, - "column": 35, - "endLine": 48, - "endColumn": 38, - "problem": "NumericSemantics", - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 50, - "column": 7, - "endLine": 50, - "endColumn": 13, - "problem": "InvalidIdentifier", - "suggest": "", - "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", - "severity": "ERROR" - }, - { - "line": 62, - "column": 5, - "endLine": 62, - "endColumn": 21, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 62, - "column": 12, - "endLine": 62, - "endColumn": 21, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 62, - "column": 12, - "endLine": 62, - "endColumn": 21, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 28, - "endLine": 66, - "endColumn": 47, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 35, - "endLine": 66, - "endColumn": 47, - "problem": "InstantiatedJsOjbect", - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 70, - "column": 1, - "endLine": 70, - "endColumn": 13, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 71, - "column": 1, - "endLine": 71, - "endColumn": 25, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 71, - "column": 8, - "endLine": 71, - "endColumn": 25, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 71, - "column": 8, - "endLine": 71, - "endColumn": 20, - "problem": "InstantiatedJsOjbect", - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 72, - "column": 1, - "endLine": 72, - "endColumn": 30, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 72, - "column": 8, - "endLine": 72, - "endColumn": 20, - "problem": "InstantiatedJsOjbect", - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 1, - "endLine": 73, - "endColumn": 31, - "problem": "InterOpImportJsForTypeOf", - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 8, - "endLine": 73, - "endColumn": 31, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 8, - "endLine": 73, - "endColumn": 20, - "problem": "InstantiatedJsOjbect", - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 28, - "endLine": 73, - "endColumn": 30, - "problem": "NumericSemantics", - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - } - ] + "copyright": [ + "Copyright (c) 2025 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." + ], + "result": [ + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 69, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 69, + "problem": "InterOpImportJs", + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 54, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 54, + "problem": "InterOpImportJs", + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 55, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 55, + "problem": "InterOpImportJs", + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 15, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 18, + "problem": "CallJSFunction", + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 11, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 1, + "endLine": 25, + "endColumn": 19, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 8, + "endLine": 25, + "endColumn": 19, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 1, + "endLine": 26, + "endColumn": 20, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 8, + "endLine": 26, + "endColumn": 20, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 1, + "endLine": 27, + "endColumn": 12, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 1, + "endLine": 28, + "endColumn": 17, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 1, + "endLine": 29, + "endColumn": 12, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 11, + "endLine": 30, + "endColumn": 20, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 23, + "endLine": 32, + "endColumn": 35, + "problem": "InstantiatedJsOjbect", + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 1, + "endLine": 33, + "endColumn": 20, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 8, + "endLine": 33, + "endColumn": 20, + "problem": "InstantiatedJsOjbect", + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 21, + "endLine": 35, + "endColumn": 33, + "problem": "InstantiatedJsOjbect", + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 12, + "endLine": 37, + "endColumn": 28, + "problem": "InteropCallObjectMethods", + "suggest": "", + "rule": "Calling methods of JS Object directly in interop is not allowed (arkts-interop-js2s-call-js-method)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 10, + "endLine": 43, + "endColumn": 28, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 24, + "endLine": 43, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 3, + "endLine": 45, + "endColumn": 22, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 10, + "endLine": 45, + "endColumn": 22, + "problem": "InstantiatedJsOjbect", + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 21, + "endLine": 48, + "endColumn": 39, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 35, + "endLine": 48, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 7, + "endLine": 50, + "endColumn": 13, + "problem": "InvalidIdentifier", + "suggest": "", + "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 5, + "endLine": 62, + "endColumn": 21, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 28, + "endLine": 66, + "endColumn": 47, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 35, + "endLine": 66, + "endColumn": 47, + "problem": "InstantiatedJsOjbect", + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 1, + "endLine": 70, + "endColumn": 13, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 1, + "endLine": 71, + "endColumn": 25, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 8, + "endLine": 71, + "endColumn": 20, + "problem": "InstantiatedJsOjbect", + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 1, + "endLine": 72, + "endColumn": 30, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 8, + "endLine": 72, + "endColumn": 20, + "problem": "InstantiatedJsOjbect", + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 1, + "endLine": 73, + "endColumn": 31, + "problem": "InterOpImportJsForTypeOf", + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 8, + "endLine": 73, + "endColumn": 31, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 8, + "endLine": 73, + "endColumn": 20, + "problem": "InstantiatedJsOjbect", + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 28, + "endLine": 73, + "endColumn": 30, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] } diff --git a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json old mode 100755 new mode 100644 index e9134529982..05ec943c029 --- a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json @@ -1,933 +1,807 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], - "result": [ - { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 69, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 69, - "problem": "InterOpImportJs", - "autofix": [ - { - "start": 618, - "end": 686, - "replacementText": "", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 69 - }, - { - "start": 795, - "end": 795, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_js');\nlet myAaa = GeneratedImportVar_1.getPropertyByName('aaa');\nlet ClassA = GeneratedImportVar_1.getPropertyByName('ClassA');\nlet Dog = GeneratedImportVar_1.getPropertyByName('Dog');\nlet Person = GeneratedImportVar_1.getPropertyByName('Person');\nlet Wiki = GeneratedImportVar_1.getPropertyByName('Wiki');\n", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 69 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 54, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 54, - "problem": "InterOpImportJs", - "autofix": [ - { - "start": 687, - "end": 740, - "replacementText": "", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 54 - }, - { - "start": 795, - "end": 795, - "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_js');\nlet Doge = GeneratedImportVar_2.getPropertyByName('Dog');\n", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 54 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 55, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 55, - "problem": "InterOpImportJs", - "autofix": [ - { - "start": 741, - "end": 795, - "replacementText": "", - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 55 - }, - { - "start": 795, - "end": 795, - "replacementText": "let GeneratedImportVar_3 = ESValue.load('./interop_import_js_js');\nlet wiki = GeneratedImportVar_3.getPropertyByName('Wiki');\n", - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 55 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 15, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 797, - "end": 811, - "replacementText": "myAaa.invoke().typeOf()", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 15 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 11, - "endLine": 22, - "endColumn": 18, - "problem": "CallJSFunction", - "autofix": [ - { - "start": 831, - "end": 838, - "replacementText": "myAaa.invoke()", - "line": 22, - "column": 11, - "endLine": 22, - "endColumn": 18 - } - ], - "suggest": "", - "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 11, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 852, - "end": 862, - "replacementText": "Dog.typeOf()", - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 11 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 19, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 872, - "end": 890, - "replacementText": "Dog.invoke(ESValue.wrap('doge')).typeOf()", - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 19 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 8, - "endLine": 25, - "endColumn": 19, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 1, - "endLine": 26, - "endColumn": 20, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 900, - "end": 919, - "replacementText": "Doge.invoke(ESValue.wrap('doge')).typeOf()", - "line": 26, - "column": 1, - "endLine": 26, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 8, - "endLine": 26, - "endColumn": 20, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 12, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 929, - "end": 940, - "replacementText": "Wiki.typeOf()", - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 12 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 1, - "endLine": 28, - "endColumn": 17, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 949, - "end": 965, - "replacementText": "Wiki.getPropertyByName('name').typeOf()", - "line": 28, - "column": 1, - "endLine": 28, - "endColumn": 17 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 8, - "endLine": 28, - "endColumn": 17, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 956, - "end": 965, - "replacementText": "Wiki.getPropertyByName(\"name\")", - "line": 28, - "column": 8, - "endLine": 28, - "endColumn": 17 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 8, - "endLine": 28, - "endColumn": 17, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "Wiki.getPropertyByName('name').toString()", - "start": 956, - "end": 965, - "line": 28, - "column": 8, - "endLine": 28, - "endColumn": 17 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 12, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 974, - "end": 985, - "replacementText": "wiki.typeOf()", - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 12 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 30, - "column": 11, - "endLine": 30, - "endColumn": 20, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 1004, - "end": 1013, - "replacementText": "wiki.getPropertyByName(\"name\")", - "line": 30, - "column": 11, - "endLine": 30, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 30, - "column": 11, - "endLine": 30, - "endColumn": 20, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "wiki.getPropertyByName('name').toString()", - "start": 1004, - "end": 1013, - "line": 30, - "column": 11, - "endLine": 30, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 32, - "column": 23, - "endLine": 32, - "endColumn": 35, - "problem": "InstantiatedJsOjbect", - "autofix": [ - { - "start": 1048, - "end": 1060, - "replacementText": "ClassA.instantiate()", - "line": 32, - "column": 23, - "endLine": 32, - "endColumn": 35 - } - ], - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 1, - "endLine": 33, - "endColumn": 20, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 1061, - "end": 1080, - "replacementText": "ClassA.instantiate().typeOf()", - "line": 33, - "column": 1, - "endLine": 33, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 33, - "column": 8, - "endLine": 33, - "endColumn": 20, - "problem": "InstantiatedJsOjbect", - "autofix": [ - { - "start": 1068, - "end": 1080, - "replacementText": "ClassA.instantiate()", - "line": 33, - "column": 8, - "endLine": 33, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 35, - "column": 21, - "endLine": 35, - "endColumn": 33, - "problem": "InstantiatedJsOjbect", - "autofix": [ - { - "start": 1124, - "end": 1136, - "replacementText": "Person.instantiate()", - "line": 35, - "column": 21, - "endLine": 35, - "endColumn": 33 - } - ], - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 37, - "column": 12, - "endLine": 37, - "endColumn": 28, - "problem": "InteropCallObjectMethods", - "autofix": [ - { - "start": 1171, - "end": 1187, - "replacementText": "person.invokeMethod(\"getName\")", - "line": 37, - "column": 12, - "endLine": 37, - "endColumn": 28 - } - ], - "suggest": "", - "rule": "Calling methods of JS Object directly in interop is not allowed (arkts-interop-js2s-call-js-method)", - "severity": "ERROR" - }, - { - "line": 43, - "column": 10, - "endLine": 43, - "endColumn": 28, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 43, - "column": 24, - "endLine": 43, - "endColumn": 27, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 1312, - "end": 1315, - "replacementText": "111.0", - "line": 43, - "column": 24, - "endLine": 43, - "endColumn": 27 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 45, - "column": 3, - "endLine": 45, - "endColumn": 22, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 1337, - "end": 1356, - "replacementText": "Person.instantiate().typeOf()", - "line": 45, - "column": 3, - "endLine": 45, - "endColumn": 22 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 45, - "column": 10, - "endLine": 45, - "endColumn": 22, - "problem": "InstantiatedJsOjbect", - "autofix": [ - { - "start": 1344, - "end": 1356, - "replacementText": "Person.instantiate()", - "line": 45, - "column": 10, - "endLine": 45, - "endColumn": 22 - } - ], - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 48, - "column": 21, - "endLine": 48, - "endColumn": 39, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 48, - "column": 35, - "endLine": 48, - "endColumn": 38, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 1403, - "end": 1406, - "replacementText": "111.0", - "line": 48, - "column": 35, - "endLine": 48, - "endColumn": 38 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 50, - "column": 7, - "endLine": 50, - "endColumn": 13, - "problem": "InvalidIdentifier", - "suggest": "", - "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", - "severity": "ERROR" - }, - { - "line": 62, - "column": 5, - "endLine": 62, - "endColumn": 21, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 1713, - "end": 1729, - "replacementText": "wiki.getPropertyByName('name').typeOf()", - "line": 62, - "column": 5, - "endLine": 62, - "endColumn": 21 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 62, - "column": 12, - "endLine": 62, - "endColumn": 21, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 1720, - "end": 1729, - "replacementText": "wiki.getPropertyByName(\"name\")", - "line": 62, - "column": 12, - "endLine": 62, - "endColumn": 21 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 62, - "column": 12, - "endLine": 62, - "endColumn": 21, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "wiki.getPropertyByName('name').toString()", - "start": 1720, - "end": 1729, - "line": 62, - "column": 12, - "endLine": 62, - "endColumn": 21 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 28, - "endLine": 66, - "endColumn": 47, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 1818, - "end": 1837, - "replacementText": "ClassA.instantiate().typeOf()", - "line": 66, - "column": 28, - "endLine": 66, - "endColumn": 47 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 66, - "column": 35, - "endLine": 66, - "endColumn": 47, - "problem": "InstantiatedJsOjbect", - "autofix": [ - { - "start": 1825, - "end": 1837, - "replacementText": "ClassA.instantiate()", - "line": 66, - "column": 35, - "endLine": 66, - "endColumn": 47 - } - ], - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 70, - "column": 1, - "endLine": 70, - "endColumn": 13, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 1858, - "end": 1870, - "replacementText": "myAaa.typeOf()", - "line": 70, - "column": 1, - "endLine": 70, - "endColumn": 13 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 71, - "column": 1, - "endLine": 71, - "endColumn": 25, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 1880, - "end": 1904, - "replacementText": "Person.instantiate().getPropertyByName('name').typeOf()", - "line": 71, - "column": 1, - "endLine": 71, - "endColumn": 25 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 71, - "column": 8, - "endLine": 71, - "endColumn": 25, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "new Person().getPropertyByName('name').toString()", - "start": 1887, - "end": 1904, - "line": 71, - "column": 8, - "endLine": 71, - "endColumn": 25 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, - { - "line": 71, - "column": 8, - "endLine": 71, - "endColumn": 20, - "problem": "InstantiatedJsOjbect", - "autofix": [ - { - "start": 1887, - "end": 1899, - "replacementText": "Person.instantiate()", - "line": 71, - "column": 8, - "endLine": 71, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 72, - "column": 1, - "endLine": 72, - "endColumn": 30, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 1914, - "end": 1943, - "replacementText": "Person.instantiate().getPropertyByName('getName').invoke().typeOf()", - "line": 72, - "column": 1, - "endLine": 72, - "endColumn": 30 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 72, - "column": 8, - "endLine": 72, - "endColumn": 20, - "problem": "InstantiatedJsOjbect", - "autofix": [ - { - "start": 1921, - "end": 1933, - "replacementText": "Person.instantiate()", - "line": 72, - "column": 8, - "endLine": 72, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 1, - "endLine": 73, - "endColumn": 31, - "problem": "InterOpImportJsForTypeOf", - "autofix": [ - { - "start": 1952, - "end": 1982, - "replacementText": "Person.instantiate().getPropertyByName('setAge').invoke(ESValue.wrap(22)).typeOf()", - "line": 73, - "column": 1, - "endLine": 73, - "endColumn": 31 - } - ], - "suggest": "", - "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 8, - "endLine": 73, - "endColumn": 31, - "problem": "LimitedVoidType", - "suggest": "", - "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 8, - "endLine": 73, - "endColumn": 20, - "problem": "InstantiatedJsOjbect", - "autofix": [ - { - "start": 1959, - "end": 1971, - "replacementText": "Person.instantiate()", - "line": 73, - "column": 8, - "endLine": 73, - "endColumn": 20 - } - ], - "suggest": "", - "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 28, - "endLine": 73, - "endColumn": 30, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 1979, - "end": 1981, - "replacementText": "22.0", - "line": 73, - "column": 28, - "endLine": 73, - "endColumn": 30 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - } - ] + "copyright": [ + "Copyright (c) 2025 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." + ], + "result": [ + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 69, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 69, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 618, + "end": 686, + "replacementText": "", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 69 + }, + { + "start": 795, + "end": 795, + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_js');\nlet myAaa = GeneratedImportVar_1.getPropertyByName('aaa');\nlet ClassA = GeneratedImportVar_1.getPropertyByName('ClassA');\nlet Dog = GeneratedImportVar_1.getPropertyByName('Dog');\nlet Person = GeneratedImportVar_1.getPropertyByName('Person');\nlet Wiki = GeneratedImportVar_1.getPropertyByName('Wiki');\n", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 69 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 54, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 54, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 687, + "end": 740, + "replacementText": "", + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 54 + }, + { + "start": 795, + "end": 795, + "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_js');\nlet Doge = GeneratedImportVar_2.getPropertyByName('Dog');\n", + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 54 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 55, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 55, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 741, + "end": 795, + "replacementText": "", + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 55 + }, + { + "start": 795, + "end": 795, + "replacementText": "let GeneratedImportVar_3 = ESValue.load('./interop_import_js_js');\nlet wiki = GeneratedImportVar_3.getPropertyByName('Wiki');\n", + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 55 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 15, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 797, + "end": 811, + "replacementText": "myAaa.invoke().typeOf()", + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 15 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 18, + "problem": "CallJSFunction", + "autofix": [ + { + "start": 831, + "end": 838, + "replacementText": "myAaa.invoke()", + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 11, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 852, + "end": 862, + "replacementText": "Dog.typeOf()", + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 11 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 1, + "endLine": 25, + "endColumn": 19, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 872, + "end": 890, + "replacementText": "Dog.invoke(ESValue.wrap('doge')).typeOf()", + "line": 25, + "column": 1, + "endLine": 25, + "endColumn": 19 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 8, + "endLine": 25, + "endColumn": 19, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 1, + "endLine": 26, + "endColumn": 20, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 900, + "end": 919, + "replacementText": "Doge.invoke(ESValue.wrap('doge')).typeOf()", + "line": 26, + "column": 1, + "endLine": 26, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 8, + "endLine": 26, + "endColumn": 20, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 1, + "endLine": 27, + "endColumn": 12, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 929, + "end": 940, + "replacementText": "Wiki.typeOf()", + "line": 27, + "column": 1, + "endLine": 27, + "endColumn": 12 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 1, + "endLine": 28, + "endColumn": 17, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 949, + "end": 965, + "replacementText": "Wiki.getPropertyByName('name').typeOf()", + "line": 28, + "column": 1, + "endLine": 28, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 1, + "endLine": 29, + "endColumn": 12, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 974, + "end": 985, + "replacementText": "wiki.typeOf()", + "line": 29, + "column": 1, + "endLine": 29, + "endColumn": 12 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 11, + "endLine": 30, + "endColumn": 20, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 1004, + "end": 1013, + "replacementText": "wiki.getPropertyByName(\"name\")", + "line": 30, + "column": 11, + "endLine": 30, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 23, + "endLine": 32, + "endColumn": 35, + "problem": "InstantiatedJsOjbect", + "autofix": [ + { + "start": 1048, + "end": 1060, + "replacementText": "ClassA.instantiate()", + "line": 32, + "column": 23, + "endLine": 32, + "endColumn": 35 + } + ], + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 1, + "endLine": 33, + "endColumn": 20, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 1061, + "end": 1080, + "replacementText": "ClassA.instantiate().typeOf()", + "line": 33, + "column": 1, + "endLine": 33, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 8, + "endLine": 33, + "endColumn": 20, + "problem": "InstantiatedJsOjbect", + "autofix": [ + { + "start": 1068, + "end": 1080, + "replacementText": "ClassA.instantiate()", + "line": 33, + "column": 8, + "endLine": 33, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 21, + "endLine": 35, + "endColumn": 33, + "problem": "InstantiatedJsOjbect", + "autofix": [ + { + "start": 1124, + "end": 1136, + "replacementText": "Person.instantiate()", + "line": 35, + "column": 21, + "endLine": 35, + "endColumn": 33 + } + ], + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 12, + "endLine": 37, + "endColumn": 28, + "problem": "InteropCallObjectMethods", + "autofix": [ + { + "start": 1171, + "end": 1187, + "replacementText": "person.invokeMethod(\"getName\")", + "line": 37, + "column": 12, + "endLine": 37, + "endColumn": 28 + } + ], + "suggest": "", + "rule": "Calling methods of JS Object directly in interop is not allowed (arkts-interop-js2s-call-js-method)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 10, + "endLine": 43, + "endColumn": 28, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 24, + "endLine": 43, + "endColumn": 27, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1312, + "end": 1315, + "replacementText": "111.0", + "line": 43, + "column": 24, + "endLine": 43, + "endColumn": 27 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 3, + "endLine": 45, + "endColumn": 22, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 1337, + "end": 1356, + "replacementText": "Person.instantiate().typeOf()", + "line": 45, + "column": 3, + "endLine": 45, + "endColumn": 22 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 10, + "endLine": 45, + "endColumn": 22, + "problem": "InstantiatedJsOjbect", + "autofix": [ + { + "start": 1344, + "end": 1356, + "replacementText": "Person.instantiate()", + "line": 45, + "column": 10, + "endLine": 45, + "endColumn": 22 + } + ], + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 21, + "endLine": 48, + "endColumn": 39, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 35, + "endLine": 48, + "endColumn": 38, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1403, + "end": 1406, + "replacementText": "111.0", + "line": 48, + "column": 35, + "endLine": 48, + "endColumn": 38 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 7, + "endLine": 50, + "endColumn": 13, + "problem": "InvalidIdentifier", + "suggest": "", + "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 5, + "endLine": 62, + "endColumn": 21, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 1713, + "end": 1729, + "replacementText": "wiki.getPropertyByName('name').typeOf()", + "line": 62, + "column": 5, + "endLine": 62, + "endColumn": 21 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 28, + "endLine": 66, + "endColumn": 47, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 1818, + "end": 1837, + "replacementText": "ClassA.instantiate().typeOf()", + "line": 66, + "column": 28, + "endLine": 66, + "endColumn": 47 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 35, + "endLine": 66, + "endColumn": 47, + "problem": "InstantiatedJsOjbect", + "autofix": [ + { + "start": 1825, + "end": 1837, + "replacementText": "ClassA.instantiate()", + "line": 66, + "column": 35, + "endLine": 66, + "endColumn": 47 + } + ], + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 1, + "endLine": 70, + "endColumn": 13, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 1858, + "end": 1870, + "replacementText": "myAaa.typeOf()", + "line": 70, + "column": 1, + "endLine": 70, + "endColumn": 13 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 1, + "endLine": 71, + "endColumn": 25, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 1880, + "end": 1904, + "replacementText": "Person.instantiate().getPropertyByName('name').typeOf()", + "line": 71, + "column": 1, + "endLine": 71, + "endColumn": 25 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 8, + "endLine": 71, + "endColumn": 20, + "problem": "InstantiatedJsOjbect", + "autofix": [ + { + "start": 1887, + "end": 1899, + "replacementText": "Person.instantiate()", + "line": 71, + "column": 8, + "endLine": 71, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 1, + "endLine": 72, + "endColumn": 30, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 1914, + "end": 1943, + "replacementText": "Person.instantiate().getPropertyByName('getName').invoke().typeOf()", + "line": 72, + "column": 1, + "endLine": 72, + "endColumn": 30 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 8, + "endLine": 72, + "endColumn": 20, + "problem": "InstantiatedJsOjbect", + "autofix": [ + { + "start": 1921, + "end": 1933, + "replacementText": "Person.instantiate()", + "line": 72, + "column": 8, + "endLine": 72, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 1, + "endLine": 73, + "endColumn": 31, + "problem": "InterOpImportJsForTypeOf", + "autofix": [ + { + "start": 1952, + "end": 1982, + "replacementText": "Person.instantiate().getPropertyByName('setAge').invoke(ESValue.wrap(22)).typeOf()", + "line": 73, + "column": 1, + "endLine": 73, + "endColumn": 31 + } + ], + "suggest": "", + "rule": "The \"typeof\" expression can't be used with interop JS objects (arkts-interop-js2s-typeof-js-type)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 8, + "endLine": 73, + "endColumn": 31, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 8, + "endLine": 73, + "endColumn": 20, + "problem": "InstantiatedJsOjbect", + "autofix": [ + { + "start": 1959, + "end": 1971, + "replacementText": "Person.instantiate()", + "line": 73, + "column": 8, + "endLine": 73, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "ArkTS directly instantiated JS objects is not supported (arkts-interop-js2s-create-js-instance)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 28, + "endLine": 73, + "endColumn": 30, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 1979, + "end": 1981, + "replacementText": "22.0", + "line": 73, + "column": 28, + "endLine": 73, + "endColumn": 30 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] } diff --git a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.arkts2.json b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.arkts2.json old mode 100755 new mode 100644 index ce2c2d2d380..0696c37a19b --- a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.arkts2.json @@ -44,16 +44,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 1, @@ -64,16 +54,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 1, @@ -84,16 +64,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 11, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 14, @@ -114,16 +84,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 12, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 22, "column": 16, @@ -154,16 +114,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 8, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 23, "column": 11, @@ -175,4 +125,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json old mode 100755 new mode 100644 index 0c4beba4af8..24ad2303842 --- a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json @@ -75,27 +75,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('name').toString()", - "start": 678, - "end": 686, - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 1, @@ -117,27 +96,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('name').toString()", - "start": 687, - "end": 695, - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 1, @@ -159,27 +117,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 11, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "person.getPropertyByName('age').toNumber()", - "start": 704, - "end": 714, - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 11 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 14, @@ -222,27 +159,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 12, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "person.getPropertyByName('male')", - "start": 720, - "end": 731, - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 12 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 22, "column": 16, @@ -306,27 +222,6 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" }, - { - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 8, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('age')", - "start": 741, - "end": 748, - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 8 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 23, "column": 11, @@ -349,4 +244,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.arkts2.json b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.arkts2.json old mode 100755 new mode 100644 index 414d9f77210..35d79794d95 --- a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.arkts2.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 17, @@ -44,26 +44,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 19, - "column": 2, - "endLine": 19, - "endColumn": 9, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 2, - "endLine": 19, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 1, @@ -74,26 +54,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 20, - "column": 2, - "endLine": 20, - "endColumn": 9, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 2, - "endLine": 20, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 1, @@ -104,26 +64,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 21, - "column": 2, - "endLine": 21, - "endColumn": 9, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 2, - "endLine": 21, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 22, "column": 1, @@ -134,26 +74,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 22, - "column": 2, - "endLine": 22, - "endColumn": 9, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 2, - "endLine": 22, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 23, "column": 1, @@ -164,26 +84,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 23, - "column": 3, - "endLine": 23, - "endColumn": 10, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 23, - "column": 3, - "endLine": 23, - "endColumn": 10, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 24, "column": 1, @@ -194,26 +94,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 24, - "column": 3, - "endLine": 24, - "endColumn": 10, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 3, - "endLine": 24, - "endColumn": 10, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 25, "column": 1, @@ -224,26 +104,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 25, - "column": 3, - "endLine": 25, - "endColumn": 10, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 3, - "endLine": 25, - "endColumn": 10, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 26, "column": 1, @@ -253,26 +113,6 @@ "suggest": "", "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" - }, - { - "line": 26, - "column": 3, - "endLine": 26, - "endColumn": 10, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 3, - "endLine": 26, - "endColumn": 10, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.autofix.json b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.autofix.json old mode 100755 new mode 100644 index 4452cefcfd5..56aadfa4832 --- a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.autofix.json @@ -1,18 +1,18 @@ { - "copyright": [ - "Copyright (c) 2025 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." - ], + "copyright": [ + "Copyright (c) 2025 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." + ], "result": [ { "line": 17, @@ -43,7 +43,11 @@ { "start": 663, "end": 663, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_property_num_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n" + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_property_num_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 46 } ], "suggest": "", @@ -71,48 +75,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 19, - "column": 2, - "endLine": 19, - "endColumn": 9, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 666, - "end": 673, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 19, - "column": 2, - "endLine": 19, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 2, - "endLine": 19, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 666, - "end": 673, - "line": 19, - "column": 2, - "endLine": 19, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 20, "column": 1, @@ -134,48 +96,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 20, - "column": 2, - "endLine": 20, - "endColumn": 9, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 676, - "end": 683, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 20, - "column": 2, - "endLine": 20, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 2, - "endLine": 20, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 676, - "end": 683, - "line": 20, - "column": 2, - "endLine": 20, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 21, "column": 1, @@ -197,48 +117,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 21, - "column": 2, - "endLine": 21, - "endColumn": 9, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 686, - "end": 693, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 21, - "column": 2, - "endLine": 21, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 2, - "endLine": 21, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 686, - "end": 693, - "line": 21, - "column": 2, - "endLine": 21, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 22, "column": 1, @@ -260,48 +138,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 22, - "column": 2, - "endLine": 22, - "endColumn": 9, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 696, - "end": 703, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 22, - "column": 2, - "endLine": 22, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 2, - "endLine": 22, - "endColumn": 9, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 696, - "end": 703, - "line": 22, - "column": 2, - "endLine": 22, - "endColumn": 9 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 23, "column": 1, @@ -323,48 +159,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 23, - "column": 3, - "endLine": 23, - "endColumn": 10, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 707, - "end": 714, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 23, - "column": 3, - "endLine": 23, - "endColumn": 10 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 23, - "column": 3, - "endLine": 23, - "endColumn": 10, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 707, - "end": 714, - "line": 23, - "column": 3, - "endLine": 23, - "endColumn": 10 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 24, "column": 1, @@ -386,48 +180,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 24, - "column": 3, - "endLine": 24, - "endColumn": 10, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 719, - "end": 726, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 24, - "column": 3, - "endLine": 24, - "endColumn": 10 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 3, - "endLine": 24, - "endColumn": 10, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 719, - "end": 726, - "line": 24, - "column": 3, - "endLine": 24, - "endColumn": 10 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 25, "column": 1, @@ -449,48 +201,6 @@ "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" }, - { - "line": 25, - "column": 3, - "endLine": 25, - "endColumn": 10, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 731, - "end": 738, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 25, - "column": 3, - "endLine": 25, - "endColumn": 10 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 3, - "endLine": 25, - "endColumn": 10, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 731, - "end": 738, - "line": 25, - "column": 3, - "endLine": 25, - "endColumn": 10 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 26, "column": 1, @@ -511,48 +221,6 @@ "suggest": "", "rule": "Interop object does not have property num (arkts-interop-js2s-unary-op)", "severity": "ERROR" - }, - { - "line": 26, - "column": 3, - "endLine": 26, - "endColumn": 10, - "problem": "InteropObjectProperty", - "autofix": [ - { - "start": 743, - "end": 750, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 26, - "column": 3, - "endLine": 26, - "endColumn": 10 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 3, - "endLine": 26, - "endColumn": 10, - "problem": "InteropJsObjectUsage", - "autofix": [ - { - "replacementText": "foo.getPropertyByName('num').toNumber()", - "start": 743, - "end": 750, - "line": 26, - "column": 3, - "endLine": 26, - "endColumn": 10 - } - ], - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.arkts2.json b/ets2panda/linter/test/interop/no_js_instanceof.ets.arkts2.json old mode 100755 new mode 100644 index 31d9a91eefe..0a593ce0d89 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.arkts2.json +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.arkts2.json @@ -164,26 +164,6 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, - { - "line": 73, - "column": 36, - "endLine": 73, - "endColumn": 51, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 36, - "endLine": 73, - "endColumn": 51, - "problem": "InteropJsObjectUsage", - "suggest": "", - "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", - "severity": "ERROR" - }, { "line": 75, "column": 5, @@ -194,16 +174,6 @@ "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", "severity": "ERROR" }, - { - "line": 75, - "column": 22, - "endLine": 75, - "endColumn": 37, - "problem": "InteropObjectProperty", - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, { "line": 75, "column": 22, @@ -215,4 +185,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} -- Gitee