diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 7cbdd460368fe985cf05037a51821305c4b434bb..4bd370fb012c821d2fde76082a86232cf07183de 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -2039,7 +2039,12 @@ checker::Type *ETSAnalyzer::CheckDynamic(ir::ObjectExpression *expr) const static bool ValidatePreferredType(ETSChecker *checker, ir::ObjectExpression *expr) { - auto preferredType = expr->PreferredType(); + auto preferredType = expr->PreferredType()->MaybeBaseTypeOfGradualType(); + if (preferredType == nullptr) { + checker->LogError(diagnostic::CLASS_COMPOSITE_UNKNOWN_TYPE, {}, expr->Start()); + return false; + } + if (preferredType->IsTypeError()) { // Don't need to duplicate error message for a single error. return false; diff --git a/ets2panda/compiler/lowering/ets/interfacePropertyDeclarations.cpp b/ets2panda/compiler/lowering/ets/interfacePropertyDeclarations.cpp index 9ffb2732ec79529dfbc8f6fae64ab9a5ed0e3395..66fb67ba663d0820b68437c86063e8909f419750 100644 --- a/ets2panda/compiler/lowering/ets/interfacePropertyDeclarations.cpp +++ b/ets2panda/compiler/lowering/ets/interfacePropertyDeclarations.cpp @@ -125,7 +125,8 @@ ir::MethodDefinition *InterfacePropertyDeclarationsPhase::GenerateGetterOrSetter ctx->Allocator(), ir::ScriptFunction::ScriptFunctionData { nullptr, std::move(signature), // CC-OFF(G.FMT.02) project code style // CC-OFFNXT(G.FMT.02) project code style - isSetter ? ir::ScriptFunctionFlags::SETTER : ir::ScriptFunctionFlags::GETTER, flags}); + isSetter ? ir::ScriptFunctionFlags::SETTER : ir::ScriptFunctionFlags::GETTER, flags, + classScope->Node()->AsTSInterfaceDeclaration()->Language()}); func->SetRange(field->Range()); func->SetScope(functionScope); diff --git a/ets2panda/compiler/lowering/ets/unboxLowering.cpp b/ets2panda/compiler/lowering/ets/unboxLowering.cpp index 0e5299b8229ce42fd61f03c60511f0142ff83851..ef0704c10e907b0bdfc4545435a4420914901f9c 100644 --- a/ets2panda/compiler/lowering/ets/unboxLowering.cpp +++ b/ets2panda/compiler/lowering/ets/unboxLowering.cpp @@ -268,6 +268,11 @@ static void NormalizeAllTypes(UnboxContext *uctx, ir::AstNode *ast) static void HandleScriptFunctionHeader(UnboxContext *uctx, ir::ScriptFunction *func) { + // dynamic function does not need to unbox + if (func->Language() == Language::Id::JS) { + return; + } + auto *sig = func->Signature(); if (sig == nullptr) { return; diff --git a/ets2panda/linter/package.json b/ets2panda/linter/package.json index 40daf9b4c9d35420967ced60799d2274f5a2a1cb..0db61d9e690e81bfb3983d6627a147f86b7c035b 100644 --- a/ets2panda/linter/package.json +++ b/ets2panda/linter/package.json @@ -20,11 +20,12 @@ "pack:linter": "rimraf bundle && mkdir bundle && npm pack && mv panda-tslinter-*.tgz bundle", "pretest": " npm run fix", "test": "npm run test_all && npm run test_ts_import_ets", - "test_all": "npm run testrunner -- -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin", + "test_all": "npm run testrunner -- -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi", "test_main": "npm run testrunner -- -d test/main", "test_ohmurl": "npm run testrunner -- -d test/ohmurl", "test_interop": "npm run testrunner -- -d test/interop", "test_sdk": "npm run testrunner -- -d test/sdkwhite", + "test_deprecatedapi": "npm run testrunner -- -d test/deprecatedapi", "test_concurrent": "npm run testrunner -- -d test/concurrent", "test_rules": "npm run testrunner -- -d test/rules", "test_regression": "npm run testrunner -- -d test/regression", @@ -36,7 +37,7 @@ "test_ts_import_ets": "npm run testrunner -- -d test/ts_import_ets/ts --sdk --interop-mode", "test_migration": "npm run testrunner -- -d test/migration", "testrunner": "npm run compile && node build/testRunner/TestRunner.js", - "update-tests": "node scripts/update-test-results.mjs test/main test/rules test/regression test/extended_features test/ts_import_ets/ts test/migration test/ohmurl test/interop test/sdkwhite test/concurrent test/builtin", + "update-tests": "node scripts/update-test-results.mjs test/main test/rules test/regression test/extended_features test/ts_import_ets/ts test/migration test/ohmurl test/interop test/sdkwhite test/concurrent test/builtin test/deprecatedapi", "eslint-check": "npx eslint .", "eslint-fix": "npm run eslint-check -- --fix", "prettier-fix": "npx prettier --write .", @@ -44,7 +45,7 @@ "coverage": "npm run coverage-prepare && npm run coverage-instrument && npm run coverage-test && npm run coverage-collect && npm run coverage-report", "coverage-prepare": "npm run build && node scripts/testRunner/coverage_prepare.js", "coverage-instrument": "nyc --compact false instrument build coverage/build_instrument", - "coverage-test": "node coverage/build_instrument/testRunner/TestRunner.js -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin", + "coverage-test": "node coverage/build_instrument/testRunner/TestRunner.js -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi", "coverage-collect": "node scripts/testRunner/coverage_collect.js", "coverage-report": "node scripts/testRunner/coverage_report.js" }, diff --git a/ets2panda/linter/rule-config.json b/ets2panda/linter/rule-config.json index 349cef2c459fc39086f0bc974d1128ba3edbfeb5..42df3797287831d8d1d132729a4dd602ef436bc3 100644 --- a/ets2panda/linter/rule-config.json +++ b/ets2panda/linter/rule-config.json @@ -58,8 +58,8 @@ "arkts-numeric-bigint-compare", "arkts-only-support-decimal-bigint-literal", "arkts-unsupport-operator", - "arkts-no-duplicate-function-name", - "arkts-subclass-must-call-super-constructor-with-args" + "arkts-no-duplicate-function-name", + "arkts-subclass-must-call-super-constructor-with-args" ], "interop": [ "arkts-interop-js2s-inherit-js-class", @@ -116,7 +116,8 @@ "arkui-no-localbuilder-decorator", "arkui-statestyles-block-need-arrow-func", "arkui-repeat-disable-default-virtualscroll", - "arkui-wrapbuilder-require-arrow-func-generic" + "arkui-wrapbuilder-require-arrow-func-generic", + "arkui-no-deprecated-api" ], "builtin": [ "arkts-builtin-thisArgs", @@ -136,7 +137,9 @@ "sdk-constructor-funcs", "sdk-no-literal-as-property-name", "sdk-no-decl-with-duplicate-name", - "sdk-type-query" + "sdk-type-query", + "sdk-ability-asynchronous-lifecycle", + "sdk-ability-lifecycle-monitor" ], "concurrent": [ "arkts-no-need-stdlib-ason", diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index ec41a079a82b48f3fb5aec6473118fdd44f8cd58..e1c85804dd8c93843b2095a13259952d555541d3 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -389,6 +389,7 @@ cookBookTag[381] = 'The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)'; cookBookTag[382] = 'Promiseconstructor only supports using resolve (undefined) (arkts-promise-with-void-type-need-undefined-as-resolve-arg)'; +cookBookTag[399] = 'ArkUI deprecated api check (arkui-no-deprecated-api)'; for (let i = 0; i <= cookBookTag.length; i++) { cookBookMsg[i] = ''; diff --git a/ets2panda/linter/src/lib/FaultAttrs.ts b/ets2panda/linter/src/lib/FaultAttrs.ts index 5c828160f33ab55caf85f9ed09f46a0119f99e99..14bc9b8f4b54ce9c112f6fbe835c7aee3974d213 100644 --- a/ets2panda/linter/src/lib/FaultAttrs.ts +++ b/ets2panda/linter/src/lib/FaultAttrs.ts @@ -269,3 +269,4 @@ faultsAttrs[FaultID.NondecimalBigint] = new FaultAttributes(377); faultsAttrs[FaultID.UnsupportOperator] = new FaultAttributes(378); faultsAttrs[FaultID.StateStylesBlockNeedArrowFunc] = new FaultAttributes(381); faultsAttrs[FaultID.PromiseVoidNeedResolveArg] = new FaultAttributes(382); +faultsAttrs[FaultID.NoDeprecatedApi] = new FaultAttributes(399); diff --git a/ets2panda/linter/src/lib/FaultDesc.ts b/ets2panda/linter/src/lib/FaultDesc.ts index ab3cde471951da4804535c130bab4a7a6395fe0d..f55dc3b3a1c6518e62946dfd9f1277739f8729a8 100644 --- a/ets2panda/linter/src/lib/FaultDesc.ts +++ b/ets2panda/linter/src/lib/FaultDesc.ts @@ -258,3 +258,4 @@ faultDesc[FaultID.StateStylesBlockNeedArrowFunc] = 'StateStyles needs arrow func faultDesc[FaultID.PromiseVoidNeedResolveArg] = 'Promiseconstructor only supports using resolve (undefined)'; faultDesc[FaultID.RepeatDisableVirtualScroll] = '"Repeat" disable default "virtualScroll"'; faultDesc[FaultID.WrappedBuilderGenericNeedArrowFunc] = 'Generic of "WrappedBuilder" does not support parameter list'; +faultDesc[FaultID.NoDeprecatedApi] = 'ArkUI deprecated api check'; diff --git a/ets2panda/linter/src/lib/Problems.ts b/ets2panda/linter/src/lib/Problems.ts index fbe1bb14130268cebc816c2cd5dc771dd69c9628..c39e5ac1c3e25636c2b6452cb46e353d006162c8 100644 --- a/ets2panda/linter/src/lib/Problems.ts +++ b/ets2panda/linter/src/lib/Problems.ts @@ -258,6 +258,7 @@ export enum FaultID { PromiseVoidNeedResolveArg, RepeatDisableVirtualScroll, WrappedBuilderGenericNeedArrowFunc, + NoDeprecatedApi, // this should always be last enum LAST_ID } diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 17e696930bad3bcaa73cee91459fd3fade113e20..6afc028c5160ea64a9bb0f486901804c6993dbc3 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -21,7 +21,10 @@ import type { Autofix } from './autofixes/Autofixer'; import { Autofixer } from './autofixes/Autofixer'; import { PROMISE_METHODS, SYMBOL, SYMBOL_CONSTRUCTOR, TsUtils } from './utils/TsUtils'; import { FUNCTION_HAS_NO_RETURN_ERROR_CODE } from './utils/consts/FunctionHasNoReturnErrorCode'; -import { LIMITED_STANDARD_UTILITY_TYPES } from './utils/consts/LimitedStandardUtilityTypes'; +import { + LIMITED_STANDARD_UTILITY_TYPES, + LIMITED_STANDARD_UTILITY_TYPES2 +} from './utils/consts/LimitedStandardUtilityTypes'; import { LIKE_FUNCTION, LIKE_FUNCTION_CONSTRUCTOR } from './utils/consts/LikeFunction'; import { METHOD_DECLARATION } from './utils/consts/MethodDeclaration'; import { METHOD_SIGNATURE } from './utils/consts/MethodSignature'; @@ -122,6 +125,8 @@ import type { ApiInfo, ApiListItem } from './utils/consts/SdkWhitelist'; import { ApiList, SdkProblem, SdkNameInfo } from './utils/consts/SdkWhitelist'; import * as apiWhiteList from './data/SdkWhitelist.json'; import * as builtinWhiteList from './data/BuiltinList.json'; +import * as deprecatedApiList from './data/DeprecatedApiList.json'; +import { DEPRECATE_CHECK_KEY, DEPRECATE_UNNAMED } from './utils/consts/DeprecateWhiteList'; import { BuiltinProblem, SYMBOL_ITERATOR, @@ -154,7 +159,8 @@ import { ON_DISCONNECT, PROMISE, SERVICE_EXTENSION_ABILITY, - VOID + VOID, + ABILITY_LIFECYCLE_SDK } from './utils/consts/AsyncLifecycleSDK'; import { ERROR_PROP_LIST } from './utils/consts/ErrorProp'; import { D_ETS, D_TS } from './utils/consts/TsSuffix'; @@ -183,6 +189,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { static pathMap: Map>; static indexedTypeSet: Set; static globalApiInfo: Map>; + static deprecatedApiInfo: Set; static symbotIterSet: Set; static missingAttributeSet: Set; static literalAsPropertyNameTypeSet: Set; @@ -195,12 +202,14 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { TypeScriptLinter.nameSpaceFunctionCache = new Map>(); TypeScriptLinter.pathMap = new Map>(); TypeScriptLinter.globalApiInfo = new Map>(); + TypeScriptLinter.deprecatedApiInfo = new Set(); TypeScriptLinter.funcMap = new Map>>(); TypeScriptLinter.symbotIterSet = new Set(); TypeScriptLinter.missingAttributeSet = new Set(); TypeScriptLinter.initSdkWhitelist(); TypeScriptLinter.initSdkBuiltinInfo(); TypeScriptLinter.initBuiltinlist(); + TypeScriptLinter.initDeprecatedApiList(); } initSdkInfo(): void { @@ -320,6 +329,15 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } + private static initDeprecatedApiList(): void { + const list: ApiList = new ApiList(deprecatedApiList); + if (list?.api_list?.length > 0) { + for (const item of list.api_list) { + this.deprecatedApiInfo.add(item); + } + } + } + private static addOrUpdateData(map: Map>, path: string, data: ApiInfo): void { let apiInfos = map.get(path); if (!apiInfos) { @@ -1301,30 +1319,27 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private handlePropertyAccessExpression(node: ts.Node): void { - this.handleMakeObserved(node as ts.PropertyAccessExpression); - this.handleStateStyles(node as ts.PropertyAccessExpression); - this.handleDoubleDollar(node); - this.handleQuotedHyphenPropsDeprecated(node as ts.PropertyAccessExpression); - this.handleSdkTypeQuery(node as ts.PropertyAccessExpression); - this.checkUnionTypes(node as ts.PropertyAccessExpression); - this.handleLimitedVoidTypeFromSdkOnPropertyAccessExpression(node as ts.PropertyAccessExpression); - this.checkDepricatedIsConcurrent(node as ts.PropertyAccessExpression); - this.propertyAccessExpressionForBuiltin(node as ts.PropertyAccessExpression); - this.checkConstrutorAccess(node as ts.PropertyAccessExpression); - this.handleTaskPoolDeprecatedUsages(node as ts.PropertyAccessExpression); - this.handleNoTuplesArraysForPropertyAccessExpression(node as ts.PropertyAccessExpression); - this.handleUnsafeOptionalCallComparison(node as ts.PropertyAccessExpression); - if (ts.isCallExpression(node.parent) && node === node.parent.expression) { + const propertyAccessNode = node as ts.PropertyAccessExpression; + this.handleMakeObserved(propertyAccessNode); + this.handleStateStyles(propertyAccessNode); + this.handleDoubleDollar(propertyAccessNode); + this.handleQuotedHyphenPropsDeprecated(propertyAccessNode); + this.handleSdkTypeQuery(propertyAccessNode); + this.checkUnionTypes(propertyAccessNode); + this.handleLimitedVoidTypeFromSdkOnPropertyAccessExpression(propertyAccessNode); + this.checkDepricatedIsConcurrent(propertyAccessNode); + this.propertyAccessExpressionForBuiltin(propertyAccessNode); + this.checkConstrutorAccess(propertyAccessNode); + this.handleTaskPoolDeprecatedUsages(propertyAccessNode); + this.handleNoTuplesArraysForPropertyAccessExpression(propertyAccessNode); + this.handleUnsafeOptionalCallComparison(propertyAccessNode); + this.handleNoDeprecatedApi(node as ts.PropertyAccessExpression); + if (ts.isCallExpression(propertyAccessNode.parent) && propertyAccessNode === propertyAccessNode.parent.expression) { return; } - const propertyAccessNode = node as ts.PropertyAccessExpression; const exprSym = this.tsUtils.trueSymbolAtLocation(propertyAccessNode); const baseExprSym = this.tsUtils.trueSymbolAtLocation(propertyAccessNode.expression); const baseExprType = this.tsTypeChecker.getTypeAtLocation(propertyAccessNode.expression); - this.handleTsInterop(propertyAccessNode, () => { - const type = this.tsTypeChecker.getTypeAtLocation(propertyAccessNode.expression); - this.checkUsageOfTsTypes(type, propertyAccessNode.expression); - }); this.propertyAccessExpressionForInterop(propertyAccessNode); if (this.isPrototypePropertyAccess(propertyAccessNode, exprSym, baseExprSym, baseExprType)) { this.incrementCounters(propertyAccessNode.name, FaultID.Prototype); @@ -1491,12 +1506,195 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { TsUtils.isAnyType(baseType) || TsUtils.isUnknownType(baseType) || this.tsUtils.isStdFunctionType(baseType) || - typeString === 'symbol' + typeString === 'symbol' || + this.isMixedEnum(baseType) || + this.isSpecialType(baseType, node) || + this.isStdUtilityTools(node) ) { this.incrementCounters(node, FaultID.InteropDirectAccessToTSTypes); } } + private isSpecialType(baseType: ts.Type, node: ts.Node): boolean { + const baseTypeStr = this.tsTypeChecker.typeToString(baseType); + if (TypeScriptLinter.extractKeyofFromString(baseTypeStr)) { + return true; + } + let symbol = baseType.getSymbol(); + if (!symbol) { + symbol = this.tsUtils.trueSymbolAtLocation(node); + } + const decl = TsUtils.getDeclaration(symbol); + if (!decl) { + return false; + } + if ( + ts.isTypeAliasDeclaration(decl) && this.checkSpecialTypeNode(decl.type, true) || + this.checkSpecialTypeNode(decl, true) + ) { + return true; + } + + if (this.isObjectLiteralExpression(decl)) { + return true; + } + + if (ts.isFunctionLike(decl)) { + if (decl.type && this.checkIsTypeLiteral(decl.type)) { + return true; + } + const isObjectLiteralExpression = decl.parameters.some((param) => { + return param.type && this.checkIsTypeLiteral(param.type); + }); + if (isObjectLiteralExpression) { + return true; + } + if (TypeScriptLinter.hasObjectLiteralReturn(decl as ts.FunctionLikeDeclaration)) { + return true; + } + } + + return false; + } + + private isMixedEnum(type: ts.Type): boolean { + const symbol = type.getSymbol(); + if (!symbol) { + return false; + } + + const declarations = symbol.getDeclarations(); + if (!declarations) { + return false; + } + + for (const decl of declarations) { + if (ts.isEnumDeclaration(decl)) { + const initializerTypes = new Set(); + + for (const member of decl.members) { + if (member.initializer) { + const memberType = this.tsTypeChecker.getTypeAtLocation(member.initializer); + const baseTypeStr = this.tsTypeChecker.typeToString( + this.tsTypeChecker.getBaseTypeOfLiteralType(memberType) + ); + initializerTypes.add(baseTypeStr); + } + } + + if (initializerTypes.size > 1) { + return true; + } + } + } + + return false; + } + + private isStdUtilityTools(node: ts.Node): boolean { + const symbol = this.tsUtils.trueSymbolAtLocation(node); + const decl = TsUtils.getDeclaration(symbol); + if (!decl) { + return false; + } + let isStdUtilityType = false; + const utils = this.tsUtils; + function traverse(node: ts.Node): void { + if (isStdUtilityType) { + return; + } + if (ts.isTypeReferenceNode(node) || ts.isExpressionWithTypeArguments(node)) { + let typeName = ''; + if (ts.isTypeReferenceNode(node)) { + typeName = utils.entityNameToString(node.typeName); + } else { + typeName = node.expression.getText(); + } + isStdUtilityType = !!( + LIMITED_STANDARD_UTILITY_TYPES2.includes(typeName) && + node.typeArguments && + node.typeArguments.length > 0 + ); + } + node.forEachChild(traverse); + } + traverse(decl); + return isStdUtilityType; + } + + private checkIsTypeLiteral(node: ts.Node): boolean { + if (ts.isUnionTypeNode(node) || ts.isIntersectionTypeNode(node)) { + return node.types.some((typeNode) => { + return this.checkIsTypeLiteralWithTypeNodes(typeNode); + }); + } + + return this.checkIsTypeLiteralWithTypeNodes(node); + } + + private checkIsTypeLiteralWithTypeNodes(node: ts.Node): boolean { + if (ts.isTypeLiteralNode(node) && node.members.length > 0) { + return true; + } + + if (ts.isTypeReferenceNode(node) && node.typeName) { + const typeDecl = this.tsUtils.getDeclarationNode(node.typeName); + return ( + typeDecl !== undefined && ts.isTypeAliasDeclaration(typeDecl) && this.checkSpecialTypeNode(typeDecl.type, false) + ); + } + + return false; + } + + private checkSpecialTypeNode(typeNode: ts.Node, isNeedCheckIsTypeLiteral: boolean): boolean { + let specialType = + ts.isIndexedAccessTypeNode(typeNode) || + ts.isConditionalTypeNode(typeNode) || + ts.isFunctionTypeNode(typeNode) || + ts.isMappedTypeNode(typeNode) || + ts.isTemplateLiteralTypeNode(typeNode); + if (isNeedCheckIsTypeLiteral) { + specialType ||= this.checkIsTypeLiteral(typeNode); + } + return specialType; + } + + private isObjectLiteralExpression(decl: ts.Node): boolean { + const isVariableWithInitializer = + ts.isVariableDeclaration(decl) && decl.initializer && ts.isObjectLiteralExpression(decl.initializer); + + const isVariableWithTypeLiteral = ts.isVariableDeclaration(decl) && decl.type && this.checkIsTypeLiteral(decl.type); + const isObjectLiteralExpression = + ts.isObjectLiteralExpression(decl) || + this.checkIsTypeLiteral(decl) || + isVariableWithInitializer || + isVariableWithTypeLiteral; + return !!isObjectLiteralExpression; + } + + private static hasObjectLiteralReturn(funcNode: ts.FunctionLikeDeclaration): boolean { + let found = false; + function visit(node: ts.Node): void { + if (found) { + return; + } + + if (ts.isReturnStatement(node) && node.expression && ts.isObjectLiteralExpression(node.expression)) { + found = true; + return; + } + + ts.forEachChild(node, visit); + } + visit(funcNode); + return found; + } + + private static extractKeyofFromString(typeString: string): boolean { + return (/\bkeyof\b/).test(typeString); + } + checkUnionTypes(propertyAccessNode: ts.PropertyAccessExpression): void { if (!this.options.arkts2) { return; @@ -1627,6 +1825,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handlePropertyAssignmentForProp(node); this.handleQuotedHyphenPropsDeprecated(node); + this.handleNoDeprecatedApi(node); const propName = node.name; if (!propName || !(ts.isNumericLiteral(propName) || this.options.arkts2 && ts.isStringLiteral(propName))) { return; @@ -2605,6 +2804,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleObjectLiteralAssignment(tsVarDecl); this.handlePropertyDescriptorInScenarios(tsVarDecl); this.handleSdkGlobalApi(tsVarDecl); + this.handleNoDeprecatedApi(tsVarDecl); } private checkTypeFromSdk(type: ts.TypeNode | undefined): void { @@ -3603,6 +3803,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleSdkGlobalApi(tsMethodDecl); this.handleLimitedVoidFunction(tsMethodDecl); this.checkVoidLifecycleReturn(tsMethodDecl); + this.handleNoDeprecatedApi(tsMethodDecl); } private handleLimitedVoidFunction(node: ts.FunctionLikeDeclaration): void { @@ -4192,15 +4393,15 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!ts.isIdentifier(node)) { return; } + this.checkCollectionsSymbol(node); this.handleInterfaceImport(node); this.checkAsonSymbol(node); const tsIdentifier = node; this.handleTsInterop(tsIdentifier, () => { const parent = tsIdentifier.parent; - if (ts.isPropertyAccessExpression(parent) || ts.isImportSpecifier(parent)) { + if (ts.isImportSpecifier(parent)) { return; } - const type = this.tsTypeChecker.getTypeAtLocation(tsIdentifier); this.checkUsageOfTsTypes(type, tsIdentifier); }); @@ -4210,31 +4411,29 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } - const isArkTs2 = this.options.arkts2; - const isGlobalThis = tsIdentifier.text === 'globalThis'; + const isNewArkTS = this.options.arkts2; + if (isNewArkTS) { + this.checkWorkerSymbol(tsIdentSym, node); + this.checkConcurrencySymbol(tsIdentSym, node); + } + const isGlobalThis = tsIdentifier.text === 'globalThis'; if ( isGlobalThis && (tsIdentSym.flags & ts.SymbolFlags.Module) !== 0 && (tsIdentSym.flags & ts.SymbolFlags.Transient) !== 0 ) { - this.handleGlobalThisCase(tsIdentifier, isArkTs2); + this.handleGlobalThisCase(tsIdentifier, isNewArkTS); } else { - if (isArkTs2) { + if (isNewArkTS) { this.checkLimitedStdlibApi(tsIdentifier, tsIdentSym); } this.handleRestrictedValues(tsIdentifier, tsIdentSym); } - if (isArkTs2 && this.tsTypeChecker.isArgumentsSymbol(tsIdentSym)) { + if (isNewArkTS && this.tsTypeChecker.isArgumentsSymbol(tsIdentSym)) { this.incrementCounters(node, FaultID.ArgumentsObject); } - - if (isArkTs2) { - this.checkWorkerSymbol(tsIdentSym, node); - this.checkCollectionsSymbol(tsIdentSym, node); - this.checkConcurrencySymbol(tsIdentSym, node); - } } private handlePropertyDescriptorInScenarios(node: ts.Node): void { @@ -5010,6 +5209,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleSdkGlobalApi(tsCallExpr); this.handleObjectLiteralAssignmentToClass(tsCallExpr); this.checkRestrictedAPICall(tsCallExpr); + this.handleNoDeprecatedApi(tsCallExpr); } private handleCallExpressionForUI(node: ts.CallExpression): void { @@ -5681,7 +5881,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleSharedArrayBuffer(tsNewExpr); this.handleSdkGlobalApi(tsNewExpr); this.checkCreatingPrimitiveTypes(tsNewExpr); - + this.handleNoDeprecatedApi(tsNewExpr); if (this.options.advancedClassChecks || this.options.arkts2) { const calleeExpr = tsNewExpr.expression; const calleeType = this.tsTypeChecker.getTypeAtLocation(calleeExpr); @@ -6059,7 +6259,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleSdkGlobalApi(typeRef); this.handleSdkConstructorIface(typeRef); this.handleNodeForWrappedBuilder(typeRef); - + this.handleNoDeprecatedApi(typeRef); const isESValue = TsUtils.isEsValueType(typeRef); const isPossiblyValidContext = TsUtils.isEsValuePossiblyAllowed(typeRef); if (isESValue && !isPossiblyValidContext) { @@ -7753,6 +7953,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } else if (ts.isIdentifier(expr)) { this.fixJsImportExtendsClass(node.parent, expr); } + if (ts.isIdentifier(expr)) { + this.handleNoDeprecatedApi(expr); + } }); this.handleMissingSuperCallInExtendedClass(node); @@ -7851,7 +8054,11 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } - private checkCollectionsSymbol(symbol: ts.Symbol, node: ts.Node): void { + private checkCollectionsSymbol(node: ts.Node): void { + if (!this.options.arkts2) { + return; + } + const cb = (): void => { const parent = node.parent; if (!parent) { @@ -7868,12 +8075,15 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } if (ts.isImportSpecifier(parent) && ts.isIdentifier(node)) { + if (parent.propertyName && node.text === parent.propertyName.text) { + return; + } const autofix = this.autofixer?.removeImport(node, parent); this.incrementCounters(node, FaultID.NoNeedStdLibSendableContainer, autofix); } }; - this.checkSymbolAndExecute(symbol, COLLECTIONS_TEXT, COLLECTIONS_MODULES, cb); + this.checkNodeForUsage(node, COLLECTIONS_TEXT, COLLECTIONS_MODULES, cb); } private checkWorkerSymbol(symbol: ts.Symbol, node: ts.Node): void { @@ -7905,6 +8115,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const decl = TsUtils.getDeclaration(symbol); if (!decl) { + cb(); return; } @@ -7920,6 +8131,19 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } + private checkNodeForUsage(node: ts.Node, symbolName: string, modules: string[], cb: () => void): void { + const symbol = this.tsUtils.trueSymbolAtLocation(node); + if (symbol) { + this.checkSymbolAndExecute(symbol, symbolName, modules, cb); + + return; + } + + if (node.getText() === symbolName) { + cb(); + } + } + interfacesNeedToAlarm: ts.Identifier[] = []; interfacesNeedToImport: Set = new Set(); interfacesAlreadyImported: Set = new Set(); @@ -9467,9 +9691,34 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private isApplicationContext(node: ts.CallExpression): boolean { - void this; - const left = (node.expression as ts.PropertyAccessExpression).expression; - return ts.isIdentifier(left) && left.text === 'applicationContext'; + const expr = node.expression as ts.PropertyAccessExpression; + if (!ts.isIdentifier(expr.expression)) return false; + const type = this.tsTypeChecker.getTypeAtLocation(expr.expression); + const symbol = type.getSymbol(); + return symbol ? this.checkApplicationContextSymbol(symbol, type) : false; + } + + private checkApplicationContextSymbol(symbol: ts.Symbol, type: ts.Type): boolean { + if (symbol.getName() === "default") { + const declarations = symbol.getDeclarations() || []; + for (const decl of declarations) { + if (ts.isClassDeclaration(decl) && + decl.name?.getText() === ABILITY_LIFECYCLE_SDK && + decl.getSourceFile().fileName.endsWith(`${ABILITY_LIFECYCLE_SDK}${EXTNAME_D_TS}`)) { + return true; + } + } + return false; + } + const symbolName = symbol.getName(); + const hasValidName = symbolName === ABILITY_LIFECYCLE_SDK; + if (hasValidName) { + const declarations = symbol.getDeclarations() || []; + return declarations.some(decl => + decl.getSourceFile().fileName.endsWith(`${ABILITY_LIFECYCLE_SDK}${EXTNAME_D_TS}`) + ); + } + return false; } private handleForOfJsArray(node: ts.ForOfStatement): void { @@ -12133,4 +12382,486 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private isTargetInterface(node: ts.Node, targetName: string): boolean { return ts.isIdentifier(node) && node.getText() === targetName && !this.isDeclarationInSameFile(node); } + + private handleNoDeprecatedApi( + node: + | ts.TypeReferenceNode + | ts.NewExpression + | ts.VariableDeclaration + | ts.PropertyDeclaration + | ts.ParameterDeclaration + | ts.CallExpression + | ts.BinaryExpression + | ts.ExpressionWithTypeArguments + | ts.Identifier + | ts.MethodDeclaration + | ts.PropertyAssignment + | ts.PropertyAccessExpression + ): void { + if (!this.options.arkts2) { + return; + } + switch (node.kind) { + case ts.SyntaxKind.TypeReference: + this.checkTypeReferenceForDeprecatedApi(node); + break; + case ts.SyntaxKind.Identifier: + this.checkHeritageClauseForDeprecatedApi(node); + break; + case ts.SyntaxKind.PropertyDeclaration: + this.checkPropertyDeclarationForDeprecatedApi(node); + break; + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.VariableDeclaration: + this.checkDeclarationForDeprecatedApi(node); + break; + case ts.SyntaxKind.MethodDeclaration: + this.checkMethodDeclarationForDeprecatedApi(node); + break; + case ts.SyntaxKind.PropertyAssignment: + this.checkPropertyAssignmentForDeprecatedApi(node); + break; + case ts.SyntaxKind.NewExpression: + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.BinaryExpression: + case ts.SyntaxKind.PropertyAccessExpression: + this.handleNoDeprecatedApiForExpression(node); + break; + default: + } + } + + handleNoDeprecatedApiForExpression( + node: ts.NewExpression | ts.CallExpression | ts.BinaryExpression | ts.PropertyAccessExpression + ): void { + switch (node.kind) { + case ts.SyntaxKind.NewExpression: + this.checkNewExpressionForDeprecatedApi(node); + break; + case ts.SyntaxKind.CallExpression: + this.checkCallExpressionForDeprecatedApi(node); + break; + case ts.SyntaxKind.BinaryExpression: + this.checkBinaryExpressionForDeprecatedApi(node); + break; + case ts.SyntaxKind.PropertyAccessExpression: + this.checkPropertyAccessExpressionForDeprecatedApi(node); + break; + default: + } + } + + private checkTypeReferenceForDeprecatedApi(node: ts.TypeReferenceNode): void { + let typeName = node.typeName; + if (ts.isQualifiedName(node.typeName)) { + typeName = node.typeName.right; + } + const decl = this.tsUtils.getDeclarationNode(typeName); + if (decl && (ts.isInterfaceDeclaration(decl) || ts.isClassDeclaration(decl))) { + let parentName = decl.name ? decl.name.text : 'unnamed'; + if (ts.isQualifiedName(node.typeName)) { + parentName = node.typeName.getText(); + } + const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + parentName, + undefined, + undefined, + path.basename(decl.getSourceFile().fileName + '') + ); + this.processApiNodeDeprecatedApi(typeName.getText(), typeName, deprecatedApiCheckMap); + } + } + + private checkNewExpressionForDeprecatedApi(node: ts.NewExpression): void { + const expression = node.expression; + if (ts.isIdentifier(expression)) { + const decl = this.tsUtils.getDeclarationNode(expression); + if (decl && ts.isClassDeclaration(decl)) { + const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + decl.name?.text + '', + undefined, + undefined, + path.basename(decl.getSourceFile().fileName + '') + ); + this.processApiNodeDeprecatedApi(expression.text, expression, deprecatedApiCheckMap); + } + } + } + + private checkHeritageClauseForDeprecatedApi(node: ts.Identifier): void { + const decl = this.tsUtils.getDeclarationNode(node); + if (decl && ts.isInterfaceDeclaration(decl)) { + const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + decl.name.text, + undefined, + undefined, + path.basename(decl.getSourceFile().fileName + '') + ); + this.processApiNodeDeprecatedApi(node.getText(), node, deprecatedApiCheckMap); + } + } + + private checkDeclarationForDeprecatedApi( + node: ts.VariableDeclaration | ts.PropertyDeclaration | ts.ParameterDeclaration + ): void { + const expression = node.initializer; + const getParaExcute = (expression: ts.Expression): void => { + if (expression && ts.isIdentifier(expression)) { + const funSymbol = this.tsUtils.trueSymbolAtLocation(expression); + const decl = TsUtils.getDeclaration(funSymbol); + const parName = this.tsUtils.getParentSymbolName(funSymbol); + if (decl && (ts.isFunctionLike(decl) || ts.isVariableDeclaration(decl))) { + const returnType = decl.type?.getText(); + const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + parName === undefined ? DEPRECATE_UNNAMED : parName + '', + undefined, + returnType, + path.basename(decl.getSourceFile().fileName) + ); + this.processApiNodeDeprecatedApi(expression.text, expression, deprecatedApiCheckMap); + } + } + }; + + if (expression && ts.isIdentifier(expression)) { + getParaExcute(expression); + } else if (expression && ts.isObjectLiteralExpression(expression)) { + const properties = expression.properties; + for (const prop of properties) { + const propExpression = ts.isPropertyAssignment(prop) && prop.initializer; + if (propExpression && ts.isIdentifier(propExpression)) { + getParaExcute(propExpression); + } + } + } + } + + private checkCallExpressionForDeprecatedApi(node: ts.CallExpression): void { + let name: ts.Identifier | undefined; + if (ts.isIdentifier(node.expression)) { + name = node.expression; + } else if (ts.isPropertyAccessExpression(node.expression)) { + name = ts.isIdentifier(node.expression.name) ? node.expression.name : undefined; + } + if (!name) { + return; + } + let funSymbol = this.tsUtils.trueSymbolAtLocation(name); + if (!funSymbol && ts.isPropertyAccessExpression(node.expression)) { + funSymbol = this.tsTypeChecker.getSymbolAtLocation(node.expression.expression); + } + const decl = TsUtils.getDeclaration(funSymbol); + const parName = this.tsUtils.getParentSymbolName(funSymbol); + if (decl && (ts.isFunctionLike(decl) || ts.isVariableDeclaration(decl))) { + const returnType = decl.type?.getText() === undefined ? 'any' : decl.type?.getText() + ''; + const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + parName === undefined ? DEPRECATE_UNNAMED : parName + '', + ts.isFunctionLike(decl) ? decl.parameters : undefined, + returnType, + path.basename(decl.getSourceFile().fileName) + ); + this.reportDeprecatedApi(node, name, deprecatedApiCheckMap); + } + this.checkSpecialApiForDeprecatedApi(node, name, decl); + } + + private reportDeprecatedApi( + node: ts.CallExpression, + name: ts.Identifier, + deprecatedApiCheckMap?: Map> + ): void { + const isMatched = this.isMatchedDeprecatedApi(name.text, deprecatedApiCheckMap); + if (isMatched) { + const autofix = this.autofixer?.fixDeprecatedApiForCallExpression(node); + if (autofix) { + this.interfacesNeedToImport.add('getUIContext'); + } + this.incrementCounters(name, FaultID.NoDeprecatedApi, autofix); + } + } + + private checkSpecialApiForDeprecatedApi( + node: ts.CallExpression, + name: ts.Identifier, + decl: ts.Declaration | undefined + ): void { + if (('mask' === name.getText() || 'clip' === name.getText()) && node.arguments.length === 1) { + const types = ['CircleAttribute', 'EllipseAttribute', ' PathAttribute', 'RectAttribute']; + const arg = node.arguments[0]; + const argType = this.tsTypeChecker.typeToString(this.tsTypeChecker.getTypeAtLocation(arg)); + if (types.includes(argType)) { + if (name.getText() === 'clip') { + const typeMapping = { + CircleAttribute: 'CircleShape', + EllipseAttribute: 'EllipseShape', + PathAttribute: 'PathShape', + RectAttribute: 'RectShape' + } as const; + + if (argType in typeMapping) { + this.interfacesNeedToImport.add(typeMapping[argType as keyof typeof typeMapping]); + } + + const autofix = this.autofixer?.fixSpecialDeprecatedApiForCallExpression(node, name); + this.incrementCounters(name, FaultID.NoDeprecatedApi, autofix); + return; + } + this.incrementCounters(name, FaultID.NoDeprecatedApi); + return; + } + } + if (decl?.parent && ts.isClassDeclaration(decl.parent) && 'onScroll' === name.getText()) { + let parentName = ''; + decl.parent.heritageClauses?.forEach((clause) => { + clause.types.forEach((type) => { + if (ts.isExpressionWithTypeArguments(type)) { + parentName = type.expression.getText(); + } + }); + }); + if (parentName === 'ScrollableCommonMethod') { + this.incrementCounters(name, FaultID.NoDeprecatedApi); + } + } + } + + private checkBinaryExpressionForDeprecatedApi(node: ts.BinaryExpression): void { + const expression = node.right; + if (ts.isIdentifier(expression)) { + this.processApiNodeDeprecatedApi(expression.text, expression); + } + } + + private checkMethodDeclarationForDeprecatedApi(node: ts.MethodDeclaration): void { + const expression = node.name; + if (!ts.isIdentifier(expression)) { + return; + } + if ( + (expression.getText() === 'onLayout' || expression.getText() === 'onMeasure') && + node.type?.getText() === 'void' && + node.parent && + ts.isStructDeclaration(node.parent) + ) { + const argsType = ['LayoutChild[]', 'ConstraintSizeOptions']; + const parameters = node.parameters; + if (parameters && parameters.length === 2) { + let paramMatch = true; + for (let i = 0; i < parameters.length; i++) { + if (this.tsTypeChecker.typeToString(this.tsTypeChecker.getTypeAtLocation(parameters[i])) !== argsType[i]) { + paramMatch = false; + break; + } + } + if (paramMatch) { + this.incrementCounters(expression, FaultID.NoDeprecatedApi); + return; + } + } + } + this.processApiNodeDeprecatedApi(expression.text, expression); + } + + private checkPropertyAssignmentForDeprecatedApi(node: ts.PropertyAssignment): void { + const expression = node.name; + const contextualType = this.tsTypeChecker.getContextualType(node.parent); + if (contextualType) { + this.processApiNodeDeprecatedApi( + expression.getText(), + expression, + TypeScriptLinter.getPropertyTypeForPropertyAssignment(node, contextualType) + ); + } + } + + private checkPropertyAccessExpressionForDeprecatedApi(node: ts.PropertyAccessExpression): void { + node.forEachChild((expression) => { + if (!ts.isIdentifier(expression)) { + return; + } + const funSymbol = this.tsUtils.trueSymbolAtLocation(expression); + const decl = TsUtils.getDeclaration(funSymbol); + let parName = this.tsUtils.getParentSymbolName(funSymbol); + if ( + decl && + (ts.isPropertyDeclaration(decl) || + ts.isPropertySignature(decl) || + ts.isEnumMember(decl) || + ts.isEnumDeclaration(decl)) && + decl.parent + ) { + let returnType: string | undefined = this.tsTypeChecker.typeToString( + this.tsTypeChecker.getTypeAtLocation(decl) + ); + if (ts.isPropertySignature(decl) && decl.type) { + returnType = decl.type.getText(); + } else if (ts.isEnumMember(decl)) { + returnType = TypeScriptLinter.getReturnTypeForEnumMember(decl); + } else if (!parName && ts.isEnumDeclaration(decl)) { + parName = decl.name.text; + returnType = undefined; + } + const deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + parName === undefined ? DEPRECATE_UNNAMED : parName + '', + undefined, + returnType, + path.basename(decl.getSourceFile().fileName) + ); + this.processApiNodeDeprecatedApi(expression.text, expression, deprecatedApiCheckMap); + } + }); + } + + private checkPropertyDeclarationForDeprecatedApi(node: ts.PropertyDeclaration): void { + const expression = node.name; + if (ts.isIdentifier(expression)) { + this.processApiNodeDeprecatedApi(expression.text, expression); + } + } + + private processApiNodeDeprecatedApi( + apiName: string, + errorNode: ts.Node, + deprecatedApiCheckMap?: Map>, + autofix?: Autofix[] + ): void { + const matchedApi = this.isMatchedDeprecatedApi(apiName, deprecatedApiCheckMap); + if (matchedApi) { + this.incrementCounters(errorNode, FaultID.NoDeprecatedApi, autofix); + } + } + + private isMatchedDeprecatedApi( + apiName: string, + deprecatedApiCheckMap?: Map> + ): boolean { + void this; + const setApiListItem = TypeScriptLinter.deprecatedApiInfo; + if (!setApiListItem || !deprecatedApiCheckMap) { + return false; + } + const apiNamesArr = [...setApiListItem]; + const matchedApi = apiNamesArr.some((apiInfoItem) => { + if (apiInfoItem.api_info.parent_api?.length <= 0) { + return false; + } + let isSameApi = apiInfoItem.api_info.api_name === apiName; + isSameApi &&= + apiInfoItem.api_info.parent_api[0].api_name === deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARENT_NAME); + isSameApi &&= + this.normalizeTypeString(apiInfoItem.api_info.method_return_type) === + this.normalizeTypeString(deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.RETURN_TYPE)); + const api_func_args = apiInfoItem.api_info.api_func_args; + const params = deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.PARAM_SET); + if (api_func_args && params) { + const isParametersEqual = TypeScriptLinter.areParametersEqualForDeprecated( + api_func_args, + params as ts.NodeArray + ); + isSameApi &&= isParametersEqual; + } + const fileName = deprecatedApiCheckMap?.get(DEPRECATE_CHECK_KEY.FILE_NAME) + ''; + const isSameFile = fileName.endsWith(path.basename(apiInfoItem.file_path)); + return isSameFile && isSameApi; + }); + return matchedApi; + } + + private static getPropertyTypeForPropertyAssignment( + propertyAssignment: ts.PropertyAssignment, + contextualType: ts.Type + ): Map> | undefined { + const propertyName = propertyAssignment.name.getText(); + if (contextualType.isUnion()) { + for (const type of contextualType.types) { + const deprecatedApiCheckMap = TypeScriptLinter.getPropertyInfoByContextualType(type, propertyName); + if (deprecatedApiCheckMap) { + return deprecatedApiCheckMap; + } + } + } + return TypeScriptLinter.getPropertyInfoByContextualType(contextualType, propertyName); + } + + private static getPropertyInfoByContextualType( + type: ts.Type, + propertyName: string + ): Map> | undefined { + const propertySymbol = type.getProperty(propertyName); + if (!propertySymbol) { + return undefined; + } + const propertyDecl = TsUtils.getDeclaration(propertySymbol); + let deprecatedApiCheckMap = new Map>(); + if (propertyDecl && ts.isPropertySignature(propertyDecl) && propertyDecl.type) { + deprecatedApiCheckMap = TypeScriptLinter.updateDeprecatedApiCheckMap( + type.getSymbol()?.name + '', + undefined, + propertyDecl.type.getText(), + path.basename(propertyDecl.getSourceFile().fileName + '') + ); + } + return deprecatedApiCheckMap; + } + + private static updateDeprecatedApiCheckMap( + parentName: string, + parames: ts.NodeArray | undefined, + returnType: string | undefined, + fileName: string + ): Map> { + const deprecatedApiCheckMap = new Map>(); + deprecatedApiCheckMap.set(DEPRECATE_CHECK_KEY.PARENT_NAME, parentName); + if (parames) { + deprecatedApiCheckMap.set(DEPRECATE_CHECK_KEY.PARAM_SET, parames); + } + if (returnType) { + deprecatedApiCheckMap.set(DEPRECATE_CHECK_KEY.RETURN_TYPE, returnType); + } + deprecatedApiCheckMap.set(DEPRECATE_CHECK_KEY.FILE_NAME, fileName); + return deprecatedApiCheckMap; + } + + private static getReturnTypeForEnumMember(node: ts.EnumMember): string { + const enumDecl = node.parent; + if (!enumDecl?.members || enumDecl.members.length === 0) { + return ''; + } + for (let i = 0; i < enumDecl.members.length; i++) { + if (enumDecl.members[i].name.getText() === node.name.getText()) { + return i + ''; + } + } + return ''; + } + + private normalizeTypeString( + typeStr: string | ts.NodeArray | undefined + ): string | ts.NodeArray | undefined { + void this; + if (typeof typeStr === 'string') { + return typeStr.replace(/\s+/g, ''); + } + return typeStr; + } + + private static areParametersEqualForDeprecated( + sdkFuncArgs: { name: string; type: string }[], + memberParams: ts.NodeArray + ): boolean { + const apiParamCout = sdkFuncArgs.length; + const memberParamCout = memberParams.length; + if (apiParamCout > memberParamCout && sdkFuncArgs[memberParamCout]) { + return false; + } + for (let i = 0; i < apiParamCout; i++) { + const typeName = memberParams[i]?.type?.getText(); + const newtypeName = typeName?.replace(/\s+/g, ''); + const sdkArgName = sdkFuncArgs[i].type.replace(/\s+/g, ''); + if (newtypeName !== sdkArgName) { + return false; + } + } + return true; + } } diff --git a/ets2panda/linter/src/lib/autofixes/Autofixer.ts b/ets2panda/linter/src/lib/autofixes/Autofixer.ts index 8ab3dc2c126e3d155c81aaae7406ebcf3e3c09c1..dd88357f643f6c820f955aef75d578eac5fdf105 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -63,6 +63,7 @@ import { } from '../utils/consts/InteropAPI'; import path from 'node:path'; import { isStdLibrarySymbol } from '../utils/functions/IsStdLibrary'; +import { propertyAccessReplacements, identifierReplacements } from '../utils/consts/DeprecatedApi'; const UNDEFINED_NAME = 'undefined'; @@ -3462,7 +3463,11 @@ export class Autofixer { return undefined; } - const replacementText = this.nonCommentPrinter.printNode(ts.EmitHint.Unspecified, replacement, expression.getSourceFile()); + const replacementText = this.nonCommentPrinter.printNode( + ts.EmitHint.Unspecified, + replacement, + expression.getSourceFile() + ); return [{ start: expression.getStart(), end: expression.getEnd(), replacementText }]; } @@ -4333,6 +4338,10 @@ export class Autofixer { moduleSpecifier: string, defaultSymbol?: ts.Symbol ): Autofix[] | undefined { + if (!Autofixer.shouldTransformImport(moduleSpecifier)) { + return undefined; + } + let statements: string[] = []; if (importClause.name) { const symbolName = importClause.name.text; @@ -4354,22 +4363,38 @@ export class Autofixer { statements ); } - if (statements.length <= 0) { - return undefined; - } - let lastImportEnd = this.lastImportEndMap.get(this.sourceFile.fileName); - if (!lastImportEnd) { - lastImportEnd = this.getLastImportEnd(); - this.lastImportEndMap.set(this.sourceFile.fileName, lastImportEnd); - } - return [ - { start: importDecl.getStart(), end: importDecl.getEnd(), replacementText: '' }, - { - start: lastImportEnd, - end: lastImportEnd, - replacementText: statements.join(this.getNewLine()) + this.getNewLine() - } - ]; + + return [Autofixer.createImportDeclarationFix(importDecl), this.createInsertStatementsFix(importDecl, statements)]; + } + + private static createImportDeclarationFix(importDecl: ts.ImportDeclaration): Autofix { + return { + start: importDecl.getStart(), + end: importDecl.getEnd(), + replacementText: '' + }; + } + + private createInsertStatementsFix(importDecl: ts.ImportDeclaration, statements: string[]): Autofix { + const joinedStatements = statements.join(this.getNewLine()); + const replacementText = this.detectNeedsLeadingNewline(importDecl) ? + this.getNewLine() + joinedStatements : + joinedStatements; + + return { + start: importDecl.getEnd(), + end: importDecl.getEnd(), + replacementText + }; + } + + private static shouldTransformImport(moduleSpecifier: string): boolean { + return moduleSpecifier.endsWith('.js') || moduleSpecifier.startsWith('./') || moduleSpecifier.startsWith('../'); + } + + private detectNeedsLeadingNewline(importDecl: ts.ImportDeclaration): boolean { + const prevToken = ts.getLeadingCommentRanges(this.sourceFile.text, importDecl.getFullStart())?.[0]; + return !!prevToken && !(/^\s*$/).test(this.sourceFile.text.slice(prevToken.end, importDecl.getStart())); } private getStatementForInterOpImportJsOnNamedBindings( @@ -5328,4 +5353,91 @@ export class Autofixer { this.printer.printNode(ts.EmitHint.Unspecified, newExpr, stmt.getSourceFile()); return [{ start: stmt.getEnd(), end: stmt.getEnd(), replacementText: text }]; } + + fixDeprecatedApiForCallExpression(callExpr: ts.CallExpression): Autofix[] | undefined { + const createUIContextAccess = (methodName: string): ts.Node => { + return ts.factory.createPropertyAccessExpression( + ts.factory.createCallExpression(ts.factory.createIdentifier('getUIContext'), undefined, []), + ts.factory.createIdentifier(methodName) + ); + }; + + if (ts.isPropertyAccessExpression(callExpr.expression)) { + const fullName = `${callExpr.expression.expression.getText()}.${callExpr.expression.name.getText()}`; + const methodName = propertyAccessReplacements.get(fullName); + if (methodName) { + const newExpression = createUIContextAccess(methodName); + const newText = this.printer.printNode(ts.EmitHint.Unspecified, newExpression, callExpr.getSourceFile()); + return [ + { + start: callExpr.expression.getStart(), + end: callExpr.expression.getEnd(), + replacementText: newText + } + ]; + } + } + + if (ts.isIdentifier(callExpr.expression)) { + const identifierText = callExpr.expression.getText(); + const methodName = identifierReplacements.get(identifierText); + + if (methodName) { + const newExpression = createUIContextAccess(methodName); + const newText = this.printer.printNode(ts.EmitHint.Unspecified, newExpression, callExpr.getSourceFile()); + return [ + { + start: callExpr.expression.getStart(), + end: callExpr.expression.getEnd(), + replacementText: newText + } + ]; + } + } + + return undefined; + } + + fixSpecialDeprecatedApiForCallExpression(callExpr: ts.CallExpression, name: ts.Identifier): Autofix[] | undefined { + if (name.getText() !== 'clip' || !ts.isNewExpression(callExpr.arguments[0])) { + return undefined; + } + + const shapeMap = { + Circle: 'CircleShape', + Path: 'PathShape', + Ellipse: 'EllipseShape', + Rect: 'RectShape' + } as const; + + const argsExpr = callExpr.arguments[0].arguments; + const constructorName = callExpr.arguments[0].expression.getText(); + + if ( + ts.isPropertyAccessExpression(callExpr.expression) && + callExpr.expression.name.text === 'clip' && + constructorName in shapeMap + ) { + const shapeType = shapeMap[constructorName as keyof typeof shapeMap]; + const newExpression = ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression( + callExpr.expression.expression, + ts.factory.createIdentifier('clipShape') + ), + undefined, + [ts.factory.createNewExpression(ts.factory.createIdentifier(shapeType), undefined, argsExpr)] + ); + + const newText = this.printer.printNode(ts.EmitHint.Unspecified, newExpression, callExpr.getSourceFile()); + return [ + { + start: callExpr.getStart(), + end: callExpr.getEnd(), + replacementText: newText + } + ]; + } + + return undefined; + } } diff --git a/ets2panda/linter/src/lib/data/DeprecatedApiList.json b/ets2panda/linter/src/lib/data/DeprecatedApiList.json new file mode 100644 index 0000000000000000000000000000000000000000..2c05b55d141c4d13401df081b8b3b3d82312a892 --- /dev/null +++ b/ets2panda/linter/src/lib/data/DeprecatedApiList.json @@ -0,0 +1,10369 @@ +{ + "api_list": [ + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "clip", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "CommonMethod", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean | CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "T" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "opacity", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "TransitionOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "type", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "TransitionOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "TransitionType" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.curves.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "cubicBezier", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "curves", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "x1", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "y1", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "x2", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "y2", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "string" + }, + "import_path": [ + "@ohos.curves", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "rotate", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "TransitionOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "RotateOptions" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "scale", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "TransitionOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "ScaleOptions" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "translate", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "TransitionOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "TranslateOptions" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigation.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "toolBar", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavigationAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "object | CustomBuilder", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "NavigationAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigation.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "subTitle", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavigationAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "NavigationAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "px2lpx", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "lpx2px", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "px2fp", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "fp2px", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "px2vp", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "vp2px", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getContext", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "component", + "type": "Object", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "Context" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/xcomponent.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "setXComponentSurfaceSize", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "XComponentController", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "{\n surfaceWidth: number;\n surfaceHeight: number;\n }", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/text_input.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onEditChanged", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "TextInputAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "(isEditing: boolean) => void", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "TextInputAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "screenY", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "TouchObject", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "screenX", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "TouchObject", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "screenY", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "MouseEvent", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "screenX", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "MouseEvent", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "screenY", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ClickEvent", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "screenX", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ClickEvent", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/image_animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "preDecode", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ImageAnimatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "ImageAnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/text_picker.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "show", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "TextPickerDialog", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "TextPickerDialogOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/text_picker.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onCancel", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "TextPickerAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "() => void", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "TextPickerAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/text_picker.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onAccept", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "TextPickerAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "(value: string, index: number) => void", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "TextPickerAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/date_picker.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "show", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DatePickerDialog", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "DatePickerDialogOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/date_picker.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onChange", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DatePickerDialogOptions", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "DatePickerResult", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "(value: DatePickerResult) => void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/date_picker.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onAccept", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DatePickerDialogOptions", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "DatePickerResult", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "(value: DatePickerResult) => void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/date_picker.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onChange", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DatePickerAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "(value: DatePickerResult)", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "DatePickerAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/lazy_for_each.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onDataChanged", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DataChangeListener", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/lazy_for_each.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onDataDeleted", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DataChangeListener", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/lazy_for_each.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onDataMoved", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DataChangeListener", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "from", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "to", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/lazy_for_each.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onDataAdded", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DataChangeListener", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.arkui.UIContext.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showActionMenu", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PromptAction", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "promptAction.ActionMenuOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "promptAction.ActionMenuSuccessResponse", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.arkui.UIContext", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/action_sheet.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "show", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ActionSheet", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "ActionSheetOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/alert_dialog.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "show", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AlertDialog", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "AlertDialogParamWithConfirm | AlertDialogParamWithButtons | AlertDialogParamWithOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/refresh.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "offset", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RefreshOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "number | string" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/enums.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Center", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "Edge", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "1" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/enums.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Middle", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "Edge", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "5" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.arkui.componentSnapshot.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "createFromBuilder", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "componentSnapshot", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "builder", + "type": "CustomBuilder", + "is_optional": false, + "has_default": false + }, + { + "name": "delay", + "type": "number", + "is_optional": true, + "has_default": false + }, + { + "name": "checkImageStatus", + "type": "boolean", + "is_optional": true, + "has_default": false + }, + { + "name": "options", + "type": "SnapshotOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.arkui.componentSnapshot", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.arkui.componentSnapshot.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "createFromBuilder", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "componentSnapshot", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "builder", + "type": "CustomBuilder", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + }, + { + "name": "delay", + "type": "number", + "is_optional": true, + "has_default": false + }, + { + "name": "checkImageStatus", + "type": "boolean", + "is_optional": true, + "has_default": false + }, + { + "name": "options", + "type": "SnapshotOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.arkui.componentSnapshot", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.arkui.componentSnapshot.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "get", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "componentSnapshot", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "id", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "SnapshotOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.arkui.componentSnapshot", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.arkui.componentSnapshot.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "get", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "componentSnapshot", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "id", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "SnapshotOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.arkui.componentSnapshot", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.measure.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "measureTextSize", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "MeasureText", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "MeasureOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "SizeOptions" + }, + "import_path": [ + "@ohos.measure", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.measure.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "measureText", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "MeasureText", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "MeasureOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number" + }, + "import_path": [ + "@ohos.measure", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.arkui.dragController.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getDragPreview", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "dragController", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "DragPreview" + }, + "import_path": [ + "@ohos.arkui.dragController", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.arkui.dragController.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "createDragAction", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "dragController", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "customArray", + "type": "Array", + "is_optional": false, + "has_default": false + }, + { + "name": "dragInfo", + "type": "DragInfo", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "DragAction" + }, + "import_path": [ + "@ohos.arkui.dragController", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.arkui.dragController.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "executeDrag", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "dragController", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "custom", + "type": "CustomBuilder | DragItemInfo", + "is_optional": false, + "has_default": false + }, + { + "name": "dragInfo", + "type": "DragInfo", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.arkui.dragController", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.arkui.dragController.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "executeDrag", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "dragController", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "custom", + "type": "CustomBuilder | DragItemInfo", + "is_optional": false, + "has_default": false + }, + { + "name": "dragInfo", + "type": "DragInfo", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.arkui.dragController", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getShared", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "LocalStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "LocalStorage" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.arkui.inspector.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "createComponentObserver", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "inspector", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "id", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "ComponentObserver" + }, + "import_path": [ + "@ohos.arkui.inspector", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "create", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Animator", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "AnimatorOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorResult" + }, + "import_path": [ + "@ohos.animator", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.mediaquery.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "matchMediaSync", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "mediaquery", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "condition", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "MediaQueryListener" + }, + "import_path": [ + "@ohos.mediaquery", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.font.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getFontByName", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "font", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "fontName", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "FontInfo" + }, + "import_path": [ + "@ohos.font", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.font.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getSystemFontList", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "font", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "Array" + }, + "import_path": [ + "@ohos.font", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.font.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "registerFont", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "font", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "FontOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.font", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replaceNamedRoute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "NamedRouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "mode", + "type": "RouterMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replaceNamedRoute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "NamedRouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "mode", + "type": "RouterMode", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replaceNamedRoute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "NamedRouterOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replaceNamedRoute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "NamedRouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "pushNamedRoute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "NamedRouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "mode", + "type": "RouterMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "pushNamedRoute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "NamedRouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "mode", + "type": "RouterMode", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "pushNamedRoute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "NamedRouterOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "pushNamedRoute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "NamedRouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getParams", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "Object" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "hideAlertBeforeBackPage", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showAlertBeforeBackPage", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "EnableAlertOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getStateByUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "url", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Array" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getStateByIndex", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "RouterState | undefined" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getState", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "RouterState" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getLength", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "string" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "clear", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "back", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "index", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "params", + "type": "Object", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "back", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replaceUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "mode", + "type": "RouterMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replaceUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "mode", + "type": "RouterMode", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replaceUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replaceUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "pushUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "mode", + "type": "RouterMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "pushUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "mode", + "type": "RouterMode", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "pushUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "pushUrl", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/time_picker.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "show", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "TimePickerDialog", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "TimePickerDialogOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "animateTo", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "AnimateParam", + "is_optional": false, + "has_default": false + }, + { + "name": "event", + "type": "() => void", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.promptAction.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showActionMenu", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "promptAction", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ActionMenuOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.promptAction", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.promptAction.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showActionMenu", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "promptAction", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ActionMenuOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.promptAction", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.promptAction.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "closeCustomDialog", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "promptAction", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "dialogId", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.promptAction", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.promptAction.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "openCustomDialog", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "promptAction", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "CustomDialogOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.promptAction", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.promptAction.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showDialog", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "promptAction", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ShowDialogOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.promptAction", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.promptAction.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showDialog", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "promptAction", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ShowDialogOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.promptAction", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.promptAction.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showToast", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "promptAction", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ShowToastOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.promptAction", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.arkui.componentUtils.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getRectangleById", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "componentUtils", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "id", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "ComponentInfo" + }, + "import_path": [ + "@ohos.arkui.componentUtils", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "layout", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "LayoutChild", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "childLayoutInfo", + "type": "LayoutInfo", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "position", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutChild", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "Position" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "borderInfo", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutChild", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "LayoutBorderInfo" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "position", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutInfo", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "Position" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "measure", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "LayoutChild", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "childConstraint", + "type": "ConstraintSizeOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "id", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutChild", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "constraint", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutChild", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "ConstraintSizeOptions" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "name", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutChild", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "constraint", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutInfo", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "ConstraintSizeOptions" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "margin", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutBorderInfo", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "Margin" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "useSizeType", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "CommonMethod", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "{\n xs?: number | { span: number; offset: number; };\n sm?: number | { span: number; offset: number; };\n md?: number | { span: number; offset: number; };\n lg?: number | { span: number; offset: number; };\n }", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "T" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "padding", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutBorderInfo", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "Padding" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "borderWidth", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "LayoutBorderInfo", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "EdgeWidths" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "mask", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "CommonMethod", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute | ProgressMask", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "T" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onMeasure", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "CustomComponent", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "children", + "type": "Array", + "is_optional": false, + "has_default": false + }, + { + "name": "constraint", + "type": "ConstraintSizeOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onLayout", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "CustomComponent", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "children", + "type": "Array", + "is_optional": false, + "has_default": false + }, + { + "name": "constraint", + "type": "ConstraintSizeOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "placementOnTop", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "PopupOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onScroll", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ScrollableCommonMethod", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "(scrollOffset: number)", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "T" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "touchable", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "CommonMethod", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "T" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "maskColor", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "CustomPopupOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "Color | string | Resource | number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getX", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DragEvent", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getY", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DragEvent", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "LayoutChild", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "LayoutChild", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "LayoutInfo", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "LayoutInfo", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "LayoutBorderInfo", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "LayoutBorderInfo", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "TransitionOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "TransitionOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "gridOffset", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "CommonMethod", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "T" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "gridSpan", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "CommonMethod", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "T" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "indicatorStyle", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "SwiperAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "IndicatorStyle", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "SwiperAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "IndicatorStyle", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "color", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "ResourceColor" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "right", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "Length" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "left", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "Length" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AUTO_LINEAR", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "SwiperDisplayMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "3" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AutoLinear", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "SwiperDisplayMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "1" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "selectedColor", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "ResourceColor" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "mask", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "bottom", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "Length" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "size", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "Length" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Stretch", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "SwiperDisplayMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "0" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/swiper.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "top", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "IndicatorStyle", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "Length" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/scroll.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "scrollPage", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Scroller", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "{ next: boolean; direction: Axis }", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/scroll.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Free", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "ScrollDirection", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "2" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/scroll.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onScrollEnd", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ScrollAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "() => void", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "ScrollAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/scroll.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onScroll", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ScrollAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "(xOffset: number, yOffset: number) => void", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "ScrollAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/ui_extension_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onResult", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "UIExtensionComponentAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "import('../api/@ohos.base').Callback<{\n\n code: number;\n\n want: import('../api/@ohos.app.ability.Want').default;\n\n }>", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "UIExtensionComponentAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/ui_extension_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onRelease", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "UIExtensionComponentAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "import('../api/@ohos.base').Callback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "UIExtensionComponentAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/slider.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "minLabel", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "SliderAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "SliderAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/slider.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "maxLabel", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "SliderAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "SliderAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/list_item.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ListItemAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ListItemInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "string", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "ListItemAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/list_item.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "sticky", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ListItemAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Sticky", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "ListItemAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/list_item.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "editable", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ListItemAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean | EditMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "ListItemAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/list_item.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Sticky", + "api_type": "EnumDeclaration", + "parent_api": [ + { + "api_name": "Sticky", + "api_type": "" + } + ], + "code_kind": 241, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/list_item.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "EditMode", + "api_type": "EnumDeclaration", + "parent_api": [ + { + "api_name": "EditMode", + "api_type": "" + } + ], + "code_kind": 241, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.arkui.advanced.ChipGroup.d.ets", + "api_info": { + "line": 1, + "problem": "", + "api_name": "suffixIcon", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ChipGroupItemOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "IconOptions" + }, + "import_path": [ + "@ohos.arkui.advanced.ChipGroup" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavRouterInstance", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "NavRouterAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavRouter", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "NavRouterInterface" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "mode", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavRouterAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "mode", + "type": "NavRouteMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "NavRouterAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onStateChange", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavRouterAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "(isActivated: boolean) => void", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "NavRouterAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavRouterAttribute", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "NavRouterAttribute", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "REPLACE", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "NavRouteMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "2" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PUSH", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "NavRouteMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "1" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PUSH_WITH_RECREATE", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "NavRouteMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "0" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavRouteMode", + "api_type": "EnumDeclaration", + "parent_api": [ + { + "api_name": "NavRouteMode", + "api_type": "" + } + ], + "code_kind": 241, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavRouterAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavRouterInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "RouteInfo", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "NavRouterAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavRouterAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavRouterInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "NavRouterAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavRouterInterface", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "NavRouterInterface", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "param", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RouteInfo", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "unknown" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "name", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RouteInfo", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/nav_router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "RouteInfo", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "RouteInfo", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavigatorInstance", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "NavigatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Navigator", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "NavigatorInterface" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "params", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavigatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "object", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "NavigatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "target", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavigatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "NavigatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "type", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavigatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "NavigationType", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "NavigatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "active", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavigatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "NavigatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavigatorAttribute", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "NavigatorAttribute", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavigatorAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavigatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "NavigatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavigatorAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "NavigatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "{ target: string; type: NavigationType }", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "NavigatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavigatorInterface", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "NavigatorInterface", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Replace", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "NavigationType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "2" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Back", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "NavigationType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "1" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Push", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "NavigationType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "0" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/navigator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NavigationType", + "api_type": "EnumDeclaration", + "parent_api": [ + { + "api_name": "NavigationType", + "api_type": "" + } + ], + "code_kind": 241, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "SizeType", + "api_type": "EnumDeclaration", + "parent_api": [ + { + "api_name": "SizeType", + "api_type": "" + } + ], + "code_kind": 241, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "GridContainer", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "GridContainerInterface" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "GridContainerInstance", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "GridContainerAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "GridContainerInterface", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "GridContainerInterface", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "GridContainerOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "GridContainerOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "GridContainerAttribute", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "GridContainerAttribute", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "index", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "prompt.ShowDialogSuccessResponse", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ParamsInterface", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string]: Object;\n}" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/matrix2d.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "rotate", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Matrix2D", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "rx", + "type": "number", + "is_optional": true, + "has_default": false + }, + { + "name": "ry", + "type": "number", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "Matrix2D" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/matrix2d.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "multiply", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Matrix2D", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "other", + "type": "Matrix2D", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "Matrix2D" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/list.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onScroll", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ListAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "(scrollOffset: number)", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "ListAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/xcomponent.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "XComponentAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "XComponentInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "{ id: string; type: string; libraryname: string; controller: XComponentController }", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "XComponentAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/enums.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "COMPONENT", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "XComponentType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "1" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/arkui/XComponentNode.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "changeRenderType", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "XComponentNode", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "type", + "type": "NodeRenderType", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "boolean" + }, + "import_path": [ + "@ohos.arkui.node", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/arkui/XComponentNode.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onDestroy", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "XComponentNode", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.arkui.node", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/arkui/XComponentNode.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onCreate", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "XComponentNode", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "Object", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.arkui.node", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/arkui/XComponentNode.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "constructor", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "XComponentNode", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "uiContext", + "type": "UIContext", + "is_optional": false, + "has_default": false + }, + { + "name": "options", + "type": "RenderOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "id", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "type", + "type": "XComponentType", + "is_optional": false, + "has_default": false + }, + { + "name": "libraryName", + "type": "string", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "string)" + }, + "import_path": [ + "@ohos.arkui.node", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/arkui/XComponentNode.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "XComponentNode", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "XComponentNode", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@ohos.arkui.node", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "GetShared", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "LocalStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "LocalStorage" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/enums.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "CROSS_DEVICE", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "CopyOptions", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "3" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "BackRouterOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "BackRouterOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "SetAndLink", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "defaultValue", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "SubscribedAbstractProperty" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Link", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/ability_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AbilityComponentInterface", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "AbilityComponentInterface", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/ability_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AbilityComponent", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "AbilityComponentInterface" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.app.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "requestFullWindow", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "App", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RequestFullWindowOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.app", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "enableAlertBeforeBackPage", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "EnableAlertBeforeBackPageOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "SM", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "SizeType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "2" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showDialog", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "prompt", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ShowDialogOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/list.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onItemDelete", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ListAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "(index: number)", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "ListAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/enums.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Baseline", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "Edge", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "3" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "sizeType", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "GridContainerOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "SizeType" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "DeleteProp", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PersistentStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/menu.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "fontSize", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "MenuAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Length", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "MenuAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.matrix4.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "invert", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "matrix4", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "Matrix4Transit" + }, + "import_path": [ + "@ohos.matrix4", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Button", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "prompt.Button", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/bundle/elementName.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "shortName", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ElementName", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string" + }, + "import_path": [ + "elementName" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "buttons", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "prompt.ShowDialogOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "[Button, Button?, Button?]" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showActionMenu", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "prompt", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ActionMenuOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ActionMenuSuccessResponse", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "prompt.ActionMenuSuccessResponse", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showActionMenu", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "prompt", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ActionMenuOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Promise" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/ability_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AbilityComponentAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AbilityComponentInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "{want: import('../api/@ohos.app.ability.Want').default}", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AbilityComponentAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getLength", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "string" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ActionMenuOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "prompt.ActionMenuOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getParams", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "ParamsInterface" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "RouterOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "RouterOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/ability_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onConnect", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AbilityComponentAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "()", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AbilityComponentAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "cancel", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DisableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "errMsg", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "(errMsg: string) => void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "enableAlertBeforeBackPage", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "EnableAlertOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Set", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "newValue", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "params", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "BackRouterOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "Object" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.curves.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "steps", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "curves", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "count", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "end", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "string" + }, + "import_path": [ + "@ohos.curves", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/gridItem.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "forceRebuild", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "GridItemAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "GridItemAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Keys", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "IterableIterator" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "bottom", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ShowToastOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string | number" + }, + "import_path": [ + "@system.prompt" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "staticClear", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "LG", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "SizeType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "4" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Has", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.matrix4.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "scale", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "matrix4", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ScaleOption", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Matrix4Transit" + }, + "import_path": [ + "@ohos.matrix4", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showDialog", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "prompt", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ShowDialogOptions", + "is_optional": false, + "has_default": false + }, + { + "name": "callback", + "type": "AsyncCallback", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "duration", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ShowToastOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "number" + }, + "import_path": [ + "@system.prompt" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.matrix4.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "transformPoint", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "matrix4", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "[number, number]", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "[number, number]" + }, + "import_path": [ + "@ohos.matrix4", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "message", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ShowToastOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "@system.prompt" + ], + "is_global": false + }, + { + "file_path": "api/bundle/elementName.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "uri", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ElementName", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string" + }, + "import_path": [ + "elementName" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ShowDialogOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "ShowDialogOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "message", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ShowToastOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "createAnimator", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Animator", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "AnimatorOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorResult" + }, + "import_path": [ + "@ohos.animator", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "SetAndProp", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "defaultValue", + "type": "S", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "SubscribedAbstractProperty" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/progress.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "style", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ProgressOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "ProgressStyle" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "index", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ActionMenuSuccessResponse", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "SetOrCreate", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "newValue", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getState", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "RouterState" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "columns", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "GridContainerOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "number | \"auto\"" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "cancel", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "EnableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "errMsg", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "(errMsg: string) => void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "complete", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "EnableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "() => void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "buttons", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ActionMenuOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "[Button, Button?, Button?, Button?, Button?, Button?]" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "color", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "Button", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PersistProp", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PersistentStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "defaultValue", + "type": "T", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/list.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "editMode", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ListAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "ListAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replace", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "path", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RouterState", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.curves.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "spring", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "curves", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "velocity", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "mass", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "stiffness", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "damping", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "string" + }, + "import_path": [ + "@ohos.curves", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "RouterState", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "RouterState", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "MD", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "SizeType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "3" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/bundle/elementName.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "abilityName", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ElementName", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "elementName" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/ability_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AbilityComponentAttribute", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "AbilityComponentAttribute", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "params", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RouterOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "Object" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "name", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RouterState", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "title", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ShowDialogOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "prompt", + "api_type": "NamespaceDeclaration", + "parent_api": [ + { + "api_name": "prompt", + "api_type": "NamespaceDeclaration" + } + ], + "code_kind": 237, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "success", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "EnableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "errMsg", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "(errMsg: string) => void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "DisableAlertBeforeBackPageOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "DisableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Auto", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "SizeType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "0" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ShowToastOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "ShowToastOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@system.prompt" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/ability_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onDisconnect", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AbilityComponentAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "() => void", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AbilityComponentAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "push", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ShowDialogSuccessResponse", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "ShowDialogSuccessResponse", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Prop", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "back", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "BackRouterOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "update", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorResult", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "AnimatorOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.animator", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.matrix4.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "combine", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "matrix4", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "Matrix4Transit", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Matrix4Transit" + }, + "import_path": [ + "@ohos.matrix4", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/alphabet_indexer.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onSelected", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AlphabetIndexerAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "(index: number) => void", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AlphabetIndexerAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showToast", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "prompt", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ShowToastOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "disableAlertBeforeBackPage", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "disableAlertBeforeBackPage", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "DisableAlertBeforeBackPageOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "EnvProp", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Environment", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "key", + "type": "string", + "is_optional": false, + "has_default": false + }, + { + "name": "value", + "type": "S", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "IsMutable", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "XS", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "SizeType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "1" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "EnableAlertBeforeBackPageOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "EnableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "complete", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DisableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "() => void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "duration", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ShowToastOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "number" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Get", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "T | undefined" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Keys", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PersistentStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "Array" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "index", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RouterState", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "number" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "text", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "prompt.Button", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/ability_component.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AbilityComponentInstance", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "AbilityComponentAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.matrix4.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "rotate", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "matrix4", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RotateOption", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Matrix4Transit" + }, + "import_path": [ + "@ohos.matrix4", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "success", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "DisableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "errMsg", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "(errMsg: string) => void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "margin", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "GridContainerOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "number | string" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "GridContainerAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "GridContainerInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "GridContainerOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "GridContainerAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PersistProps", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PersistentStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "properties", + "type": "{\n key: string;\n defaultValue: any;\n }[]", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "bottom", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ShowToastOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string | number" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Keys", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Environment", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "Array" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.matrix4.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "copy", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "matrix4", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "Matrix4Transit" + }, + "import_path": [ + "@ohos.matrix4", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "title", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "prompt.ActionMenuOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/grid_container.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "gutter", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "GridContainerOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "number | string" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/bundle/elementName.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "deviceId", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ElementName", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string" + }, + "import_path": [ + "elementName" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "EnvProps", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Environment", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "props", + "type": "{\n key: string;\n defaultValue: any;\n }[]", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Clear", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "replace", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "clear", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "Router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "void" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "uri", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "BackRouterOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/rect.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "RectInStance", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "RectAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.curves.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "init", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "curves", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "curve", + "type": "Curve", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "string" + }, + "import_path": [ + "@ohos.curves", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.app.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "screenOnVisible", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "App", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "ScreenOnVisibleOptions", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.app", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Delete", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "propName", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "boolean" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/common_ts_ets_api.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Size", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AppStorage", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "number" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/bundle/elementName.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "bundleName", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ElementName", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "elementName" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "message", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "ShowDialogOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "string" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.matrix4.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "translate", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "matrix4", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "TranslateOption", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "Matrix4Transit" + }, + "import_path": [ + "@ohos.matrix4", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ShowToastOptions", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "prompt.ShowToastOptions", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@ohos.prompt", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "push", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "router", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "options", + "type": "RouterOptions", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@ohos.router", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Router", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "Router", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "uri", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RouterOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/@system.router.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "message", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "EnableAlertBeforeBackPageOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "string" + }, + "import_path": [ + "@system.router" + ], + "is_global": false + }, + { + "file_path": "api/bundle/elementName.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ElementName", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "ElementName", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "elementName" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Mini", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "PanelMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "0" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PanelMode", + "api_type": "EnumDeclaration", + "parent_api": [ + { + "api_name": "PanelMode", + "api_type": "" + } + ], + "code_kind": 241, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Half", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "PanelMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "1" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Full", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "PanelMode", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "2" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/inspector.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getInspectorNodes", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "object" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@ohos.animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onrepeat", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorResult", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "() => void" + }, + "import_path": [ + "@ohos.animator", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "oncancel", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorResult", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "() => void" + }, + "import_path": [ + "@ohos.animator", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onfinish", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorResult", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "() => void" + }, + "import_path": [ + "@ohos.animator", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@ohos.animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onframe", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorResult", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "progress", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "(progress: number) => void" + }, + "import_path": [ + "@ohos.animator", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/grid.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onScroll", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "GridAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "(scrollOffset: number)", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "GridAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onChange", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "(width: number)", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PanelInstance", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Panel", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "PanelInterface" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onHeightChange", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "callback", + "type": "(value: number)", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showCloseIcon", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "backgroundMask", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "color", + "type": "ResourceColor", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "show", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "miniHeight", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number | string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "halfHeight", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number | string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "fullHeight", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number | string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "customHeight", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Dimension | PanelHeight", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "dragBar", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "type", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "PanelType", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "mode", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "PanelMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PanelAttribute", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "PanelAttribute", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PanelAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "PanelInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "show", + "type": "boolean", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "PanelAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PanelInterface", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "PanelInterface", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "WRAP_CONTENT", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "PanelHeight", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "0" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PanelHeight", + "api_type": "EnumDeclaration", + "parent_api": [ + { + "api_name": "PanelHeight", + "api_type": "" + } + ], + "code_kind": 241, + "api_optional": false + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "CUSTOM", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "PanelType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "3" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Temporary", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "PanelType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "2" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Foldable", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "PanelType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "1" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Minibar", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "PanelType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "0" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/panel.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "PanelType", + "api_type": "EnumDeclaration", + "parent_api": [ + { + "api_name": "PanelType", + "api_type": "" + } + ], + "code_kind": 241, + "api_optional": false + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/refresh.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "friction", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "RefreshOptions", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": true, + "method_return_type": "number | string" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/common/full/global.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "createLocalParticleAbility", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/common/lite/global.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "createLocalParticleAbility", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "name", + "type": "string", + "is_optional": true, + "has_default": false + } + ], + "method_return_type": "any" + }, + "import_path": [ + "global" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/inspector.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "getInspectorNodeById", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "id", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "object" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AnimatorAttribute", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "string", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AnimatorAttribute", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "playMode", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "PlayMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AnimatorInterface", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "duration", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "motion", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "SpringMotion | FrictionMotion | ScrollMotion", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "delay", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onRepeat", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "()", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "state", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "AnimationStatus", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "iterations", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onPause", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "()", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onStart\n\n", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "()", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "curve\n", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorInterface", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "Curve", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "Animator", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "AnimatorInterface" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "AnimatorInstance", + "api_type": "PropertySignature", + "parent_api": [ + { + "api_name": "unnamed", + "api_type": "" + } + ], + "code_kind": 156, + "api_optional": false, + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onFinish", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "() => void", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onCancel", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "()", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "fillMode", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "FillMode", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "onFrame", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "AnimatorAttribute", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "event", + "type": "(value: number)", + "is_optional": false, + "has_default": true + } + ], + "method_return_type": "AnimatorAttribute" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "constructor", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ScrollMotion", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "position", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "velocity", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "min", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "max", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "prop", + "type": "SpringProp", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "SpringProp)" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "constructor", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "SpringMotion", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "start", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "end", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "velocity", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "prop", + "type": "SpringProp", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "SpringProp)" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "SpringProp", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "SpringProp", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "constructor", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "FrictionMotion", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "friction", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "position", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "velocity", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number)" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts\n", + "api_info": { + "line": 1, + "problem": "", + "api_name": "FrictionMotion", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "FrictionMotion", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "SpringMotion", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "ScrollMotion", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "ScrollMotion", + "api_type": "ClassDeclaration", + "parent_api": [ + { + "api_name": "ScrollMotion", + "api_type": "ClassDeclaration" + } + ], + "code_kind": 239, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@internal/component/ets/animator.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "constructor", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "SpringProp", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "mass", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "stiffness", + "type": "number", + "is_optional": false, + "has_default": false + }, + { + "name": "damping", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "number)" + }, + "import_path": [], + "is_global": true + }, + { + "file_path": "api/@system.prompt.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "showToast", + "api_type": "InterfaceDeclaration", + "parent_api": [ + { + "api_name": "Prompt", + "api_type": "" + } + ], + "code_kind": 240, + "api_optional": false, + "method_return_type": "" + }, + "import_path": [ + "@system.prompt" + ], + "is_global": false + }, + { + "file_path": "api/@system.app.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "setImageRawDataCacheSize", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "App", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.app", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.app.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "setImageCacheCount", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "App", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.app", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@system.app.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "setImageFileCacheSize", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "App", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [ + { + "name": "value", + "type": "number", + "is_optional": false, + "has_default": false + } + ], + "method_return_type": "void" + }, + "import_path": [ + "@system.app", + "@kit.ArkUI" + ], + "is_global": false + }, + { + "file_path": "api/@internal/component/ets/enums.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "NODE", + "api_type": "EnumMember", + "parent_api": [ + { + "api_name": "XComponentType", + "api_type": "" + } + ], + "code_kind": 242, + "api_optional": false, + "method_return_type": "3" + }, + "import_path": [], + "is_global": true + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/src/lib/utils/TsUtils.ts b/ets2panda/linter/src/lib/utils/TsUtils.ts index 5b3fabffbfeda693204a55ee9dc1752f58b742e1..917c7e605de2eab2cadb008c34ffde4cbf51f343 100644 --- a/ets2panda/linter/src/lib/utils/TsUtils.ts +++ b/ets2panda/linter/src/lib/utils/TsUtils.ts @@ -1361,13 +1361,18 @@ export class TsUtils { parentSymbolCache = new Map(); - getParentSymbolName(symbol: ts.Symbol): string | undefined { + getParentSymbolName(symbol: ts.Symbol | undefined): string | undefined { + if (!symbol) { + return undefined; + } const cached = this.parentSymbolCache.get(symbol); if (cached) { return cached; } - const name = this.tsTypeChecker.getFullyQualifiedName(symbol); + const fullName = this.tsTypeChecker.getFullyQualifiedName(symbol); + const match = fullName.match(/['"](.*)['"]\.(.*)/); + const name = match ? match[2] : fullName; const dotPosition = name.lastIndexOf('.'); const result = dotPosition === -1 ? undefined : name.substring(0, dotPosition); this.parentSymbolCache.set(symbol, result); diff --git a/ets2panda/linter/src/lib/utils/consts/AsyncLifecycleSDK.ts b/ets2panda/linter/src/lib/utils/consts/AsyncLifecycleSDK.ts index b589d85b4fee72146258cba77e3403245fa0355e..64ef7604190a31f48916e6272ee8a9778a70fbcb 100644 --- a/ets2panda/linter/src/lib/utils/consts/AsyncLifecycleSDK.ts +++ b/ets2panda/linter/src/lib/utils/consts/AsyncLifecycleSDK.ts @@ -29,3 +29,5 @@ export const ASYNC_LIFECYCLE_SDK_LIST = new Set([ 'AutoFillExtensionAbility', 'ServiceExtensionAbility' ]); + +export const ABILITY_LIFECYCLE_SDK = 'ApplicationContext'; diff --git a/ets2panda/linter/src/lib/utils/consts/DeprecateWhiteList.ts b/ets2panda/linter/src/lib/utils/consts/DeprecateWhiteList.ts new file mode 100644 index 0000000000000000000000000000000000000000..0cdf0e2aba745f88fd8d53e26ef0bca335c0141e --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/DeprecateWhiteList.ts @@ -0,0 +1,27 @@ +/* + * 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. + */ + +export enum DeprecateProblem { + NoDeprecatedApi = 'NoDeprecatedApi' +} + +export enum DEPRECATE_CHECK_KEY { + PARENT_NAME = 'parentName', + PARAM_SET = 'parameters', + RETURN_TYPE = 'returnType', + FILE_NAME = 'fileName' +} + +export const DEPRECATE_UNNAMED = 'unnamed'; diff --git a/ets2panda/linter/src/lib/utils/consts/DeprecatedApi.ts b/ets2panda/linter/src/lib/utils/consts/DeprecatedApi.ts new file mode 100644 index 0000000000000000000000000000000000000000..fc29b7df097199267fe022f3c6eff8ce51b8c7ff --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/DeprecatedApi.ts @@ -0,0 +1,66 @@ +/* + * 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. + */ + +export const propertyAccessReplacements = new Map([ + ['TextPickerDialog.show', 'showTextPickerDialog'], + ['DatePickerDialog.show', 'showDatePickerDialog'], + ['ActionSheet.show', 'showActionSheet'], + ['AlertDialog.show', 'showAlertDialog'], + ['componentSnapshot.createFromBuilder', 'getComponentSnapshot().createFromBuilder'], + ['componentSnapshot.get', 'getComponentSnapshot().get'], + ['MeasureText.measureTextSize', 'createMeasureText.measureTextSize'], + ['MeasureText.measureText', 'createMeasureText.measureText'], + ['dragController.getDragPreview', 'createDragController.getDragPreview'], + ['dragController.createDragAction', 'createDragController.createDragAction'], + ['dragController.executeDrag', 'createDragController.executeDrag'], + ['LocalStorage.getShared', 'getSharedLocalStorage'], + ['inspector.createComponentObserver', 'createInspector.createComponentObserver'], + ['Animator.create', 'createAnimator'], + ['mediaquery.matchMediaSync', 'createMediaQuery.matchMediaSync'], + ['componentUtils.getRectangleById', 'getComponentUtils().getRectangleById'], + ['promptAction.showToast', 'getPromptAction.showToast'], + ['promptAction.showDialog', 'getPromptAction.showDialog'], + ['promptAction.openCustomDialog', 'getPromptAction.openCustomDialog'], + ['promptAction.closeCustomDialog', 'getPromptAction.closeCustomDialog'], + ['promptAction.showActionMenu', 'getPromptAction.showActionMenu'], + ['TimePickerDialog.show', 'showTimePickerDialog'], + ['router.pushUrl', 'getRouter.pushUrl'], + ['router.replaceUrl', 'getRouter.replaceUrl'], + ['router.back', 'getRouter.back'], + ['router.clear', 'getRouter.clear'], + ['router.getLength', 'getRouter.getLength'], + ['router.getState', 'getRouter.getState'], + ['router.getStateByIndex', 'getRouter.getStateByIndex'], + ['router.getStateByUrl', 'getRouter.getStateByUrl'], + ['router.showAlertBeforeBackPage', 'getRouter.showAlertBeforeBackPage'], + ['router.hideAlertBeforeBackPage', 'getRouter.hideAlertBeforeBackPage'], + ['router.getParams', 'getRouter.getParams'], + ['router.pushNamedRoute', 'getRouter.pushNamedRoute'], + ['router.replaceNamedRoute', 'getRouter.replaceNamedRoute'], + ['font.registerFont', 'createFont.registerFont'], + ['font.getSystemFontList', 'createFont.getSystemFontList'], + ['font.getFontByName', 'createFont.getFontByName'] +]); + +export const identifierReplacements = new Map([ + ['px2lpx', 'px2lpx'], + ['lpx2px', 'lpx2px'], + ['px2fp', 'px2fp'], + ['fp2px', 'fp2px'], + ['px2vp', 'px2vp'], + ['vp2px', 'vp2px'], + ['getContext', 'getHostContext'], + ['animateTo', 'animateTo'] +]); diff --git a/ets2panda/linter/src/lib/utils/consts/LimitedStandardUtilityTypes.ts b/ets2panda/linter/src/lib/utils/consts/LimitedStandardUtilityTypes.ts index 04f651d08023de840edbffdca60cdda456b7a534..fe772501207fdd19343441d3dd08b248eb152a5f 100644 --- a/ets2panda/linter/src/lib/utils/consts/LimitedStandardUtilityTypes.ts +++ b/ets2panda/linter/src/lib/utils/consts/LimitedStandardUtilityTypes.ts @@ -32,3 +32,24 @@ export const LIMITED_STANDARD_UTILITY_TYPES = [ 'Pick', 'Awaited' ]; + +export const LIMITED_STANDARD_UTILITY_TYPES2 = [ + 'Uncapitalize', + 'Capitalize', + 'Lowercase', + 'Uppercase', + 'ThisType', + 'OmitThisParameter', + 'ThisParameterType', + 'InstanceType', + 'ReturnType', + 'ConstructorParameters', + 'Parameters', + 'NonNullable', + 'Extract', + 'Exclude', + 'Omit', + 'Pick', + 'Awaited', + 'NoInfer' +]; diff --git a/ets2panda/linter/test/deprecatedapi/Back.ets b/ets2panda/linter/test/deprecatedapi/Back.ets new file mode 100755 index 0000000000000000000000000000000000000000..9f52ca72486548b68cc1538a40cdd998d6cb1e6b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Back.ets @@ -0,0 +1,33 @@ +/* + * 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. + */ +import { NavigationType } from './sdk/api/navigator' + +@Entry +@Component +struct Index { + build() { + Column() { + Navigator() { + Text('Back') + .fontSize(20) + } + .target('pages/NewPage') + .type(NavigationType.Back) + } + .width('100%') + .height('100%') + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Back.ets.args.json b/ets2panda/linter/test/deprecatedapi/Back.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Back.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Back.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/Back.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..953309bf5169e6ad6b14c20ac3c2c1908eb1c06c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Back.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "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": 24, + "column": 21, + "endLine": 24, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 7, + "endLine": 22, + "endColumn": 16, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Navigator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 9, + "endLine": 23, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 21, + "endLine": 31, + "endColumn": 30, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Back.ets.json b/ets2panda/linter/test/deprecatedapi/Back.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Back.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Baseline.ets b/ets2panda/linter/test/deprecatedapi/Baseline.ets new file mode 100755 index 0000000000000000000000000000000000000000..8890bc6380cf7b18a961f26f2ebfef1280c9e0c9 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Baseline.ets @@ -0,0 +1,45 @@ +/* + * 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. + */ +import { Edge } from './sdk/api/enums'; + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller(); + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item: number) => { + Text(item.toString()) + .width('90%') + .height(150) + .backgroundColor(0xFFFFFF) + .borderRadius(15) + .fontSize(16) + .textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, (item: string) => item) + }.width('100%') + } + .onScrollStop(() => { + const side1 = Edge.Baseline; + console.info('Scroll Stop'); + }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Baseline.ets.args.json b/ets2panda/linter/test/deprecatedapi/Baseline.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Baseline.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Baseline.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/Baseline.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..650f2fd5a3ed574766f993b337bc1be8df51b3ac --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Baseline.ets.arkts2.json @@ -0,0 +1,288 @@ +{ + "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": 20, + "column": 28, + "endLine": 20, + "endColumn": 36, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 28, + "endLine": 21, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 31, + "endLine": 21, + "endColumn": 32, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 34, + "endLine": 21, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 37, + "endLine": 21, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 40, + "endLine": 21, + "endColumn": 41, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 43, + "endLine": 21, + "endColumn": 44, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 46, + "endLine": 21, + "endColumn": 47, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 49, + "endLine": 21, + "endColumn": 50, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 52, + "endLine": 21, + "endColumn": 53, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 55, + "endLine": 21, + "endColumn": 56, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 23, + "endLine": 30, + "endColumn": 26, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 29, + "endLine": 32, + "endColumn": 31, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 25, + "endLine": 33, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 30, + "endLine": 35, + "endColumn": 32, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 15, + "endLine": 40, + "endColumn": 36, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 13, + "endLine": 20, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroller\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 28, + "endLine": 20, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroller\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 5, + "endLine": 24, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Stack\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 27, + "endLine": 24, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Alignment\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 7, + "endLine": 25, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroll\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 9, + "endLine": 26, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 11, + "endLine": 27, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 13, + "endLine": 28, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 26, + "endLine": 34, + "endColumn": 35, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Baseline.ets.json b/ets2panda/linter/test/deprecatedapi/Baseline.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..a8df15b58dcdfae228f6576c7342da649e364ff0 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Baseline.ets.json @@ -0,0 +1,28 @@ +{ + "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": 40, + "column": 15, + "endLine": 40, + "endColumn": 36, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/COMPONENT.ets b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets new file mode 100755 index 0000000000000000000000000000000000000000..04819456ce65d079caf6bdb63471e3ab80fb70b4 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets @@ -0,0 +1,42 @@ +/* + * 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. + */ +import { XComponentType } from './sdk/api/enums'; + +@Entry +@Component +struct Index { + @State isLock: boolean = true; + @State xc_width: number = 500; + @State xc_height: number = 700; + myXComponentController: XComponentController = new MyXComponentController(); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { + XComponent({ + id: "XComponent", + type: XComponentType.COMPONENT, + controller: this.myXComponentController + }) + .onLoad(() => { + let surfaceRotation: SurfaceRotationOptions = { lock: this.isLock }; + this.myXComponentController.setXComponentSurfaceRotation(surfaceRotation); + console.log("getXComponentSurfaceRotation lock = " + + this.myXComponentController.getXComponentSurfaceRotation().lock); + }) + .width(this.xc_width) + .height(this.xc_height) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.args.json b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..a9c568265546411206e4dfae773a694d86bd76e3 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.arkts2.json @@ -0,0 +1,188 @@ +{ + "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": 21, + "column": 29, + "endLine": 21, + "endColumn": 32, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 30, + "endLine": 22, + "endColumn": 33, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 54, + "endLine": 23, + "endColumn": 76, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 30, + "endLine": 29, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 4, + "endLine": 21, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 4, + "endLine": 22, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 27, + "endLine": 23, + "endColumn": 47, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"XComponentController\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 5, + "endLine": 26, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Flex\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 23, + "endLine": 26, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexDirection\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 37, + "endLine": 26, + "endColumn": 43, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 57, + "endLine": 26, + "endColumn": 66, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ItemAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 91, + "endLine": 26, + "endColumn": 100, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 7, + "endLine": 27, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"XComponent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 32, + "endLine": 33, + "endColumn": 54, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SurfaceRotationOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.json b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets b/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets new file mode 100755 index 0000000000000000000000000000000000000000..24c939c273c158b902a870cd139a590c06ba19fd --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets @@ -0,0 +1,32 @@ +/* + * 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. + */ +import { CopyOptions } from './sdk/api/enums'; + +@Component +struct child { + @Link customPopup: boolean + build() { + Column({ space: 10 }) { + Text('CROSS_DEVICE') + .copyOption(CopyOptions.CROSS_DEVICE) + .borderWidth(1) + .gesture(LongPressGesture({ repeat: true }) + .onActionEnd((event: GestureEvent) => { + this.customPopup = !this.customPopup + }) + ) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.args.json b/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..04f3aa0ea098609e6898b02581a2f186ed37ccf0 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 21, + "column": 21, + "endLine": 21, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 22, + "endLine": 24, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 4, + "endLine": 19, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Link\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 7, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 18, + "endLine": 25, + "endColumn": 34, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"LongPressGesture\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 32, + "endLine": 26, + "endColumn": 44, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"GestureEvent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.json b/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/CROSS_DEVICE.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/DeleteProp.ets b/ets2panda/linter/test/deprecatedapi/DeleteProp.ets new file mode 100755 index 0000000000000000000000000000000000000000..b5530beaf728f7870fffc6551318609e1a584d24 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/DeleteProp.ets @@ -0,0 +1,17 @@ +/* + * 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. + */ +import { PersistentStorage } from './sdk/api/common_ts_ets_api'; + +PersistentStorage.DeleteProp('data1') \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.args.json b/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.arkts2.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.json b/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/DeleteProp.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..20a4233eb7cd7f491bf2b9b1f335c204fbbe3f5c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets @@ -0,0 +1,30 @@ +/* + * 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. + */ +import router from './sdk/api/@system.router'; + +class L{ + enableAlertBeforeBackPage() { + router.enableAlertBeforeBackPage({ + message: 'Message Info', + success: ()=> { + console.log('success'); + }, + cancel: ()=> { + console.log('cancel'); + } + }); + } +} +export default new L() \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ad1e3864f573f4b56f2a05dbed170ca5c1ce596b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.arkts2.json @@ -0,0 +1,28 @@ +{ + "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": 19, + "column": 12, + "endLine": 19, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.json b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Link.ets b/ets2panda/linter/test/deprecatedapi/Link.ets new file mode 100755 index 0000000000000000000000000000000000000000..9f9a1cbd126972e8bea6af5b01d3ef1a17a57432 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Link.ets @@ -0,0 +1,18 @@ +/* + * 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. + */ +import { AppStorage } from './sdk/api/common_ts_ets_api'; + +AppStorage.setOrCreate('PropA', 47); +let link1: SubscribedAbstractProperty = AppStorage.Link('PropA'); \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Link.ets.args.json b/ets2panda/linter/test/deprecatedapi/Link.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Link.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Link.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/Link.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..b0b238ec95a62d4a0f8d19a87ed0962353affc6d --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Link.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "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": 33, + "endLine": 17, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 12, + "endLine": 18, + "endColumn": 38, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SubscribedAbstractProperty\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Link.ets.json b/ets2panda/linter/test/deprecatedapi/Link.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Link.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/NavigationType.ets b/ets2panda/linter/test/deprecatedapi/NavigationType.ets new file mode 100755 index 0000000000000000000000000000000000000000..8c497641465f3e2c0a335541fc21fd7f7e2601f2 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/NavigationType.ets @@ -0,0 +1,47 @@ +/* + * 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. + */ +import { NavigationType } from './sdk/api/navigator' + +@Entry +@Component +struct Index { + build() { + Column() { + Navigator() { + Text('Replace') + .fontSize(20) + } + .target('pages/NewPage') + .type(NavigationType.Replace) + + Navigator() { + Text('Back') + .fontSize(20) + } + .target('pages/NewPage') + .type(NavigationType.Back) + + Navigator() { + Text('Push') + .fontSize(20) + } + .target('pages/NewPage') + .type(NavigationType.Push) + } + .width('100%') + .height('100%') + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/NavigationType.ets.args.json b/ets2panda/linter/test/deprecatedapi/NavigationType.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/NavigationType.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/NavigationType.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/NavigationType.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..2300ab1d15da4194629a39513b17e1ae81d1f554 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/NavigationType.ets.arkts2.json @@ -0,0 +1,148 @@ +{ + "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": 24, + "column": 21, + "endLine": 24, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 21, + "endLine": 31, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 21, + "endLine": 38, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 7, + "endLine": 22, + "endColumn": 16, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Navigator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 9, + "endLine": 23, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 7, + "endLine": 29, + "endColumn": 16, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Navigator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 9, + "endLine": 30, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 7, + "endLine": 36, + "endColumn": 16, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Navigator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 9, + "endLine": 37, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 21, + "endLine": 45, + "endColumn": 30, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/NavigationType.ets.json b/ets2panda/linter/test/deprecatedapi/NavigationType.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/NavigationType.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Push.ets b/ets2panda/linter/test/deprecatedapi/Push.ets new file mode 100755 index 0000000000000000000000000000000000000000..a357e4445ba5d249538943287e3f0469d8487de7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Push.ets @@ -0,0 +1,33 @@ +/* + * 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. + */ +import { NavigationType } from './sdk/api/navigator' + +@Entry +@Component +struct Index { + build() { + Column() { + Navigator() { + Text('Push') + .fontSize(20) + } + .target('pages/NewPage') + .type(NavigationType.Push) + } + .width('100%') + .height('100%') + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Push.ets.args.json b/ets2panda/linter/test/deprecatedapi/Push.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Push.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Push.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/Push.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..953309bf5169e6ad6b14c20ac3c2c1908eb1c06c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Push.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "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": 24, + "column": 21, + "endLine": 24, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 7, + "endLine": 22, + "endColumn": 16, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Navigator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 9, + "endLine": 23, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 21, + "endLine": 31, + "endColumn": 30, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Push.ets.json b/ets2panda/linter/test/deprecatedapi/Push.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Push.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Replace.ets b/ets2panda/linter/test/deprecatedapi/Replace.ets new file mode 100755 index 0000000000000000000000000000000000000000..c6ce7e7b51f477daabfe098c838ca3023c7c392b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Replace.ets @@ -0,0 +1,34 @@ +/* + * 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. + */ + +import { NavigationType } from './sdk/api/navigator' + +@Entry +@Component +struct Index { + build() { + Column() { + Navigator() { + Text('Replace') + .fontSize(20) + } + .target('pages/NewPage') + .type(NavigationType.Replace) + } + .width('100%') + .height('100%') + .justifyContent(FlexAlign.Center) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Replace.ets.args.json b/ets2panda/linter/test/deprecatedapi/Replace.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Replace.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Replace.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/Replace.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..bab7d6fb70a529ad701e4e16c0660102bd3bb5b7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Replace.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "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": 25, + "column": 21, + "endLine": 25, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 16, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Navigator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 9, + "endLine": 24, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 21, + "endLine": 32, + "endColumn": 30, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/Replace.ets.json b/ets2panda/linter/test/deprecatedapi/Replace.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/Replace.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SM.ets b/ets2panda/linter/test/deprecatedapi/SM.ets new file mode 100755 index 0000000000000000000000000000000000000000..22de541ee10f5e8cba362bf35afc4716630c77f3 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SM.ets @@ -0,0 +1,29 @@ +/* + * 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. + */ +import { SizeType } from './sdk/api/grid_container' + +@Entry +@Component +struct GridContainerExample { + @State sizeType: SizeType = SizeType.XS + + build() { + Column({ space: 5 }) { + Row() { + Button('SM').onClick(() => { this.sizeType = SizeType.SM }) + } + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SM.ets.args.json b/ets2panda/linter/test/deprecatedapi/SM.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SM.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SM.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/SM.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..a381e90b98512a535a240680a4059c168153952a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SM.ets.arkts2.json @@ -0,0 +1,128 @@ +{ + "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": 20, + "column": 31, + "endLine": 20, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 40, + "endLine": 20, + "endColumn": 42, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 21, + "endLine": 23, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 54, + "endLine": 25, + "endColumn": 62, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 63, + "endLine": 25, + "endColumn": 65, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 9, + "endLine": 25, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SM.ets.json b/ets2panda/linter/test/deprecatedapi/SM.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SM.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SetAndLink.ets b/ets2panda/linter/test/deprecatedapi/SetAndLink.ets new file mode 100755 index 0000000000000000000000000000000000000000..ebd4cd5e167d7897e9c515cf87f073f5cc9208b4 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SetAndLink.ets @@ -0,0 +1,18 @@ +/* + * 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. + */ +import { AppStorage } from './sdk/api/common_ts_ets_api'; + +AppStorage.setOrCreate('PropA', 47); +let link1: SubscribedAbstractProperty = AppStorage.SetAndLink('PropB', 49); \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.args.json b/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..7bebb6545e227eecf4d1d11d09070f6ed11046f5 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.arkts2.json @@ -0,0 +1,48 @@ +{ + "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": 33, + "endLine": 17, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 80, + "endLine": 18, + "endColumn": 82, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 12, + "endLine": 18, + "endColumn": 38, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SubscribedAbstractProperty\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.json b/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SetAndLink.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SizeType.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/SizeType.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..b0bd84bb5e8299499e1d08466994c432fe8cbfb6 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SizeType.ets.arkts2.json @@ -0,0 +1,198 @@ +{ + "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": 20, + "column": 31, + "endLine": 20, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 21, + "endLine": 23, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 66, + "endLine": 24, + "endColumn": 67, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 29, + "endLine": 28, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 29, + "endLine": 32, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 29, + "endLine": 36, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 29, + "endLine": 40, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 35, + "endLine": 43, + "endColumn": 36, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 7, + "endLine": 25, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 9, + "endLine": 26, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 9, + "endLine": 30, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 9, + "endLine": 34, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 9, + "endLine": 38, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SizeType.ets.json b/ets2panda/linter/test/deprecatedapi/SizeType.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/SizeType.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/UIContext.ets b/ets2panda/linter/test/deprecatedapi/UIContext.ets new file mode 100644 index 0000000000000000000000000000000000000000..66787ce456766cb84a27199d83383127d5e55846 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/UIContext.ets @@ -0,0 +1,39 @@ +/* + * 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. + */ + +import { promptAction } from '@kit.ArkUI'; + +try { + promptAction.showActionMenu({ //error + title: 'Title Info', + buttons: [ + { + text: 'item1', + color: '#666666' + }, + { + text: 'item2', + color: '#000000' + }, + ] + }, (err, data) => { + if (err) { + console.info('showActionMenu err: ' + err); + return; + } + console.info('showActionMenu success callback, click button: ' + data.index); + }) +} catch (error) { +}; \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/UIContext.ets.json b/ets2panda/linter/test/deprecatedapi/UIContext.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..f4da0d367fdfbd6f4e505b708458717c452dfaec --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/UIContext.ets.json @@ -0,0 +1,38 @@ +{ + "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": 31, + "column": 7, + "endLine": 31, + "endColumn": 10, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 12, + "endLine": 31, + "endColumn": 16, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ability_component.ets b/ets2panda/linter/test/deprecatedapi/ability_component.ets new file mode 100755 index 0000000000000000000000000000000000000000..ecc3810d1d6bbc601cc76255b9bfce5e63c2e873 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ability_component.ets @@ -0,0 +1,36 @@ +/* + * 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. + */ + +@Entry +@Component +struct MyComponent { + + build() { + Column() { + AbilityComponent({ // error + want: { + bundleName: '', + abilityName: '' + }, + }) + .onConnect(() => { // error + console.log('AbilityComponent connect') + }) + .onDisconnect(() => { // error + console.log('AbilityComponent disconnect') + }) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ability_component.ets.args.json b/ets2panda/linter/test/deprecatedapi/ability_component.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ability_component.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/ability_component.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/ability_component.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..977dd1e5910ac382c5f52afa86e5a96aeb1207ed --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ability_component.ets.arkts2.json @@ -0,0 +1,58 @@ +{ + "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, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 7, + "endLine": 22, + "endColumn": 23, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AbilityComponent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ability_component.ets.json b/ets2panda/linter/test/deprecatedapi/ability_component.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ability_component.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/action_sheet.ets b/ets2panda/linter/test/deprecatedapi/action_sheet.ets new file mode 100644 index 0000000000000000000000000000000000000000..57437a6e3d5d6149576407570b1fa0a40490b1b2 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/action_sheet.ets @@ -0,0 +1,77 @@ +/* + * 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. + */ + +import { ActionSheet } from './sdk/api/action_sheet' + +@Entry +@Component +struct ActionSheetExample { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet') + .onClick(() => { + ActionSheet.show({ //error + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.info('Get Alert Dialog handled'); + } + }, + cancel: () => { + console.info('actionSheet canceled'); + }, + onWillDismiss: (dismissDialogAction: DismissDialogAction) => { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.info("dialog onWillDismiss"); + if (dismissDialogAction.reason === DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss(); + } + if (dismissDialogAction.reason === DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss(); + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.info('apples'); + } + }, + { + title: 'bananas', + action: () => { + console.info('bananas'); + } + }, + { + title: 'pears', + action: () => { + console.info('pears'); + } + } + ] + }) + }) + }.width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/action_sheet.ets.args.json b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..0a473b82ffb81180a3e65d250e5cac74b321d38a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json @@ -0,0 +1,168 @@ +{ + "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": 25, + "column": 23, + "endLine": 25, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 27, + "endLine": 51, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 35, + "endLine": 51, + "endColumn": 37, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Flex\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 23, + "endLine": 22, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexDirection\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 37, + "endLine": 22, + "endColumn": 43, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 57, + "endLine": 22, + "endColumn": 66, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ItemAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 91, + "endLine": 22, + "endColumn": 100, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 50, + "endLine": 40, + "endColumn": 69, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DismissDialogAction\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 50, + "endLine": 43, + "endColumn": 63, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DismissReason\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 50, + "endLine": 46, + "endColumn": 63, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DismissReason\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 24, + "endLine": 50, + "endColumn": 39, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DialogAlignment\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/action_sheet.ets.json b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/alert_dialog.ets b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..f6e0d243ff92f1138cb248463d47beacfa91bc32 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets @@ -0,0 +1,54 @@ +/* + * 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. + */ + +import { AlertDialog } from './sdk/api/alert_dialog' + +@Entry +@Component +struct AlertDialogExample { + build() { + Column({ space: 5 }) { + Button('AlertDialog Set Duration') + .onClick(() => { + AlertDialog.show( //error + { + title: 'AlertDialog 1', + message: 'Set Animation Duration open 3 second, close 100ms', + autoCancel: true, + alignment: DialogAlignment.Top, + offset: { dx: 0, dy: -20 }, + gridCount: 3, + transition: TransitionEffect.asymmetric(TransitionEffect.OPACITY + .animation({ duration: 3000, curve: Curve.Sharp }) + .combine(TransitionEffect.scale({ x: 1.5, y: 1.5 }).animation({ duration: 3000, curve: Curve.Sharp })), + TransitionEffect.OPACITY.animation({ duration: 100, curve: Curve.Smooth }) + .combine(TransitionEffect.scale({ x: 0.5, y: 0.5 }) + .animation({ duration: 100, curve: Curve.Smooth }))), + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback'); + } + }, + cancel: () => { + console.info('Closed callbacks'); + } + } + ) + }) + .backgroundColor(0x317aff).height("88px") + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.args.json b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..4d05639b3c65bd4eda00b2b9d5347bb0b43d7a5b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.arkts2.json @@ -0,0 +1,258 @@ +{ + "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": 22, + "column": 21, + "endLine": 22, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 23, + "endLine": 25, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 29, + "endLine": 31, + "endColumn": 30, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 37, + "endLine": 31, + "endColumn": 39, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 26, + "endLine": 32, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 40, + "endLine": 34, + "endColumn": 44, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 91, + "endLine": 35, + "endColumn": 95, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 64, + "endLine": 36, + "endColumn": 67, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 44, + "endLine": 38, + "endColumn": 47, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 35, + "endLine": 52, + "endColumn": 36, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 26, + "endLine": 30, + "endColumn": 41, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DialogAlignment\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 27, + "endLine": 33, + "endColumn": 43, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TransitionEffect\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 55, + "endLine": 33, + "endColumn": 71, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TransitionEffect\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 53, + "endLine": 34, + "endColumn": 58, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Curve\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 26, + "endLine": 35, + "endColumn": 42, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TransitionEffect\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 104, + "endLine": 35, + "endColumn": 109, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Curve\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 17, + "endLine": 36, + "endColumn": 33, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TransitionEffect\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 76, + "endLine": 36, + "endColumn": 81, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Curve\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 28, + "endLine": 37, + "endColumn": 44, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TransitionEffect\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 56, + "endLine": 38, + "endColumn": 61, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Curve\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.json b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets b/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets new file mode 100755 index 0000000000000000000000000000000000000000..7d19ba33f67fa6a36ebeebcdec5fd931d43e56ce --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets @@ -0,0 +1,138 @@ +/* + * 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. + */ + +@Entry +@Component +struct AlphabetIndexerSample { + private arrayA: string[] = ['安']; + private arrayB: string[] = ['卜', '白', '包', '毕', '丙']; + private arrayC: string[] = ['曹', '成', '陈', '催']; + private arrayL: string[] = ['刘', '李', '楼', '梁', '雷', '吕', '柳', '卢']; + private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', + 'O', 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z']; + @State customBlurStyle: BlurStyle = BlurStyle.NONE; + + + build() { + Stack({ alignContent: Alignment.Start }) { + Row() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arrayA, (item: string) => { + ListItem() { + Text(item) + .width('80%') + .height('5%') + .fontSize(30) + .textAlign(TextAlign.Center) + } + }, (item: string) => item) + + + ForEach(this.arrayB, (item: string) => { + ListItem() { + Text(item) + .width('80%') + .height('5%') + .fontSize(30) + .textAlign(TextAlign.Center) + } + }, (item: string) => item) + + + ForEach(this.arrayC, (item: string) => { + ListItem() { + Text(item) + .width('80%') + .height('5%') + .fontSize(30) + .textAlign(TextAlign.Center) + } + }, (item: string) => item) + + + ForEach(this.arrayL, (item: string) => { + ListItem() { + Text(item) + .width('80%') + .height('5%') + .fontSize(30) + .textAlign(TextAlign.Center) + } + }, (item: string) => item) + } + .width('30%') + .height('100%') + + + Column() { + Column() { + Text('切换模糊材质: ') + .fontSize(24) + .fontColor(0xcccccc) + .width('100%') + Button('COMPONENT_REGULAR') + .margin('5vp') + .width(200) + .onClick(() => { + this.customBlurStyle = BlurStyle.COMPONENT_REGULAR; + }) + Button('BACKGROUND_THIN') + .margin('5vp') + .width(200) + .onClick(() => { + this.customBlurStyle = BlurStyle.BACKGROUND_THIN; + }) + }.height('20%') + + + Column() { + AlphabetIndexer({ arrayValue: this.value, selected: 0 }) + .usingPopup(true) + .alignStyle(IndexerAlign.Left) + .popupItemBorderRadius(24) + .itemBorderRadius(14) + .popupBackgroundBlurStyle(this.customBlurStyle) + .popupTitleBackground(0xCCCCCC) + .onSelected((index: number) => { // error + console.info(this.value[index] + ' Selected!'); + }) + .onRequestPopupData((index: number) => { + if (this.value[index] == 'A') { + return this.arrayA; + } else if (this.value[index] == 'B') { + return this.arrayB; + } else if (this.value[index] == 'C') { + return this.arrayC; + } else if (this.value[index] == 'L') { + return this.arrayL; + } else { + return []; + } + }) + .onPopupSelect((index: number) => { + console.info('onPopupSelected:' + index); + }) + } + .height('80%') + } + .width('70%') + } + .width('100%') + .height('100%') + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.args.json b/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..d2e38450182b0b142ac12d0cf4d031db500ccc79 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.args.json @@ -0,0 +1,20 @@ + +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..0abecc7d648aaa648aa182cf20e269722e6c0629 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.arkts2.json @@ -0,0 +1,548 @@ +{ + "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": 33, + "column": 23, + "endLine": 33, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 41, + "endLine": 33, + "endColumn": 42, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 27, + "endLine": 39, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 27, + "endLine": 50, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 61, + "column": 27, + "endLine": 61, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 27, + "endLine": 72, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 84, + "column": 25, + "endLine": 84, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 89, + "column": 22, + "endLine": 89, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 95, + "column": 22, + "endLine": 95, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 103, + "column": 65, + "endLine": 103, + "endColumn": 66, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 106, + "column": 38, + "endLine": 106, + "endColumn": 40, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 107, + "column": 33, + "endLine": 107, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 111, + "column": 41, + "endLine": 111, + "endColumn": 46, + "problem": "ArrayIndexExprType", + "suggest": "", + "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", + "severity": "ERROR" + }, + { + "line": 114, + "column": 32, + "endLine": 114, + "endColumn": 37, + "problem": "ArrayIndexExprType", + "suggest": "", + "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 39, + "endLine": 116, + "endColumn": 44, + "problem": "ArrayIndexExprType", + "suggest": "", + "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", + "severity": "ERROR" + }, + { + "line": 118, + "column": 39, + "endLine": 118, + "endColumn": 44, + "problem": "ArrayIndexExprType", + "suggest": "", + "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", + "severity": "ERROR" + }, + { + "line": 120, + "column": 39, + "endLine": 120, + "endColumn": 44, + "problem": "ArrayIndexExprType", + "suggest": "", + "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", + "severity": "ERROR" + }, + { + "line": 123, + "column": 26, + "endLine": 123, + "endColumn": 28, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 4, + "endLine": 27, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 27, + "endLine": 27, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"BlurStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 39, + "endLine": 27, + "endColumn": 48, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"BlurStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 5, + "endLine": 31, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Stack\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 27, + "endLine": 31, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Alignment\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 7, + "endLine": 32, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 9, + "endLine": 33, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"List\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 11, + "endLine": 34, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 13, + "endLine": 35, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ListItem\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 15, + "endLine": 36, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 28, + "endLine": 40, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 11, + "endLine": 45, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 13, + "endLine": 46, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ListItem\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 15, + "endLine": 47, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 28, + "endLine": 51, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 11, + "endLine": 56, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 13, + "endLine": 57, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ListItem\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 15, + "endLine": 58, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 28, + "endLine": 62, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 11, + "endLine": 67, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 13, + "endLine": 68, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ListItem\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 15, + "endLine": 69, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 28, + "endLine": 73, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 9, + "endLine": 81, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 11, + "endLine": 82, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 83, + "column": 13, + "endLine": 83, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 87, + "column": 13, + "endLine": 87, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 91, + "column": 40, + "endLine": 91, + "endColumn": 49, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"BlurStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 13, + "endLine": 93, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 40, + "endLine": 97, + "endColumn": 49, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"BlurStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 102, + "column": 11, + "endLine": 102, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 103, + "column": 13, + "endLine": 103, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AlphabetIndexer\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 105, + "column": 27, + "endLine": 105, + "endColumn": 39, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"IndexerAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.json b/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/alphabet_indexer.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/animator.ets b/ets2panda/linter/test/deprecatedapi/animator.ets new file mode 100644 index 0000000000000000000000000000000000000000..8368d9d9b986ba7839752fd00e49dfecb30846be --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/animator.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ + +import { Animator as animator, AnimatorOptions } from './sdk/api/@ohos.animator'; + +let options: AnimatorOptions = { + duration: 1500, + easing: "friction", + delay: 0, + fill: "forwards", + direction: "normal", + iterations: 3, + begin: 200.0, + end: 400.0 +}; +animator.create(options); //error \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/animator.ets.args.json b/ets2panda/linter/test/deprecatedapi/animator.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/animator.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/animator.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/animator.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..acaa0c56007b96460e67da01e543ce745daa180f --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/animator.ets.arkts2.json @@ -0,0 +1,68 @@ +{ + "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": 19, + "column": 13, + "endLine": 19, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 10, + "endLine": 21, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 15, + "endLine": 24, + "endColumn": 16, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 10, + "endLine": 28, + "endColumn": 16, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 10, + "endLine": 16, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Animator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/animator.ets.json b/ets2panda/linter/test/deprecatedapi/animator.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/animator.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets b/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..1d8f620a9d0b0fe97a1d6ed4763cb98e634b3992 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets @@ -0,0 +1,33 @@ +/* + * 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. + */ +import Animator as animator, AnimatorResult from './sdk/api/@ohos.animator'; + +let AnimatorResult: AnimatorResult | undefined = animator.create(options) + +AnimatorResult.onrepeat = () => { //error + console.info("onrepeat callback") +} + +AnimatorResult.oncancel = () => { //error + console.info("oncancel callback") +} + +AnimatorResult.onfinish = () => { //error + console.info("onfinish callback") +} + +AnimatorResult.onframe = (value) => { //error + console.info("onframe callback") +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..438dabb8d35905e8f6d4fd111334d1f2eafdb706 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.arkts2.json @@ -0,0 +1,48 @@ +{ + "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": 15, + "column": 1, + "endLine": 15, + "endColumn": 20, + "problem": "ImportAssignment", + "suggest": "", + "rule": "\"require\" and \"import\" assignment are not supported (arkts-no-require)", + "severity": "ERROR" + }, + { + "line": 15, + "column": 21, + "endLine": 15, + "endColumn": 45, + "problem": "CommaOperator", + "suggest": "", + "rule": "The comma operator \",\" is supported only in \"for\" loops (arkts-no-comma-outside-loops)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 27, + "endLine": 31, + "endColumn": 32, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.json b/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..438dabb8d35905e8f6d4fd111334d1f2eafdb706 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/animatorResultOnrepeat_api.ets.json @@ -0,0 +1,48 @@ +{ + "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": 15, + "column": 1, + "endLine": 15, + "endColumn": 20, + "problem": "ImportAssignment", + "suggest": "", + "rule": "\"require\" and \"import\" assignment are not supported (arkts-no-require)", + "severity": "ERROR" + }, + { + "line": 15, + "column": 21, + "endLine": 15, + "endColumn": 45, + "problem": "CommaOperator", + "suggest": "", + "rule": "The comma operator \",\" is supported only in \"for\" loops (arkts-no-comma-outside-loops)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 27, + "endLine": 31, + "endColumn": 32, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..2e73b25e23b8270c012594790da8814435209ae4 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets @@ -0,0 +1,26 @@ +/* + * 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. + */ +import { AppStorage } from './sdk/api/common_ts_ets_api'; + +AppStorage.SetOrCreate('PropA', 47); +let res: boolean = AppStorage.IsMutable('simpleProp'); //error + +let value: number = AppStorage.Get('PropA') as number; //error + +let res: boolean = AppStorage.Clear(); //error + +let value: boolean = AppStorage.Delete('PropA') as boolean; //error + +let value: number = AppStorage.Size(); //error \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..1fc946dc8d23ece21f715f7fa7a1717a3306f382 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.arkts2.json @@ -0,0 +1,78 @@ +{ + "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": 33, + "endLine": 17, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 31, + "endLine": 18, + "endColumn": 40, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 32, + "endLine": 20, + "endColumn": 35, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 31, + "endLine": 22, + "endColumn": 36, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 33, + "endLine": 24, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 32, + "endLine": 26, + "endColumn": 36, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.json b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..7ed0caf1a2f6f232f435c3d378399b021f0bc117 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets @@ -0,0 +1,25 @@ +/* + * 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. + */ +import App from './sdk/api/@system.app'; +import { GridContainerInterface } from './sdk/api/grid_container'; + +export default class Req { + requestFullWindow() { + App.screenOnVisible({ + }); + } +} + +GridContainerInterface.GridContainerAttribute \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ab3b8aff134d2166a37a1dbd982dfa6ac5c34a80 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "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": 20, + "column": 9, + "endLine": 20, + "endColumn": 24, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 24, + "endLine": 25, + "endColumn": 46, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"GridContainerAttribute\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.json b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets b/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..0a37728e9f10164a45fd3a1f232fc03003351f47 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets @@ -0,0 +1,22 @@ +/* + * 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. + */ +import router from './sdk/api/@system.router'; + +class H{ + backToDetail() { + router.back({uri:'pages/detail/detail'}); + } +} +export default new H() \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.arkts2.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.json b/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/backRouterOptionsUri_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/buttons.ets b/ets2panda/linter/test/deprecatedapi/buttons.ets new file mode 100755 index 0000000000000000000000000000000000000000..80574cbd32e3aab0e1e00a93eb10f1fcfda551d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/buttons.ets @@ -0,0 +1,37 @@ +/* + * 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. + */ +import prompt from './sdk/api/@ohos.prompt' + + +prompt.showDialog({ + title: 'showDialog Title Info', + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000' + }, + { + text: 'button2', + color: '#000000' + } + ] +}, (err, data) => { + if (err) { + console.info('showDialog err: ' + err); + return; + } + console.info('showDialog success callback, click button: ' + data.index); +}); \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/buttons.ets.args.json b/ets2panda/linter/test/deprecatedapi/buttons.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/buttons.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/buttons.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/buttons.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..30ea0fb4ec6c620e25e414e862fa3fbc88bf1fde --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/buttons.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "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, + "column": 8, + "endLine": 18, + "endColumn": 18, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 3, + "endLine": 19, + "endColumn": 8, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 3, + "endLine": 20, + "endColumn": 10, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 7, + "endLine": 28, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 5, + "endLine": 31, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 10, + "endLine": 31, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/buttons.ets.json b/ets2panda/linter/test/deprecatedapi/buttons.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..9f3ebadfbb714381766f4118f21e74e2c7d6b08f --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/buttons.ets.json @@ -0,0 +1,38 @@ +{ + "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": 31, + "column": 5, + "endLine": 31, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 10, + "endLine": 31, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/chip_group_api.ets b/ets2panda/linter/test/deprecatedapi/chip_group_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..ee4e8bf889eb1098e1b0f60174cb2bda7737f710 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/chip_group_api.ets @@ -0,0 +1,42 @@ +/* + * 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. + */ +import {ChipGroupItemOptions} from './sdk/api/ChipGroup'; + +@Entry +struct Index { + build() { + Column() { + ChipGroup({ + items: [ + { + prefixIcon: { src: $r('app.media.icon') }, + label: { text: "操作块1" }, + .suffixIcon: { src: $r('sys.media.ohos_ic_public_cut') }, //error + allowClose: false + } + ] + }) + } + } +} +class Test implements ChipGroupItemOptions{ + suffixIcon?: IconOptions | undefined; + get(){ + return this.suffixIcon; + } + set(suffixIcon?: IconOptions | undefined){ + suffixIcon = { src: $r('sys.media.ohos_ic_public_cut') }; + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.json b/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..0c1bacf603e53b76a2d38202ed721c276cadb32b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.json @@ -0,0 +1,28 @@ +{ + "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": 36, + "column": 3, + "endLine": 36, + "endColumn": 6, + "problem": "LimitedReturnTypeInference", + "suggest": "", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common.ets b/ets2panda/linter/test/deprecatedapi/common.ets new file mode 100644 index 0000000000000000000000000000000000000000..12386489df3d9b137e4a9ad5ec6fea637093ff0b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common.ets @@ -0,0 +1,71 @@ +/* + * 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. + */ + +@Entry +@Component +struct ClipExample { + build() { + Column({ space: 15 }) { + Row() { + Image($r('app.media.testImg')) + .clip(new Circle({})) //error + + Button() + .transition({ + type: TransitionType.Insert, //error + opacity: 0, //error + translate: {x: 1}, //error + scale: {x: 1}, //error + rotate: {angle: 1} //error + }) + .onClick(() => { + let context: Context = getContext(this); //error + console.info("CacheDir:" + context.cacheDir); + }) + + Button('Touch').height(40).width(100) + .onTouch((event?: TouchEvent) => { + if (event) { + event.touches[0].screenX; //error + event.touches[0].screenY; //error + } + }) + .onClick((event?: ClickEvent) => { + if (event) { + event.screenX; //error + event.screenY; //error + } + }) + .onMouse((event: MouseEvent):void => { + if (event) { + event.screenX; //error + event.screenY; //error + } + }) + } + .borderRadius(20) + } + .width('100%') + .margin({ top: 15 }) + } +} + + +px2lpx(200); //error +lpx2px(200); //error +px2fp(200); //error +fp2px(200); //error +px2vp(200); //error +vp2px(200); //error \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common.ets.json b/ets2panda/linter/test/deprecatedapi/common.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..f24a1d0316bb093ee66951a8bdb172ca061aaa1c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common.ets.json @@ -0,0 +1,38 @@ +{ + "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": 41, + "column": 13, + "endLine": 41, + "endColumn": 29, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 13, + "endLine": 42, + "endColumn": 29, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_api.ets b/ets2panda/linter/test/deprecatedapi/common_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..142187d98c3c3307470165b08f711769c3d6b42a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_api.ets @@ -0,0 +1,139 @@ +/* + * 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. + */ +import {DragEvent,CustomPopupOptions} from './sdk/api/common'; +import {LayoutInfo,LayoutChild,LayoutBorderInfo,TransitionOptions} from './sdk/api/common'; + +function get(aa:number){ + const globalEvent : DragEvent = {} + return globalEvent.getX();//error +} +function onMeasure(selfLayoutInfo: LayoutInfo, borderInfo: Array, children: Array){//error + selfLayoutInfo as LayoutInfo;//error + typeof (borderInfo[0] as LayoutBorderInfo);//error +} + +class Test implements LayoutChild{//error + set(child:LayoutChild){//error + return child as LayoutInfo;//error + } +} +class Test2 extends Test implements LayoutBorderInfo,TransitionOptions{ //error + private layoutInfo: LayoutInfo|undefined = undefined;//error + get(option:Map){//error + option.set('',{}); + } +} + +@Entry +@Component +struct Example { + @State uri: string = ""; + @State blockArr: string[] = []; + @State handlePopup: boolean = false; + @State customPopup: boolean = false; + udKey: string = ''; + globalEvent : DragEvent = {} + + @State handlePopup: boolean = false + private scroller: Scroller = new Scroller(); + + aboutToAppear(): void { + animateTo({ // error + duration: 2000, + curve: Curve.EaseOut, + iterations: 3, + playMode: PlayMode.Normal, + onFinish: () => { + console.info('play end'); + } + }, () => { + }); + } + + onLayout(children: LayoutChild[], constraint: ConstraintSizeOptions): void {// error *2 + let layoutChild: LayoutChild = children[0];// error + layoutChild.constraint; // error + layoutChild.position; // error + layoutChild.name; // error + layoutChild.id; // error + layoutChild.borderInfo.borderWidth; // error *2 + layoutChild.borderInfo.padding; // error *2 + layoutChild.borderInfo.margin; // error *2 + layoutChild.layout({ position: { x: 0, y: 0 }, constraint: constraint }); // error *3 + layoutChild.measure(constraint); // error + } + + onMeasure(children: LayoutChild[], constraint: ConstraintSizeOptions): void {// error *2 + } + + // Popup builder + @Builder popupBuilder() { + Row({ space: 2 }) { + }.width(100).height(50).padding(5) + } + build() { + Column() { + Text('Image drag and drop') + .fontSize('30dp') + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) { + Image($r('app.media.startIcon')) + .width(100) + .height(100) + .border({ width: 1 }) + .draggable(true) + .onDragStart((event:DragEvent) => { + typeof event.getX(); //error + (event as DragEvent).getY(); //error + console.log('',event.getY()); //error + }) + } + .margin({ bottom: this.globalEvent.getY() }) //error + Row() { + Column(){ + } + .border({width: 1}) + .height('90%') + .width('100%') + .onDrop((event?: DragEvent, extraParams?: string) => { + console.log("enter onDrop") + const x = event?.getX(); //error + const y = event?.getY(); //error + }, {disableDataPrefetch: true}) + } + .height("50%") + .width("90%") + .border({ width: 1 }) + + Button('PopupOptions') + .bindPopup(this.handlePopup, { + message: 'This is a popup with PopupOptions', + placementOnTop: true// error + }) + .useSizeType({}) // error + + List({ space: 10, scroller: this.scroller }) + .onScroll((xOffset: number, scrollState: ScrollState): void => { // error + }) + .width('100%') + .height(90) + .touchable(true)// error + .mask(new CircleAttribute()) // error + } + } + onLayout(children: Array//error + , constraint: ConstraintSizeOptions) { + children[0].borderInfo as LayoutBorderInfo;//error + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/common_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..9eb4d655c3bc4fab432f35a1de29db09dbe98baa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json @@ -0,0 +1,878 @@ +{ + "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, + "column": 1, + "endLine": 21, + "endColumn": 2, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 23, + "endLine": 19, + "endColumn": 32, + "problem": "DuplicateDeclNameFromSdk", + "suggest": "", + "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 22, + "endLine": 20, + "endColumn": 26, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 36, + "endLine": 22, + "endColumn": 46, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 66, + "endLine": 22, + "endColumn": 82, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 101, + "endLine": 22, + "endColumn": 112, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 21, + "endLine": 23, + "endColumn": 31, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 11, + "endLine": 24, + "endColumn": 24, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 28, + "endLine": 24, + "endColumn": 44, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 23, + "endLine": 27, + "endColumn": 34, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 13, + "endLine": 28, + "endColumn": 24, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 21, + "endLine": 29, + "endColumn": 31, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 38, + "endLine": 32, + "endColumn": 54, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 55, + "endLine": 32, + "endColumn": 72, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 23, + "endLine": 33, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 25, + "endLine": 34, + "endColumn": 42, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 17, + "endLine": 47, + "endColumn": 26, + "problem": "DuplicateDeclNameFromSdk", + "suggest": "", + "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 36, + "endLine": 50, + "endColumn": 44, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 17, + "endLine": 54, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 19, + "endLine": 56, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 3, + "endLine": 76, + "endColumn": 4, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 3, + "endLine": 65, + "endColumn": 11, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 22, + "endLine": 65, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 22, + "endLine": 66, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 36, + "endLine": 66, + "endColumn": 47, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 17, + "endLine": 68, + "endColumn": 25, + "problem": "SdkTypeQuery", + "suggest": "", + "rule": "Using typeof as a type is not allowed in this API (sdk-type-query)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 41, + "endLine": 74, + "endColumn": 42, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 47, + "endLine": 74, + "endColumn": 48, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 78, + "column": 3, + "endLine": 78, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 78, + "column": 23, + "endLine": 78, + "endColumn": 34, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 83, + "column": 18, + "endLine": 83, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 84, + "column": 13, + "endLine": 84, + "endColumn": 16, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 84, + "column": 25, + "endLine": 84, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 84, + "column": 37, + "endLine": 84, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 92, + "column": 18, + "endLine": 92, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 19, + "endLine": 93, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 94, + "column": 28, + "endLine": 94, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 96, + "column": 31, + "endLine": 96, + "endColumn": 40, + "problem": "DuplicateDeclNameFromSdk", + "suggest": "", + "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 26, + "endLine": 97, + "endColumn": 30, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 34, + "endLine": 98, + "endColumn": 38, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 23, + "endLine": 98, + "endColumn": 32, + "problem": "DuplicateDeclNameFromSdk", + "suggest": "", + "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 34, + "endLine": 99, + "endColumn": 38, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 102, + "column": 42, + "endLine": 102, + "endColumn": 46, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 106, + "column": 25, + "endLine": 106, + "endColumn": 26, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 109, + "column": 26, + "endLine": 109, + "endColumn": 35, + "problem": "DuplicateDeclNameFromSdk", + "suggest": "", + "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", + "severity": "ERROR" + }, + { + "line": 111, + "column": 28, + "endLine": 111, + "endColumn": 32, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 112, + "column": 28, + "endLine": 112, + "endColumn": 32, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 24, + "endLine": 117, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 126, + "column": 21, + "endLine": 126, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 130, + "column": 15, + "endLine": 130, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 132, + "column": 17, + "endLine": 132, + "endColumn": 32, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 135, + "column": 3, + "endLine": 138, + "endColumn": 4, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 135, + "column": 28, + "endLine": 135, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 137, + "column": 5, + "endLine": 137, + "endColumn": 16, + "problem": "RuntimeArrayCheck", + "suggest": "", + "rule": "Array bound not checked. (arkts-runtime-array-check)", + "severity": "ERROR" + }, + { + "line": 137, + "column": 31, + "endLine": 137, + "endColumn": 47, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 2, + "endLine": 39, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 2, + "endLine": 40, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 4, + "endLine": 42, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 4, + "endLine": 43, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 4, + "endLine": 44, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 4, + "endLine": 45, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 4, + "endLine": 49, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 21, + "endLine": 50, + "endColumn": 29, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroller\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 36, + "endLine": 50, + "endColumn": 44, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroller\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 53, + "column": 5, + "endLine": 53, + "endColumn": 14, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"animateTo\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 14, + "endLine": 55, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Curve\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 17, + "endLine": 57, + "endColumn": 25, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"PlayMode\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 49, + "endLine": 65, + "endColumn": 70, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ConstraintSizeOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 78, + "column": 50, + "endLine": 78, + "endColumn": 71, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ConstraintSizeOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 4, + "endLine": 82, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Builder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 83, + "column": 5, + "endLine": 83, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 87, + "column": 5, + "endLine": 87, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 88, + "column": 7, + "endLine": 88, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 90, + "column": 7, + "endLine": 90, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Flex\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 90, + "column": 25, + "endLine": 90, + "endColumn": 38, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexDirection\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 90, + "column": 39, + "endLine": 90, + "endColumn": 42, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 90, + "column": 56, + "endLine": 90, + "endColumn": 65, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ItemAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 90, + "column": 90, + "endLine": 90, + "endColumn": 99, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 91, + "column": 9, + "endLine": 91, + "endColumn": 14, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Image\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 103, + "column": 7, + "endLine": 103, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 104, + "column": 9, + "endLine": 104, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 119, + "column": 7, + "endLine": 119, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 126, + "column": 7, + "endLine": 126, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"List\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 127, + "column": 48, + "endLine": 127, + "endColumn": 59, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ScrollState\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 132, + "column": 17, + "endLine": 132, + "endColumn": 32, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"CircleAttribute\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 136, + "column": 19, + "endLine": 136, + "endColumn": 40, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ConstraintSizeOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_api.ets.json b/ets2panda/linter/test/deprecatedapi/common_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a4c1c4ff4d4739c640830e81a8598fabc5a7799 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets @@ -0,0 +1,39 @@ +/* + * 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. + */ + +import { LocalStorage } from './sdk/api/common_ts_ets_api' + +@Entry +@Component +struct SharedLocalStorage { + localStorage = LocalStorage.getShared(); //error + + build() { + Row() { + Column() { + Button("Change Local Storage to 47") + .onClick(() => { + this.localStorage?.setOrCreate("propA", 47); + }) + Button("Get Local Storage") + .onClick(() => { + console.info(`localStorage: ${this.localStorage?.get("propA")}`); + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..01ccb75666b2a19dd85e9c98c300c653459d6d00 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 21, + "column": 31, + "endLine": 21, + "endColumn": 40, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 53, + "endLine": 28, + "endColumn": 55, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 5, + "endLine": 24, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 7, + "endLine": 25, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 9, + "endLine": 26, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 9, + "endLine": 30, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.json b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets new file mode 100755 index 0000000000000000000000000000000000000000..6ee8fd02c0f8587c74494aa39a3425d2a0d199f9 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets @@ -0,0 +1,25 @@ +/* + * 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. + */ +AppStorage.Set("username", "John"); // error +console.log(AppStorage.get("username")); +let keys: IterableIterator = AppStorage.Keys(); // error +let simple = AppStorage.staticClear(); // error +AppStorage.setOrCreate('simpleProp', 121); +AppStorage.Has('simpleProp'); // error +AppStorage.setOrCreate('PropA', 47); +let prop: SubscribedAbstractProperty = AppStorage.SetAndProp('PropB', 49); // error +AppStorage.SetOrCreate('PropA', 47); // error +PersistentStorage.PersistProp('aProp', 47); // error +AppStorage.Prop("username"); // error \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.args.json b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..c7ff7c846d95459a0dfae61ca9a09c70f8ec6ba9 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.arkts2.json @@ -0,0 +1,198 @@ +{ + "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, + "column": 5, + "endLine": 18, + "endColumn": 38, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 38, + "endLine": 19, + "endColumn": 41, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 33, + "endLine": 21, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 79, + "endLine": 22, + "endColumn": 81, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 33, + "endLine": 23, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 40, + "endLine": 24, + "endColumn": 42, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 15, + "column": 1, + "endLine": 15, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 13, + "endLine": 16, + "endColumn": 23, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 38, + "endLine": 17, + "endColumn": 48, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 14, + "endLine": 18, + "endColumn": 24, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SubscribedAbstractProperty\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 48, + "endLine": 22, + "endColumn": 58, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"PersistentStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 1, + "endLine": 25, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"AppStorage\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.json b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..fd824bf65e41784d02f355f28af1be96f899cff6 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api1.ets.json @@ -0,0 +1,28 @@ +{ + "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, + "column": 5, + "endLine": 18, + "endColumn": 38, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets b/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets new file mode 100644 index 0000000000000000000000000000000000000000..f049f9273b5d0087410dfed77e2d334a8e6363c6 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets @@ -0,0 +1,47 @@ +/* + * 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. + */ + +import { componentSnapshot } from '@kit.ArkUI'; + +@Entry +@Component +struct SnapshotExample { + @Builder + RandomBuilder() { + Flex() { + Text('Test menu') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + } + .width(100) + } + + build() { + Column() { + Button("click to generate UI snapshot") + .onClick(() => { + componentSnapshot.get("root", () => {}); //error + componentSnapshot.get("root"); //error + componentSnapshot.createFromBuilder(() => { this.RandomBuilder()}, () => {}); //error + componentSnapshot.createFromBuilder(() => { this.RandomBuilder()}); //error + }).margin(10) + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.json b/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/curves.ets b/ets2panda/linter/test/deprecatedapi/curves.ets new file mode 100644 index 0000000000000000000000000000000000000000..c13a0cfce6ce35e2f8432a6072c35b669ee7a339 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/curves.ets @@ -0,0 +1,17 @@ +/* + * 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. + */ + +import { curves } from '@kit.ArkUI'; +curves.cubicBezier(0.1, 0.0, 0.1, 1.0);//error \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/curves.ets.json b/ets2panda/linter/test/deprecatedapi/curves.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/curves.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..db08bd6b30d3280d2403d9130ccee0b113294424 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets @@ -0,0 +1,17 @@ +/* + * 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. + */ +import { curves } from './sdk/api/@ohos.curves'; + +curves.init() \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..0a1fb129d6c53deb03dc937329239d8e0ce9a082 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.arkts2.json @@ -0,0 +1,28 @@ +{ + "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": 8, + "endLine": 17, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.json b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/custom_api.ets b/ets2panda/linter/test/deprecatedapi/custom_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..a809862de1c8de194898de44a4cdb19bdf2ee43b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/custom_api.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ +import {PanelType} from './sdk/api/panel' + +@@Entry +@Component +struct WrapContentPanelExample { + @State isVisible: boolean = true + build() { + Column() { + Panel(this.isVisible) + .type(PanelType.CUSTOM) // error + } + + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/custom_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/custom_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/custom_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..a57cc4ca007a717c3187339280a457e970aa2ea2 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 2, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 13, + "endLine": 24, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 23, + "endLine": 24, + "endColumn": 29, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 3, + "endLine": 17, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/custom_api.ets.json b/ets2panda/linter/test/deprecatedapi/custom_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/custom_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/date_picker.ets b/ets2panda/linter/test/deprecatedapi/date_picker.ets new file mode 100644 index 0000000000000000000000000000000000000000..c5937657163f4357e9fde0b64e18341613a4df22 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/date_picker.ets @@ -0,0 +1,40 @@ +/* + * 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. + */ + +@Entry +@Component +struct DatePickerExample { + private selectedDate: Date = new Date('2021-08-08'); + + build() { + Column() { + Button("DatePickerDialog") + .margin(20) + .onClick(() => { + DatePickerDialog.show({ //error + onAccept: () => {}, //error + onChange: () => {} //error + }) //error + }) + + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate + }).onChange(() => {}) //error + + }.width('100%').height('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/date_picker.ets.json b/ets2panda/linter/test/deprecatedapi/date_picker.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/date_picker.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets b/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..700f35d0a8ebde2205298181290849e340c266e0 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets @@ -0,0 +1,30 @@ +/* + * 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. + */ + +import { componentUtils } from '@kit.ArkUI'; + +@Entry +@Component +struct CommonUtilsExample { + + aboutToAppear(): void { + let modePosition:componentUtils.ComponentInfo = componentUtils.getRectangleById("onClick"); // error + } + + build() { + Column() { + }.width('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets new file mode 100755 index 0000000000000000000000000000000000000000..032b04c32363fe08f8df02c4705fd799bf1bae5c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets @@ -0,0 +1,46 @@ +/* + * 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. + */ +import {font} from './sdk/api/@ohos.font'; + +@Entry +@Component +struct FontExample { + fontInfo2: font.FontInfo = font.getFontByName(''); // error + fontList: Array = new Array(); + + aboutToAppear(): void { + font.registerFont({ // error + familyName: 'mediumRawFile', + familySrc: $rawfile('font/medium.ttf') + }) + } + + build() { + Column() { + Button("getFontByName") + .onClick(() => { + this.fontInfo2 = font.getFontByName(''); // error + }) + Button("getSystemFontList") + .onClick(() => { + this.fontList = font.getSystemFontList(); // error + }) + Button("registerFont") + .onClick(() => { + font.registerFont({familyName: 'mediumRawFile', familySrc: $rawfile('font/medium.ttf')}); // error + }) + }.width('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.args.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..d720ed0d4869125157fa8048467911e42cbf230d --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json @@ -0,0 +1,128 @@ +{ + "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": 20, + "column": 35, + "endLine": 20, + "endColumn": 48, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 10, + "endLine": 24, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 33, + "endLine": 34, + "endColumn": 46, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 32, + "endLine": 38, + "endColumn": 49, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 16, + "endLine": 42, + "endColumn": 28, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 5, + "endLine": 31, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 7, + "endLine": 32, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 7, + "endLine": 36, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 7, + "endLine": 40, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets b/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets new file mode 100644 index 0000000000000000000000000000000000000000..c17f35ce66bb70e7ba37b08cea768898ed7c2c60 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets @@ -0,0 +1,85 @@ +/* + * 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. + */ + +import { promptAction } from '@kit.ArkUI'; + +@Entry +@Component +struct PromptActionExample { + + aboutToAppear(): void { + promptAction.showToast({ // error + message: 'Hello World', + duration: 2000 + }); + + promptAction.showDialog({ // error + title: 'Title Info', + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000' + } + ], + }); + + promptAction.showDialog({ // error + title: 'showDialog Title Info', + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000' + } + ] + }, (err, data) => { + }); + + promptAction.showActionMenu({ // error + title: 'showActionMenu Title Info', + buttons: [ + { + text: 'item1', + color: '#666666' + } + ] + }); + + promptAction.showActionMenu({ // error + title: 'Title Info', + buttons: [ + { + text: 'item1', + color: '#666666' + } + ] + }, (err, data) => { + }) + + promptAction.closeCustomDialog(1); // error + promptAction.openCustomDialog({ // error + builder: () => { + }, + onWillDismiss: (dismissDialogAction: DismissDialogAction) => { + } + }); + } + + build() { + Column() { + }.width('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..2a8b234e1c72a6ed4e9026a89bb9cff0395f7b29 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.json @@ -0,0 +1,58 @@ +{ + "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": 48, + "column": 9, + "endLine": 48, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 14, + "endLine": 48, + "endColumn": 18, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 9, + "endLine": 69, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 14, + "endLine": 69, + "endColumn": 18, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets new file mode 100755 index 0000000000000000000000000000000000000000..a5ca89df3c1e3abe7068bdc00a3b5b4857045b7a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets @@ -0,0 +1,147 @@ +/* + * 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. + */ +import router from './sdk/api/@system.router'; + +class L{ + enableAlertBeforeBackPage() { + router.enableAlertBeforeBackPage({ //error + message: 'Message Info', + success: ()=> { + console.log('success'); + }, + cancel: ()=> { + console.log('cancel'); + } + }); + } +} + +class RouterParams { + data1: string; + + constructor(str: string) { + this.data1 = str; + } +} + +@Entry +@Component +struct RouterExample { + + aboutToAppear(): void { + router.replaceNamedRoute({ // error + name: 'myPage', + params: new RouterParams('message') + }); + + router.replaceNamedRoute({ // error + name: 'myPage', + params: new RouterParams('message') + }, (err) => { + }); + + router.replaceNamedRoute({ // error + name: 'myPage', + params: new RouterParams('message') + }, router.RouterMode.Standard); + + router.replaceNamedRoute({ // error + name: 'myPage', + params: new RouterParams('message') + }, router.RouterMode.Standard, (err) => { + }); + + router.pushNamedRoute({ // error + name: 'myPage', + params: new RouterParams('message') + }); + + router.pushNamedRoute({ // error + name: 'myPage', + params: new RouterParams('message') + }, (err) => { + }) + + router.pushNamedRoute({ // error + name: 'myPage', + params: new RouterParams('message') + }, router.RouterMode.Standard); + + router.pushNamedRoute({ // error + name: 'myPage', + params: new RouterParams('message') + }, router.RouterMode.Standard, (err) => { + }) + + let obj = router.getParams(); // error + router.hideAlertBeforeBackPage(); // error + router.showAlertBeforeBackPage({ // error + message: 'Message Info' + }); + let options: Array = router.getStateByUrl('pages/index'); // error + let options1: router.RouterState | undefined = router.getStateByIndex(1); // error + let page = router.getState(); // error + let length = router.getLength(); // error + router.clear(); // error + router.back({ url: 'pages/detail' }); // error + router.back(1); // error + router.back(1, { info: 'From Home' }); // error + router.replaceUrl({ // error + url: 'pages/detail', + params: new RouterParams('message') + }); + router.replaceUrl({ // error + url: 'pages/detail', + params: new RouterParams('message') + }, (err) => { + }); + router.replaceUrl({ // error + url: 'pages/detail', + params: new RouterParams('message') + }, router.RouterMode.Standard); + router.replaceUrl({ // error + url: 'pages/detail', + params: new RouterParams('message') + }, router.RouterMode.Standard, (err) => { + }); + + router.pushUrl({ // error + url: 'pages/routerpage2', + params: {name: 'message', age: 1} + }); + + router.pushUrl({ // error + url: 'pages/routerpage2', + params: new RouterParams('message') + }, (err) => { + }); + + router.pushUrl({ // error + url: 'pages/routerpage2', + params: new RouterParams('message') + }, router.RouterMode.Standard); + + router.pushUrl({ // error + url: 'pages/routerpage2', + params: new RouterParams('message') + }, router.RouterMode.Standard, (err) => { + }) + } + + build() { + Column() { + }.width('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.args.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..5c30d621504123bc221f2da8fbce675bbb584ba2 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.arkts2.json @@ -0,0 +1,218 @@ +{ + "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": 19, + "column": 12, + "endLine": 19, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 9, + "endLine": 52, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 37, + "endLine": 63, + "endColumn": 40, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 9, + "endLine": 74, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 85, + "column": 37, + "endLine": 85, + "endColumn": 40, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 88, + "column": 9, + "endLine": 88, + "endColumn": 33, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 94, + "column": 75, + "endLine": 94, + "endColumn": 76, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 95, + "column": 9, + "endLine": 95, + "endColumn": 33, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 96, + "column": 9, + "endLine": 96, + "endColumn": 36, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 12, + "endLine": 97, + "endColumn": 17, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 17, + "endLine": 99, + "endColumn": 18, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 100, + "column": 17, + "endLine": 100, + "endColumn": 18, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 108, + "column": 9, + "endLine": 108, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 37, + "endLine": 117, + "endColumn": 40, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 122, + "column": 38, + "endLine": 122, + "endColumn": 39, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 128, + "column": 9, + "endLine": 128, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 139, + "column": 37, + "endLine": 139, + "endColumn": 40, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 2, + "endLine": 39, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 2, + "endLine": 40, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 144, + "column": 5, + "endLine": 144, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..405836ab2912121892e0fb2a3e8d3c6c3a5cc33a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.json @@ -0,0 +1,128 @@ +{ + "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": 52, + "column": 9, + "endLine": 52, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 37, + "endLine": 63, + "endColumn": 40, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 9, + "endLine": 74, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 85, + "column": 37, + "endLine": 85, + "endColumn": 40, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 88, + "column": 9, + "endLine": 88, + "endColumn": 33, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 95, + "column": 9, + "endLine": 95, + "endColumn": 33, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 96, + "column": 9, + "endLine": 96, + "endColumn": 36, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 108, + "column": 9, + "endLine": 108, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 37, + "endLine": 117, + "endColumn": 40, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 128, + "column": 9, + "endLine": 128, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 139, + "column": 37, + "endLine": 139, + "endColumn": 40, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets b/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1b1f0869618702f12dedc302fc2521d6b64bfba --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets @@ -0,0 +1,29 @@ +/* + * 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. + */ + +@Entry +@Component +struct TimePickerDialogExample { + + aboutToAppear(): void { + TimePickerDialog.show(); + TimePickerDialog.show({useMilitaryTime: true}); + } + + build() { + Column() { + }.width('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/dragController.ets b/ets2panda/linter/test/deprecatedapi/dragController.ets new file mode 100644 index 0000000000000000000000000000000000000000..1fc9a633b8f5fa605d424013d8d018e370a35257 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/dragController.ets @@ -0,0 +1,77 @@ +/* + * 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. + */ + +import { dragController } from "@kit.ArkUI"; +import { image } from '@kit.ImageKit'; + +@Entry +@Component +struct DragControllerPage { + @State pixmap: image.PixelMap | null = null + + @Builder + DraggingBuilder() { + Column() { + Text("DraggingBuilder") + .fontColor(Color.White) + .fontSize(12) + } + .width(100) + .height(100) + .backgroundColor(Color.Blue) + } + + @Builder + CustomDragView() { + Column() { + Text('Drag Me') + .fontSize(18) + .fontColor(Color.Black) + } + .width(100) + .height(50) + .backgroundColor(Color.White) + } + + private customBuilders: Array = [this.CustomDragView]; + + build() { + Column() { + Button('drag') + .margin(10) + .onDragEnter(() => { + dragController.getDragPreview(); //error + }) + .onTouch((event?: TouchEvent) => { + if (event) { + let dragInfo: dragController.DragInfo = { + pointerId: 0, + extraParams: '' + } + dragController.createDragAction(this.customBuilders, dragInfo); //error + + dragController.executeDrag(() => { //error + this.DraggingBuilder() + }, dragInfo, (err, eve) => { + }); + + dragController.executeDrag(() => { //error + this.DraggingBuilder() + }, dragInfo); + } + }) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/dragController.ets.json b/ets2panda/linter/test/deprecatedapi/dragController.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..fcedf465955a961dd6523968783383316d82dc8d --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/dragController.ets.json @@ -0,0 +1,38 @@ +{ + "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": 67, + "column": 27, + "endLine": 67, + "endColumn": 30, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 32, + "endLine": 67, + "endColumn": 35, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/enums.ets b/ets2panda/linter/test/deprecatedapi/enums.ets new file mode 100644 index 0000000000000000000000000000000000000000..5135fbb18e7bfe30d4ae3a8ea9e5073841ceea14 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/enums.ets @@ -0,0 +1,46 @@ +/* + * 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. + */ + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller(); + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item: number) => { + Text(item.toString()) + }, (item: string) => item) + }.width('100%') + } + + Button('back Center') + .height('5%') + .onClick(() => { + this.scroller.scrollEdge(Edge.Center); //error + }) + .margin({ top: 160, left: 20 }) + Button('back Middle') + .height('5%') + .onClick(() => { + this.scroller.scrollEdge(Edge.Middle); //error + }) + .margin({ top: 210, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/enums.ets.json b/ets2panda/linter/test/deprecatedapi/enums.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/enums.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..ee528bd4ad87e66b108e3c889aebbfdf68f15e6b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets @@ -0,0 +1,24 @@ +/* + * 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. + */ +import { Environment } from './sdk/api/common_ts_ets_api'; + +Environment.EnvProp('accessibilityEnabled', 'default'); //error + +let keys: Array = Environment.Keys(); //error + +Environment.EnvProps([{ key: 'accessibilityEnabled', defaultValue: 'default' }, { //error + key: 'languageCode', + defaultValue: 'en' +}, { key: 'prop', defaultValue: 'hhhh' }]); \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..55aa23cb17ccc8da1522a8bbe65c63451179533f --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.arkts2.json @@ -0,0 +1,48 @@ +{ + "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": 13, + "endLine": 17, + "endColumn": 20, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 39, + "endLine": 19, + "endColumn": 43, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 13, + "endLine": 21, + "endColumn": 21, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.json b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/foldable_api.ets b/ets2panda/linter/test/deprecatedapi/foldable_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..de997623bfe14662921cfc3b36af43970da77aa0 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/foldable_api.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ +import {PanelType} from './sdk/api/panel' + +@@Entry +@Component +struct WrapContentPanelExample { + @State isVisible: boolean = true + build() { + Column() { + Panel(this.isVisible) + .type(PanelType.Foldable) // error + } + + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/foldable_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..9ecb29181d94fbbfb051715976d110dbef378032 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 2, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 13, + "endLine": 24, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 23, + "endLine": 24, + "endColumn": 31, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 3, + "endLine": 17, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/foldable_api.ets.json b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/getLength.ets b/ets2panda/linter/test/deprecatedapi/getLength.ets new file mode 100755 index 0000000000000000000000000000000000000000..897957626a7ff0726cf67c071a5af131c6252b9a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/getLength.ets @@ -0,0 +1,22 @@ +/* + * 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. + */ +import router from './sdk/api/@system.router'; +class J{ + getLength() { + let size = router.getLength(); + console.log('pages stack size = ' + size); + } +} +export default new J() \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/getLength.ets.args.json b/ets2panda/linter/test/deprecatedapi/getLength.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/getLength.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/getLength.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/getLength.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..7c08a340f938a9098f617645e5ea936ae70eee66 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/getLength.ets.arkts2.json @@ -0,0 +1,28 @@ +{ + "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, + "column": 9, + "endLine": 18, + "endColumn": 34, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/getLength.ets.json b/ets2panda/linter/test/deprecatedapi/getLength.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7c08a340f938a9098f617645e5ea936ae70eee66 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/getLength.ets.json @@ -0,0 +1,28 @@ +{ + "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, + "column": 9, + "endLine": 18, + "endColumn": 34, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/getParams.ets b/ets2panda/linter/test/deprecatedapi/getParams.ets new file mode 100755 index 0000000000000000000000000000000000000000..69c220cec56f9833f9311cd2ab6e0a2070edb83c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/getParams.ets @@ -0,0 +1,17 @@ +/* + * 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. + */ +import router from './sdk/api/@system.router'; + +let params: Object = router.getParams(); \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/getParams.ets.args.json b/ets2panda/linter/test/deprecatedapi/getParams.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/getParams.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/getParams.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/getParams.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/getParams.ets.arkts2.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/getParams.ets.json b/ets2panda/linter/test/deprecatedapi/getParams.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/getParams.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets b/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..30d8bc150c9293466f938406ac7fb7fa9d9445cc --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets @@ -0,0 +1,34 @@ +/* + * 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. + */ +import { GridAttribute } from './sdk/api/grid'; + +@Entry +@Component +struct GridExample { + @State scrollPos: number = 0; + @State scrollStatus: string = 'IDLE'; + + build() { + Grid() { + ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], () => { + }) + } + .columnsTemplate('1fr 1fr 1fr') + .onScroll((offset, state) => { + this.scrollPos = offset; + this.scrollStatus = ScrollState[state]; + }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..950e9a126ec0c90eb54a6e9c89b696c92a865cd5 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.arkts2.json @@ -0,0 +1,218 @@ +{ + "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": 20, + "column": 30, + "endLine": 20, + "endColumn": 31, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 16, + "endLine": 25, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 19, + "endLine": 25, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 22, + "endLine": 25, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 25, + "endLine": 25, + "endColumn": 26, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 28, + "endLine": 25, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 31, + "endLine": 25, + "endColumn": 32, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 34, + "endLine": 25, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 37, + "endLine": 25, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 40, + "endLine": 25, + "endColumn": 41, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 43, + "endLine": 25, + "endColumn": 45, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 16, + "endLine": 29, + "endColumn": 22, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 24, + "endLine": 29, + "endColumn": 29, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 4, + "endLine": 21, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 5, + "endLine": 24, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Grid\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 7, + "endLine": 25, + "endColumn": 14, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 27, + "endLine": 31, + "endColumn": 38, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ScrollState\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.json b/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..847ccb380cc335698340e7cbb59584979693d731 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridAttributeonScroll_api.ets.json @@ -0,0 +1,38 @@ +{ + "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": 29, + "column": 16, + "endLine": 29, + "endColumn": 22, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 24, + "endLine": 29, + "endColumn": 29, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..57cca2901b5103e23c4bfa5329be23599edc1a41 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ +import {GridContainerOptions} from './sdk/api/grid_container'; + +@Entry +@Component +struct GridContainerExample { + @State sizeType: SizeType = SizeType.XS + + build() { + Column({ space: 5 }) { + GridContainer({ columns: 12, sizeType: this.sizeType, gutter: 10, margin: 20 }) { + }.width('90%') + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..7ad3a1e285f33b3badf1babf3bb10f1d64c2f654 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.arkts2.json @@ -0,0 +1,128 @@ +{ + "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": 23, + "column": 21, + "endLine": 23, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 32, + "endLine": 24, + "endColumn": 34, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 69, + "endLine": 24, + "endColumn": 71, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 81, + "endLine": 24, + "endColumn": 83, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 20, + "endLine": 20, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SizeType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 31, + "endLine": 20, + "endColumn": 39, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SizeType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 20, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"GridContainer\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.json b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridItem.ets b/ets2panda/linter/test/deprecatedapi/gridItem.ets new file mode 100755 index 0000000000000000000000000000000000000000..d99fe0cef1170522a0a0c0a91f64e9a5d1328900 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridItem.ets @@ -0,0 +1,31 @@ +/* + * 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. + */ +@Entry +@Component +struct GridItemExample { + build() { + Column() { + Grid() { + GridItem() + .width('100%') + .height('100%') + .forceRebuild(false); // error + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr') + .rowsTemplate('1fr 1fr 1fr 1fr 1fr') + .width('90%').height(300) + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridItem.ets.args.json b/ets2panda/linter/test/deprecatedapi/gridItem.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..aa0b62d6c8953d91487fe6b2039ac56853c4c1a1 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridItem.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridItem.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/gridItem.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..761a8db473d89daaa8cff5d464654a8f8fb68114 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridItem.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "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": 28, + "column": 28, + "endLine": 28, + "endColumn": 31, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 35, + "endLine": 29, + "endColumn": 36, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 15, + "column": 2, + "endLine": 15, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 5, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 7, + "endLine": 20, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Grid\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 9, + "endLine": 21, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"GridItem\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridItem.ets.json b/ets2panda/linter/test/deprecatedapi/gridItem.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/gridItem.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/grid_container.ets b/ets2panda/linter/test/deprecatedapi/grid_container.ets new file mode 100755 index 0000000000000000000000000000000000000000..c8d95d26ecd8ccffa7096c5ab7aee865a0767ce5 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/grid_container.ets @@ -0,0 +1,67 @@ +/* + * 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. + */ + +@Entry +@Component +struct GridContainerExample { + @State sizeType: SizeType = SizeType.MD // error + private options: GridContainerOptions = { + columns: 12, // error + sizeType: this.sizeType, // error + gutter: 10, // error + margin: 20 // error + } + + build() { + Column({ space: 5 }) { + GridContainer({ + columns: 12, + sizeType: this.sizeType, + gutter: 10, + margin: 20 + }) { + Row() { + Text('1') + .height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center) + } + }.width('90%') + + GridContainer(this.options) { + Row() { + Text('1') + .useSizeType({ + xs: { span: 6, offset: 0 }, + sm: { span: 2, offset: 0 }, + md: { span: 2, offset: 0 }, + lg: { span: 2, offset: 0 } + }) + .height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center) + } + }.width('90%') + + Text('Click Simulate to change the device width').fontSize(9).width('90%').fontColor(0xCCCCCC) + Row() { + Button('LG') + .onClick(() => { + this.sizeType = SizeType.LG // error + }).backgroundColor(0x317aff) + Button('Auto') + .onClick(() => { + this.sizeType = SizeType.Auto // error + }).backgroundColor(0x317aff) + } + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/grid_container.ets.args.json b/ets2panda/linter/test/deprecatedapi/grid_container.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/grid_container.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/grid_container.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/grid_container.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..903415585d97d6bb272b756bfe2395e83374ec18 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/grid_container.ets.arkts2.json @@ -0,0 +1,418 @@ +{ + "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": 21, + "column": 14, + "endLine": 21, + "endColumn": 16, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 13, + "endLine": 23, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 13, + "endLine": 24, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 21, + "endLine": 28, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 18, + "endLine": 30, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 17, + "endLine": 32, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 17, + "endLine": 33, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 21, + "endLine": 37, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 27, + "endLine": 45, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 38, + "endLine": 45, + "endColumn": 39, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 27, + "endLine": 46, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 38, + "endLine": 46, + "endColumn": 39, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 27, + "endLine": 47, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 38, + "endLine": 47, + "endColumn": 39, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 27, + "endLine": 48, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 38, + "endLine": 48, + "endColumn": 39, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 21, + "endLine": 50, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 66, + "endLine": 54, + "endColumn": 67, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 35, + "endLine": 65, + "endColumn": 36, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 4, + "endLine": 19, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 20, + "endLine": 19, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SizeType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 31, + "endLine": 19, + "endColumn": 39, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SizeType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 20, + "endLine": 20, + "endColumn": 40, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"GridContainerOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 5, + "endLine": 28, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 7, + "endLine": 29, + "endColumn": 20, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"GridContainer\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 9, + "endLine": 35, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 11, + "endLine": 36, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 61, + "endLine": 37, + "endColumn": 70, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 7, + "endLine": 41, + "endColumn": 20, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"GridContainer\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 9, + "endLine": 42, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 11, + "endLine": 43, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 61, + "endLine": 50, + "endColumn": 70, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 7, + "endLine": 54, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 7, + "endLine": 55, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 9, + "endLine": 56, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 29, + "endLine": 58, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SizeType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 9, + "endLine": 60, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 29, + "endLine": 62, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SizeType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/grid_container.ets.json b/ets2panda/linter/test/deprecatedapi/grid_container.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/grid_container.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/image_animator.ets b/ets2panda/linter/test/deprecatedapi/image_animator.ets new file mode 100644 index 0000000000000000000000000000000000000000..91114d198fdc7292bc40661bd436d38dc289dcec --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/image_animator.ets @@ -0,0 +1,26 @@ +/* + * 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. + */ + +@Entry +@Component +struct ImageAnimatorExample { + + build() { + Column({ space: 10 }) { + ImageAnimator() + .preDecode(0) //error + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/image_animator.ets.json b/ets2panda/linter/test/deprecatedapi/image_animator.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/image_animator.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/inspector.ets b/ets2panda/linter/test/deprecatedapi/inspector.ets new file mode 100644 index 0000000000000000000000000000000000000000..d041d776c5bda0f085360fae3310bf56223a3791 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/inspector.ets @@ -0,0 +1,46 @@ +/* + * 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. + */ + +import inspector from '@ohos.arkui.inspector' + +@Entry +@Component +struct ImageExample { + build() { + Column() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) { + Row({ space: 5 }) { + Image($r('app.media.app_icon')) + .width(110) + .height(110) + .border({ width: 1 }) + .id('IMAGE_ID') + } + } + }.height(320).width(360).padding({ right: 10, top: 10 }) + } + + listener:inspector.ComponentObserver = inspector.createComponentObserver('IMAGE_ID') //error + + aboutToAppear() { + let onLayoutComplete:()=>void=():void=>{} + let onDrawComplete:()=>void=():void=>{} + let FuncLayout = onLayoutComplete // bind current js instance + let FuncDraw = onDrawComplete // bind current js instance + + this.listener.on('layout', FuncLayout) + this.listener.on('draw', FuncDraw) + } +} diff --git a/ets2panda/linter/test/deprecatedapi/inspector.ets.json b/ets2panda/linter/test/deprecatedapi/inspector.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/inspector.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets new file mode 100644 index 0000000000000000000000000000000000000000..fbc16f834896d3f31bfaf1f5acb400c6ce15f134 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets @@ -0,0 +1,121 @@ +/* + * 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. + */ + +class BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdded(index); //error + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChanged(index); //error + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDeleted(index); //error + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMoved(from, to); //error + }) + } +} + +class MyDataSource extends BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct MyComponent { + private data: MyDataSource = new MyDataSource(); + + aboutToAppear() { + for (let i = 0; i <= 20; i++) { + this.data.pushData(`Hello ${i}`); + } + } + + build() { + List({ space: 3 }) { + LazyForEach(this.data, (item: string) => { + ListItem() { + Row() { + Text(item).fontSize(50) + .onAppear(() => { + console.info(`appear: ${item}`); + }) + }.margin({ left: 10, right: 10 }) + } + }, (item: string) => item) + }.cachedCount(5) + } +} diff --git a/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.json b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/list.ets b/ets2panda/linter/test/deprecatedapi/list.ets new file mode 100755 index 0000000000000000000000000000000000000000..914b230b1038672dd3b919a7297d3c2e4bc91e23 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/list.ets @@ -0,0 +1,39 @@ +/* + * 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. + */ +@Entry +@Component +struct ListExample { + build() { + Column() { + List({ space: 20, initialIndex: 0 }) + .listDirection(Axis.Vertical) + .scrollBar(BarState.Off) + .friction(0.6) + .divider({ + strokeWidth: 2, + color: 0xFFFFFF, + startMargin: 20, + endMargin: 20 + }) + .edgeEffect(EdgeEffect.Spring) + .editMode(false)// error + .width('90%') + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/list.ets.args.json b/ets2panda/linter/test/deprecatedapi/list.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/list.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/list.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/list.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..6ee23a6d2fb42a822efeabdc59557f924dd242f0 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/list.ets.arkts2.json @@ -0,0 +1,148 @@ +{ + "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": 20, + "column": 21, + "endLine": 20, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 39, + "endLine": 20, + "endColumn": 40, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 24, + "endLine": 25, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 24, + "endLine": 27, + "endColumn": 26, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 22, + "endLine": 28, + "endColumn": 24, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 21, + "endLine": 37, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 15, + "column": 2, + "endLine": 15, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 5, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 7, + "endLine": 20, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"List\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 24, + "endLine": 21, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Axis\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 20, + "endLine": 22, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"BarState\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 21, + "endLine": 30, + "endColumn": 31, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"EdgeEffect\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/list.ets.json b/ets2panda/linter/test/deprecatedapi/list.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/list.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/listitem_api.ets b/ets2panda/linter/test/deprecatedapi/listitem_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..1972648696c11df05dd8656018ac78a130f90425 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/listitem_api.ets @@ -0,0 +1,35 @@ +/* + * 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. + */ +import {ListItemAttribute,Sticky,EditMode} from './sdk/api/list_item'; + +@Entry +@Component +struct ListItemExample { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item: number) => { + ListItem() + .sticky(Sticky.Normal) //error + .editable(true) //error + .editable(EditMode.Deletable); //error + }, (item: string) => item) + }.width('90%') + .scrollBar(BarState.Off) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/listitem_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/listitem_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/listitem_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/listitem_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/listitem_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..433328bd56852b5b57d3b62f4a4ded28c9a5ddd8 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/listitem_api.ets.arkts2.json @@ -0,0 +1,228 @@ +{ + "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": 20, + "column": 28, + "endLine": 20, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 31, + "endLine": 20, + "endColumn": 32, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 34, + "endLine": 20, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 37, + "endLine": 20, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 40, + "endLine": 20, + "endColumn": 41, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 43, + "endLine": 20, + "endColumn": 44, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 46, + "endLine": 20, + "endColumn": 47, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 49, + "endLine": 20, + "endColumn": 50, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 52, + "endLine": 20, + "endColumn": 53, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 55, + "endLine": 20, + "endColumn": 56, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 21, + "endLine": 24, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 39, + "endLine": 24, + "endColumn": 40, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 21, + "endLine": 27, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 23, + "endLine": 29, + "endColumn": 31, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"List\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 9, + "endLine": 25, + "endColumn": 16, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 11, + "endLine": 26, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ListItem\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 18, + "endLine": 32, + "endColumn": 26, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"BarState\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/listitem_api.ets.json b/ets2panda/linter/test/deprecatedapi/listitem_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/listitem_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..28fe3c5414db15869bc5519c5280b4b52e994c83 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets @@ -0,0 +1,34 @@ +/* + * 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. + */ +import { matrix4 } from './sdk/api/@ohos.matrix4'; + +@Entry +@Component +struct Test { + private matrix1 = matrix4.rotate({ // error + x: 1, + y: 1, + z: 2, + angle: 30 + }); + private matrix1 = matrix4.copy(); // error + + private matrix1 = matrix4.translate({ x: 100 }); // error + + build() { + Column() { + }.width("100%").margin({ top: 50 }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..c2f4de7b044ee3f6425ae1d459c1fa275eb00391 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.arkts2.json @@ -0,0 +1,138 @@ +{ + "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": 20, + "column": 29, + "endLine": 20, + "endColumn": 35, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 10, + "endLine": 21, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 10, + "endLine": 22, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 10, + "endLine": 23, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 14, + "endLine": 24, + "endColumn": 16, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 29, + "endLine": 26, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 29, + "endLine": 28, + "endColumn": 38, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 44, + "endLine": 28, + "endColumn": 47, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 35, + "endLine": 32, + "endColumn": 37, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 5, + "endLine": 31, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.json b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/measure.ets b/ets2panda/linter/test/deprecatedapi/measure.ets new file mode 100644 index 0000000000000000000000000000000000000000..bcde2d53ca6739444a392bba783d8e41f98e976c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/measure.ets @@ -0,0 +1,40 @@ +/* + * 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. + */ + +import { MeasureText } from '@kit.ArkUI'; + +@Entry +@Component +struct Index { + textSize: SizeOptions = MeasureText.measureTextSize({ //error + textContent: "Hello World", + fontSize: '50px' + }); + @State textWidth: number = MeasureText.measureText({ //error + textContent: "Hello World", + fontSize: '50px' + }); + + build() { + Row() { + Column() { + Text(`The width of 'Hello World': ${this.textSize.width}`) + Text(`The width of 'Hello World': ${this.textWidth}`) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/measure.ets.json b/ets2panda/linter/test/deprecatedapi/measure.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/measure.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/mediaquery.ets b/ets2panda/linter/test/deprecatedapi/mediaquery.ets new file mode 100644 index 0000000000000000000000000000000000000000..be7cc2c88613b133dfc05e9890b53441db9753e8 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/mediaquery.ets @@ -0,0 +1,51 @@ +/* + * 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. + */ + +import { mediaquery } from '@kit.ArkUI'; + +@Entry +@Component +struct MediaQueryExample { + @State color: string = '#DB7093' + @State text: string = 'Portrait' + listener: mediaquery.MediaQueryListener = mediaquery.matchMediaSync('(orientation: landscape)'); //error + + onPortrait(mediaQueryResult:mediaquery.MediaQueryResult) { + if (mediaQueryResult.matches) { + this.color = '#FFD700' + this.text = 'Landscape' + } else { + this.color = '#DB7093' + this.text = 'Portrait' + } + } + + aboutToAppear() { + let portraitFunc = (mediaQueryResult: mediaquery.MediaQueryResult): void => this.onPortrait(mediaQueryResult) + this.listener.on('change', portraitFunc); + } + + + aboutToDisappear() { + this.listener.off('change'); + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(this.text).fontSize(24).fontColor(this.color) + } + .width('100%').height('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/mediaquery.ets.json b/ets2panda/linter/test/deprecatedapi/mediaquery.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/mediaquery.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/minibar_api.ets b/ets2panda/linter/test/deprecatedapi/minibar_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..2429a98b61a670558e1574a9d6d7eac4027e23e9 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/minibar_api.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ +import {PanelType} from './sdk/api/panel' + +@@Entry +@Component +struct WrapContentPanelExample { + @State isVisible: boolean = true + build() { + Column() { + Panel(this.isVisible) + .type(PanelType.Minibar) // error + } + + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/minibar_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..54931525a0ddd30f0a0e2c2ae2d1a8f9808892e3 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 2, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 13, + "endLine": 24, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 23, + "endLine": 24, + "endColumn": 30, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 3, + "endLine": 17, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/minibar_api.ets.json b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/navigation.ets b/ets2panda/linter/test/deprecatedapi/navigation.ets new file mode 100644 index 0000000000000000000000000000000000000000..244b22cd1a50d17b88f5a13a767e280d082c89e3 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navigation.ets @@ -0,0 +1,31 @@ +/* + * 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. + */ + +@Entry +@Component +struct NavigationExample { + build() { + Column({ space: 15 }) { + Row() { + Navigation() + .subTitle("test") //error + .toolBar() //error + } + .borderRadius(20) + } + .width('100%') + .margin({ top: 15 }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navigation.ets.json b/ets2panda/linter/test/deprecatedapi/navigation.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navigation.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navigator_api.ets b/ets2panda/linter/test/deprecatedapi/navigator_api.ets new file mode 100644 index 0000000000000000000000000000000000000000..f0a513452e0eb4c7c487eb2d86857aea0a56ce98 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navigator_api.ets @@ -0,0 +1,44 @@ +/* + * 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. + */ +import {NavigatorInstance,Navigator,NavigatorAttribute} from './sdk/api/navigator'; + +function aa(tt:NavigatorAttribute){//error + const a = new NavigatorAttribute() //error + typeof a.active(false);//error + return a as NavigatorAttribute;//error +} +@Entry +@Component +struct NavigatorExample { + @State active: boolean = false; + @State name: NameObject = { name: 'news' }; + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Start, + justifyContent: FlexAlign.SpaceBetween + }) { + Navigator({//error + target: 'pages/container/navigator/Detail', + type: NavigationType.Push + }).onClick(()=>{ + const attr = new NavigatorAttribute(); //error + attr.target('111')//error + }).params(new TextObject(this.name)) + NavigatorInstance.active(false);//error + }.height(150).width(350).padding(35); + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navigator_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..274a9bddd0a1f9191655a3ba261e592ebff23cb9 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json @@ -0,0 +1,238 @@ +{ + "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": 16, + "endLine": 17, + "endColumn": 34, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 18, + "endLine": 18, + "endColumn": 36, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 12, + "endLine": 19, + "endColumn": 18, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 15, + "endLine": 20, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 7, + "endLine": 34, + "endColumn": 16, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 26, + "endLine": 38, + "endColumn": 44, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 14, + "endLine": 39, + "endColumn": 20, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 21, + "endLine": 40, + "endColumn": 31, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 25, + "endLine": 41, + "endColumn": 31, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 14, + "endLine": 42, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 25, + "endLine": 42, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 38, + "endLine": 42, + "endColumn": 40, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 2, + "endLine": 22, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 2, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 4, + "endLine": 25, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 4, + "endLine": 26, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 5, + "endLine": 29, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Flex\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 18, + "endLine": 30, + "endColumn": 31, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexDirection\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 32, + "endLine": 30, + "endColumn": 38, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 19, + "endLine": 31, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ItemAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 23, + "endLine": 32, + "endColumn": 32, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 15, + "endLine": 36, + "endColumn": 29, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"NavigationType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navigator_api.ets.json b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navrouter_api.ets b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3f483241757f946564e1f0cac33e32f1f6ca87c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets @@ -0,0 +1,47 @@ +/* + * 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. + */ +import {NavRouterInstance,NavRouter,NavRouterAttribute} from './sdk/api/nav_router'; +import {NavRouteMode,NavRouterInterface,RouteInfo} from './sdk/api/nav_router'; + +@Entry +@Component +struct NavRouterExample { + @State isActiveWLAN: boolean = false + @State isActiveBluetooth: boolean = false + + build() { + Navigation() { + NavRouter() //error + .mode(NavRouteMode.PUSH_WITH_RECREATE) //error*3 + NavRouter({name:'',param:undefined}) //error *3 + .mode(NavRouteMode.PUSH_WITH_RECREATE) //error*3 + .onStateChange((isActivated: boolean) => { //error + console.log(NavRouteMode.REPLACE+'') //error*2 + const attr = new NavRouterAttribute(); //error + attr.mode(NavRouteMode.PUSH); //error*3 + }) + NavRouterInstance.mode(NavRouteMode.REPLACE) //error*3 + } + } +} +class Test implements NavRouterInterface {//error + public (): NavRouterAttribute;//error + public (value: RouteInfo): NavRouterAttribute;//error *2 + public (value?: RouteInfo): NavRouterAttribute|void {//error*2 + const attribute: NavRouterAttribute|undefined = undefined;//error + } +} +interface Demo extends NavRouterInterface{//error +} diff --git a/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..bbfdaf93fa58ed13e4e485222fdb3018bd1a809d --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.arkts2.json @@ -0,0 +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": 27, + "column": 10, + "endLine": 27, + "endColumn": 14, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 7, + "endLine": 26, + "endColumn": 16, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 15, + "endLine": 27, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 28, + "endLine": 27, + "endColumn": 46, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 10, + "endLine": 30, + "endColumn": 23, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 10, + "endLine": 29, + "endColumn": 14, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 7, + "endLine": 28, + "endColumn": 16, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 18, + "endLine": 28, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 26, + "endLine": 28, + "endColumn": 31, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 15, + "endLine": 29, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 28, + "endLine": 29, + "endColumn": 46, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 23, + "endLine": 31, + "endColumn": 35, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 36, + "endLine": 31, + "endColumn": 43, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 28, + "endLine": 32, + "endColumn": 46, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 16, + "endLine": 33, + "endColumn": 20, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 21, + "endLine": 33, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 34, + "endLine": 33, + "endColumn": 38, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 25, + "endLine": 35, + "endColumn": 29, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 30, + "endLine": 35, + "endColumn": 42, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 43, + "endLine": 35, + "endColumn": 50, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 23, + "endLine": 39, + "endColumn": 41, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 3, + "endLine": 40, + "endColumn": 9, + "problem": "InvalidIdentifier", + "suggest": "", + "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 3, + "endLine": 40, + "endColumn": 33, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 14, + "endLine": 40, + "endColumn": 32, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 3, + "endLine": 41, + "endColumn": 9, + "problem": "InvalidIdentifier", + "suggest": "", + "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 3, + "endLine": 41, + "endColumn": 49, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 18, + "endLine": 41, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 30, + "endLine": 41, + "endColumn": 48, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 3, + "endLine": 42, + "endColumn": 9, + "problem": "InvalidIdentifier", + "suggest": "", + "rule": "This keyword cannot be used as identifiers (arkts-invalid-identifier)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 3, + "endLine": 44, + "endColumn": 4, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 31, + "endLine": 42, + "endColumn": 54, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 19, + "endLine": 42, + "endColumn": 28, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 50, + "endLine": 42, + "endColumn": 54, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 31, + "endLine": 42, + "endColumn": 49, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 22, + "endLine": 43, + "endColumn": 40, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 24, + "endLine": 46, + "endColumn": 42, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 4, + "endLine": 21, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 4, + "endLine": 22, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 5, + "endLine": 25, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Navigation\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.json b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/node_api.ets b/ets2panda/linter/test/deprecatedapi/node_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..5e1932af73e10d644a935daf8142e3bcd77da2ce --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/node_api.ets @@ -0,0 +1,24 @@ +/* + * 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. + */ +import {XComponentType} from './sdk/api/enums' +@Entry +@Component +struct XComponentNodeExample { + build() { + Column() { + XComponent(XComponentType.NODE) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/node_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/node_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/node_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/node_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/node_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..e2ed9c2a93b7bcf0b68f02b1f142c3305662a9a1 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/node_api.ets.arkts2.json @@ -0,0 +1,68 @@ +{ + "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": 21, + "column": 33, + "endLine": 21, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 5, + "endLine": 20, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 7, + "endLine": 21, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"XComponent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/node_api.ets.json b/ets2panda/linter/test/deprecatedapi/node_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/node_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/ohos_animator.ets b/ets2panda/linter/test/deprecatedapi/ohos_animator.ets new file mode 100755 index 0000000000000000000000000000000000000000..30544f0142a52e321e37147d8c58fbb7eae60ead --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_animator.ets @@ -0,0 +1,30 @@ +/* + * 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. + */ + +import { Animator as animator, AnimatorOptions, AnimatorResult } from '@kit.ArkUI'; + +let options: AnimatorOptions = { + duration: 1500, + easing: "friction", + delay: 0, + fill: "forwards", + direction: "normal", + iterations: 3, + begin: 200.0, + end: 400.0, +}; +this.animator = animator.createAnimator(options); // error +let animatorResult: AnimatorResult = animator.create(options); +animatorResult.update(options); // error diff --git a/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.args.json b/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..004254eb4c1ba743ae16e96dd7c64bd17f17405a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.arkts2.json @@ -0,0 +1,58 @@ +{ + "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": 19, + "column": 13, + "endLine": 19, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 10, + "endLine": 21, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 15, + "endLine": 24, + "endColumn": 16, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 10, + "endLine": 16, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Animator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.json b/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_animator.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_curves.ets b/ets2panda/linter/test/deprecatedapi/ohos_curves.ets new file mode 100755 index 0000000000000000000000000000000000000000..4b8d21ca2c510d663890861a144a9d9d6f2cfce3 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_curves.ets @@ -0,0 +1,23 @@ +/* + * 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. + */ +import { curves } from '@kit.ArkUI'; + +class AnimationHelper { + steps() { + curves.steps(9, true); // error + } +} + +curves.spring(10, 1, 228, 30) // error \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.args.json b/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..cc2a63ae42f614da0232380e5636ad5de820f77f --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.arkts2.json @@ -0,0 +1,68 @@ +{ + "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": 19, + "column": 18, + "endLine": 19, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 15, + "endLine": 23, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 19, + "endLine": 23, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 22, + "endLine": 23, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 27, + "endLine": 23, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.json b/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_curves.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets b/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets new file mode 100755 index 0000000000000000000000000000000000000000..f5b77dfb5b28a5869dd2791fdf978b15be9e0e8a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets @@ -0,0 +1,50 @@ +/* + * 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. + */ + +import { matrix4 } from '@kit.ArkUI'; + +@Entry +@Component +struct Test { + private matrix1 = matrix4 + .scale({ + // error + x: 2, + y: 3, + z: 4, + centerX: 50, + centerY: 50 + }); + private originPoint: number[] = [50, 50]; + private transformPoint = matrix4.transformPoint([this.originPoint[0], this.originPoint[1]]); // error + private matrix2 = matrix4.identity().scale({ x: 2 }); + + build() { + Column() { + Text('Test') + .width("40%") + .height(100) + .transform(this.matrix1) + Text(`矩阵变换后的坐标:[${this.transformPoint}]`) + .fontSize(16) + .margin({ top: 100 }) + Text("test") + .transform(matrix4.combine(this.matrix2))// error + .width("40%") + .height(100) + .margin({ top: 50 }) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.args.json b/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..c3cf76ae53bf4d3ce63ea49c4c17ed5da474169e --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.arkts2.json @@ -0,0 +1,238 @@ +{ + "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": 21, + "column": 3, + "endLine": 29, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 10, + "endLine": 24, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 10, + "endLine": 25, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 10, + "endLine": 26, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 16, + "endLine": 27, + "endColumn": 18, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 16, + "endLine": 28, + "endColumn": 18, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 36, + "endLine": 30, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 40, + "endLine": 30, + "endColumn": 42, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 3, + "endLine": 31, + "endColumn": 95, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 3, + "endLine": 32, + "endColumn": 56, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 51, + "endLine": 32, + "endColumn": 52, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 17, + "endLine": 38, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 19, + "endLine": 41, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 24, + "endLine": 42, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 17, + "endLine": 46, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 24, + "endLine": 47, + "endColumn": 26, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 5, + "endLine": 35, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 7, + "endLine": 36, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 7, + "endLine": 40, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 7, + "endLine": 43, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.json b/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..336c0150b8a3f1496c3d317b9aaa4d7598c75242 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_matrix4.ets.json @@ -0,0 +1,48 @@ +{ + "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": 21, + "column": 3, + "endLine": 29, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 3, + "endLine": 31, + "endColumn": 95, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 3, + "endLine": 32, + "endColumn": 56, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets b/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets new file mode 100755 index 0000000000000000000000000000000000000000..dd82bbcdc35a7483e68edae1991675110ffb3dfd --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets @@ -0,0 +1,130 @@ +/* + * 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. + */ + +import prompt from '@ohos.prompt'; + +const toastOptions: prompt.ShowToastOptions = { + message: 'Message Info', //error + duration: 2000 +}; + +prompt.showDialog(toastOptions)//error + .then(data => { + console.info('showDialog success, click button: ' + data.index); + }) + .catch((err: Error) => { + console.info('showDialog error: ' + err); + }) + +const dialogOptions: prompt.ShowDialogOptions = { // error + title: 'Title Info', + message: 'Message Info' +}; + +prompt.showDialog(dialogOptions)// error + .then(data => { + console.info('showDialog success'); + }) + +prompt.showDialog({ + title: 'showDialog Title Info', // error + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000' + }, + { + text: 'button2', + color: '#000000' + } + ] +}, (err, data) => { + if (err) { + console.info('showDialog err: ' + err); + return; + } + console.info('showDialog success callback, click button: ' + data.index); // error +}); +prompt.showActionMenu({ + title: 'Title Info', + buttons: [// error + { + text: 'button1', + color: '#000000' + }, + { + text: 'button2', + color: '#000000' + } + ], +}) + .then(data => { + console.info('showActionMenu success, click button: ' + data.index); + }) + .catch((err: Error) => { + console.info('showActionMenu error: ' + err); + }) + +const button: prompt.Button = { + text: 'test', + color: 'red' // error +}; + +prompt.showDialog({ + title: 'Title Info', + message: 'Message Info', + buttons: [button], +}) + .then(data => { + console.info('showDialog success, click button: ' + data.index); + }) + .catch((err: Error) => { + console.info('showDialog error: ' + err); + }) + +prompt.showToast({ // error + message: 'Message Info', + duration: 2000 +}); + +let response: Promise = prompt.showDialog({ // error + title: 'Title Info', + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000' + }, + { + text: 'button2', + color: '#000000' + } + ], +}) + .then(data => { + console.info('showDialog success, click button: ' + data.index); + return data; + }) + .catch((err: Error) => { + console.info('showDialog error: ' + err); + throw err; + }); + +prompt.showToast({ // error + message: 'Message Info', + duration: 2000 +}); + diff --git a/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.args.json b/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..a77d3677c30d54dad1b9c7c1fb444ca86e2873b6 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.arkts2.json @@ -0,0 +1,128 @@ +{ + "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": 20, + "column": 13, + "endLine": 20, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 9, + "endLine": 24, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 9, + "endLine": 37, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 5, + "endLine": 54, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 10, + "endLine": 54, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 9, + "endLine": 74, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 91, + "column": 9, + "endLine": 91, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 100, + "column": 13, + "endLine": 100, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 9, + "endLine": 120, + "endColumn": 4, + "problem": "LimitedReturnTypeInference", + "suggest": "", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 9, + "endLine": 117, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 128, + "column": 13, + "endLine": 128, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.json b/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..642f794c6c14c1c3e865b2e2ca66083f1b4f93e7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_prompt.ets.json @@ -0,0 +1,98 @@ +{ + "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": 24, + "column": 9, + "endLine": 24, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 9, + "endLine": 37, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 5, + "endLine": 54, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 10, + "endLine": 54, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 9, + "endLine": 74, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 91, + "column": 9, + "endLine": 91, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 9, + "endLine": 120, + "endColumn": 4, + "problem": "LimitedReturnTypeInference", + "suggest": "", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 9, + "endLine": 117, + "endColumn": 13, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_router.ets b/ets2panda/linter/test/deprecatedapi/ohos_router.ets new file mode 100755 index 0000000000000000000000000000000000000000..ae611f9ff3fd531d665d86b222a9b1c635f40421 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_router.ets @@ -0,0 +1,35 @@ +/* + * 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. + */ + +import router from '@ohos.router'; + +router.enableAlertBeforeBackPage({ // error + message: 'Message Info' +}); + +class routerParams { + data1: string; + + constructor(str: string) { + this.data1 = str; + } +} + +router.replace({ // error + url: 'pages/detail', + params: new routerParams('message') +}); + +router.disableAlertBeforeBackPage(); // error \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_router.ets.args.json b/ets2panda/linter/test/deprecatedapi/ohos_router.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_router.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/ohos_router.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/ohos_router.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_router.ets.arkts2.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/ohos_router.ets.json b/ets2panda/linter/test/deprecatedapi/ohos_router.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/ohos_router.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..bf817a2f4843d7eef5ce101db9799348ea58f9c6 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets @@ -0,0 +1,41 @@ +/* + * 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. + */ +import {PanelMode} from './sdk/api/panel'; + +@Entry +@Component +struct PanelExample { + @State show: boolean = false + + build() { + Column() { + Panel(this.show) { + Column() { + } + } + .mode(PanelMode.Mini) //error + Panel(this.show) { + Column() { + } + } + .mode(PanelMode.Half) //error + Panel(this.show) { + Column() { + } + } + .mode(PanelMode.Full) //error + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..14b1f5d64ed0337c3e6cf82d87d38534c143dd7d --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json @@ -0,0 +1,178 @@ +{ + "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": 28, + "column": 13, + "endLine": 28, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 23, + "endLine": 28, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 13, + "endLine": 33, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 23, + "endLine": 33, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 13, + "endLine": 38, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 23, + "endLine": 38, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 9, + "endLine": 25, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 7, + "endLine": 29, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 9, + "endLine": 30, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 7, + "endLine": 34, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 9, + "endLine": 35, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.json b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..a15ecce3cf2b761577d6397d9089a1d2af58e15e --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets @@ -0,0 +1,18 @@ +/* + * 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. + */ +import { PersistentStorage } from './sdk/api/common_ts_ets_api'; + +PersistentStorage.PersistProps([{ key: 'highScore', defaultValue: '0' }, { key: 'wightScore', defaultValue: '1' }]); //error +PersistentStorage.Keys(); //error \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..61e8ea37dee70895b1bd001f176eee32fac878c5 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "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": 19, + "endLine": 17, + "endColumn": 31, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 19, + "endLine": 18, + "endColumn": 23, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.json b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/progress.ets b/ets2panda/linter/test/deprecatedapi/progress.ets new file mode 100755 index 0000000000000000000000000000000000000000..523cdab0b9967e71bed8105324fb99506d3a6a8a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/progress.ets @@ -0,0 +1,36 @@ +/* + * 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. + */ + +@Entry +@Component +struct ProgressExample { + private gradientColor: LinearGradient = new LinearGradient([{ color: Color.Yellow, offset: 0.5 }, + { color: Color.Orange, offset: 1.0 }]) + private progress: ProgressOptions = { + value: 70, + total: 100, + type: ProgressType.Ring, + style: ProgressStyle.Linear // error + }; + + build() { + Column({ space: 15 }) { + Text('Gradient Color').fontSize(9).fontColor(0xCCCCCC).width('90%') + Progress(this.progress) + .width(100).style({ strokeWidth: 20 }) + .color(this.gradientColor) + }.width('100%').padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/progress.ets.args.json b/ets2panda/linter/test/deprecatedapi/progress.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/progress.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/progress.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/progress.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..474b79dc90ca81532da347bba409e01c285b7862 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/progress.ets.arkts2.json @@ -0,0 +1,248 @@ +{ + "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": 19, + "column": 26, + "endLine": 19, + "endColumn": 40, + "problem": "DuplicateDeclNameFromSdk", + "suggest": "", + "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 47, + "endLine": 19, + "endColumn": 61, + "problem": "DuplicateDeclNameFromSdk", + "suggest": "", + "rule": "API path have changed - please update your imports accordingly (sdk-no-decl-with-duplicate-name)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 47, + "endLine": 19, + "endColumn": 61, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 12, + "endLine": 22, + "endColumn": 14, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 12, + "endLine": 23, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 21, + "endLine": 29, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 39, + "endLine": 30, + "endColumn": 40, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 16, + "endLine": 32, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 42, + "endLine": 32, + "endColumn": 44, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 36, + "endLine": 34, + "endColumn": 37, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 26, + "endLine": 19, + "endColumn": 40, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"LinearGradient\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 47, + "endLine": 19, + "endColumn": 61, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"LinearGradient\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 72, + "endLine": 19, + "endColumn": 77, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Color\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 14, + "endLine": 20, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Color\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 21, + "endLine": 21, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ProgressOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 37, + "endLine": 21, + "endColumn": 49, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ProgressType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 11, + "endLine": 24, + "endColumn": 23, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ProgressType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 12, + "endLine": 25, + "endColumn": 25, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ProgressStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 5, + "endLine": 29, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 7, + "endLine": 30, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 7, + "endLine": 31, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Progress\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/progress.ets.json b/ets2panda/linter/test/deprecatedapi/progress.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/progress.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/prompts_api.ets b/ets2panda/linter/test/deprecatedapi/prompts_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..c6f549d289635b8e3271dbdc7553da18cb93b824 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/prompts_api.ets @@ -0,0 +1,73 @@ +/* + * 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. + */ +import prompt from './sdk/api/@ohos.prompt' + +prompt.showToast({ + message: 'www', + duration: 2000, + bottom: 20, +}); + +prompt.showDialog({ + title: 'Title Info', + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000' + }, + ], +}) + +prompt.showActionMenu({ + title: 'Title Info', + buttons: [ + { + text: 'item1', + color: '#666666' + }, + { + text: 'item2', + color: '#000000' + }, + ] +}, (err, data) => { + if (err) { + console.info('showActionMenu err: ' + err); + return; + } + console.info('showActionMenu success callback, click button: ' + data.index); +}) + +prompt.showDialog({ + title: 'showDialog Title Info', + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000' + }, + { + text: 'button2', + color: '#000000' + } + ] +}, (err, data) => { + if (err) { + console.info('showDialog err: ' + err); + return; + } + console.info('showDialog success callback, click button: ' + data.index); +}); \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/prompts_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/prompts_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/prompts_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/prompts_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/prompts_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..948a10579177affdf4176c29dd822e8b021bebd9 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/prompts_api.ets.arkts2.json @@ -0,0 +1,248 @@ +{ + "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": 8, + "endLine": 17, + "endColumn": 17, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 3, + "endLine": 18, + "endColumn": 10, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 3, + "endLine": 19, + "endColumn": 11, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 13, + "endLine": 19, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 3, + "endLine": 20, + "endColumn": 9, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 11, + "endLine": 20, + "endColumn": 13, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 8, + "endLine": 23, + "endColumn": 18, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 3, + "endLine": 24, + "endColumn": 8, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 3, + "endLine": 25, + "endColumn": 10, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 7, + "endLine": 29, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 8, + "endLine": 34, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 3, + "endLine": 36, + "endColumn": 10, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 7, + "endLine": 39, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 7, + "endLine": 43, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 5, + "endLine": 46, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 10, + "endLine": 46, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 54, + "column": 8, + "endLine": 54, + "endColumn": 18, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 3, + "endLine": 55, + "endColumn": 8, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 3, + "endLine": 56, + "endColumn": 10, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 7, + "endLine": 60, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 64, + "column": 7, + "endLine": 64, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 5, + "endLine": 67, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 10, + "endLine": 67, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/prompts_api.ets.json b/ets2panda/linter/test/deprecatedapi/prompts_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..bf8516a85b5a1242ca48f44d05087ec3ee41f55c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/prompts_api.ets.json @@ -0,0 +1,58 @@ +{ + "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": 46, + "column": 5, + "endLine": 46, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 10, + "endLine": 46, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 5, + "endLine": 67, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 10, + "endLine": 67, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/refresh.ets b/ets2panda/linter/test/deprecatedapi/refresh.ets new file mode 100644 index 0000000000000000000000000000000000000000..f58c225b7c6e748e4cf0ac5c7b53abbe59c409f5 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/refresh.ets @@ -0,0 +1,66 @@ +/* + * 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. + */ + +@Entry +@Component +struct RefreshExample { + @State isRefreshing: boolean = false; + @State promptText: string = "Refreshing..."; + @State arr: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']; + + + build() { + Column() { + Refresh({ refreshing: $$this.isRefreshing, offset: 1 }) { //error + List() { + ForEach(this.arr, (item: string) => { + ListItem() { + Text('' + item) + .width('70%') + .height(80) + .fontSize(16) + .margin(10) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + } + }, (item: string) => item) + } + .onScrollIndex((first: number) => { + console.info(first.toString()); + }) + .width('100%') + .height('100%') + .alignListItem(ListItemAlign.Center) + .scrollBar(BarState.Off) + } + .backgroundColor(0x89CFF0) + .pullToRefresh(true) + .refreshOffset(96) + .onStateChange((refreshStatus: RefreshStatus) => { + console.info('Refresh onStatueChange state is ' + refreshStatus); + }) + .onOffsetChange((value: number) => { + console.info('Refresh onOffsetChange offset:' + value); + }) + .onRefreshing(() => { + setTimeout(() => { + this.isRefreshing = false; + }, 2000) + console.log('onRefreshing test'); + }) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/refresh.ets.json b/ets2panda/linter/test/deprecatedapi/refresh.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/refresh.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..542dae4405efc784596a00e80d41e97e2be54f43 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets @@ -0,0 +1,53 @@ +/* + * 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. + */ +import Router from './sdk/api/@system.router'; + +class Z{ + disableAlertBeforeBackPage() { + Router.disableAlertBeforeBackPage({ + success: () => { + console.log('success'); + }, + cancel: () => { + console.log('cancel'); + }, + complete: () => { + console.log('cancel'); + } + }); + } +} +export default new Z() + +class C{ + replacePage() { + Router.replace({ + uri: 'pages/detail/detail', + params: { + data1: 'message' + } + }); + } +} +export default new C() + +class I{ + clearPage() { + Router.clear(); + } +} +export default new I() + +Router \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..09884303b52f5cf0de482cc38402cd9032d67284 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 19, + "column": 12, + "endLine": 19, + "endColumn": 38, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 7, + "endLine": 20, + "endColumn": 14, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 7, + "endLine": 26, + "endColumn": 15, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 12, + "endLine": 36, + "endColumn": 19, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 7, + "endLine": 37, + "endColumn": 10, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 7, + "endLine": 38, + "endColumn": 13, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 12, + "endLine": 48, + "endColumn": 17, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 53, + "column": 1, + "endLine": 53, + "endColumn": 7, + "problem": "ClassAsObjectError", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.json b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..bc846022c12b599c5a2bb361e32514e403fa3d3d --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.json @@ -0,0 +1,28 @@ +{ + "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": 53, + "column": 1, + "endLine": 53, + "endColumn": 7, + "problem": "ClassAsObject", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "WARNING" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets b/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..0a37728e9f10164a45fd3a1f232fc03003351f47 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets @@ -0,0 +1,22 @@ +/* + * 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. + */ +import router from './sdk/api/@system.router'; + +class H{ + backToDetail() { + router.back({uri:'pages/detail/detail'}); + } +} +export default new H() \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.arkts2.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.json b/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerOptionsUri_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerPush_api.ets b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..e8b1028e9481c37aa5c25a1a42b54ca6116c1c78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets @@ -0,0 +1,38 @@ +/* + * 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. + */ +import { router } from './sdk/api/@ohos.router'; + +class innerParams { + data3: number[]; + + constructor(tuple: number[]) { + this.data3 = tuple; + } +} + +class routerParams { + data1: string; + data2: innerParams; + + constructor(str: string, tuple: number[]) { + this.data1 = str; + this.data2 = new innerParams(tuple); + } +} + +router.push({ + url: 'pages/routerpage2', + params: new routerParams('message', [123, 456, 789]) +}); \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..f0f575da71d5248e1158365366f8cf6f4df24e44 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.arkts2.json @@ -0,0 +1,58 @@ +{ + "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": 35, + "column": 8, + "endLine": 35, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 40, + "endLine": 37, + "endColumn": 43, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 45, + "endLine": 37, + "endColumn": 48, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 50, + "endLine": 37, + "endColumn": 53, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.json b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets b/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..8bc04f1c264c776d0ee6e858b77dce9d0c025b20 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets @@ -0,0 +1,22 @@ +/* + * 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. + */ +import RouterState from './sdk/api/@system.router'; + +class K{ + getState() { + let page = RouterState.getState().index; + } +} +export default new K() \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..bd4e05e281364c8da7fbd022427d8660f057aefa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.arkts2.json @@ -0,0 +1,28 @@ +{ + "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": 19, + "column": 9, + "endLine": 19, + "endColumn": 44, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.json b/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..bd4e05e281364c8da7fbd022427d8660f057aefa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/routerStateIndex_api.ets.json @@ -0,0 +1,28 @@ +{ + "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": 19, + "column": 9, + "endLine": 19, + "endColumn": 44, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/scroll_api.ets b/ets2panda/linter/test/deprecatedapi/scroll_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..0e584adaccb79dfd4d8327c19cb656f8e56df46b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/scroll_api.ets @@ -0,0 +1,30 @@ +/* + * 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. + */ +import {ScrollDirection,Scroller,ScrollAttribute} from './sdk/api/scroll'; + +const scroller: Scroller = new Scroller() +@Entry +@Component +struct ScrollExample { + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(scroller) + .scrollable(ScrollDirection.Free) //error + Column() { + }.width('100%') + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/scroll_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/scroll_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/scroll_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/scroll_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/scroll_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..f32e2bf1c3875937214427864c21697b2fc00082 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/scroll_api.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "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": 25, + "column": 37, + "endLine": 25, + "endColumn": 41, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Stack\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 27, + "endLine": 23, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Alignment\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroll\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 9, + "endLine": 26, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/scroll_api.ets.json b/ets2panda/linter/test/deprecatedapi/scroll_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/scroll_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.animator.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.animator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3fea7915eac8a117c22f118e80e9b8c2cb50bf0e --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.animator.d.ts @@ -0,0 +1,72 @@ +/* + * 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. + */ + +export declare class Animator { + static createAnimator(options: AnimatorOptions): AnimatorResult; + static create(options: AnimatorOptions): AnimatorResult; +} + +export interface AnimatorOptions { + duration: number; + easing: string; + delay: number; + fill: "none" | "forwards" | "backwards" | "both"; + direction: "normal" | "reverse" | "alternate" | "alternate-reverse"; + iterations: number; + begin: number; + end: number; +} + +export interface AnimatorResult { + update(options: AnimatorOptions): void; + reset(options: AnimatorOptions): void; + reset(options: AnimatorOptions | SimpleAnimatorOptions): void; + play(): void; + finish(): void; + pause(): void; + cancel(): void; + reverse(): void; + onframe: (progress: number) => void; + onFrame: (progress: number) => void; + onfinish: () => void; + onFinish: () => void; + oncancel: () => void; + onCancel: () => void; + onrepeat: () => void; + onRepeat: () => void; + setExpectedFrameRateRange(rateRange: ExpectedFrameRateRange): void; +} + +export declare class SimpleAnimatorOptions { + duration(duration: number): SimpleAnimatorOptions; + easing(curve: string): SimpleAnimatorOptions; + delay(delay: number): SimpleAnimatorOptions; + fill(fillMode: FillMode): SimpleAnimatorOptions; + direction(direction: PlayMode): SimpleAnimatorOptions; + iterations(iterations: number): SimpleAnimatorOptions; +} + +declare enum PlayMode { + Normal, + Reverse, + Alternate, + AlternateReverse +} + +declare interface ExpectedFrameRateRange { + min: number; + max: number; + expected: number; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.curves.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.curves.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..8d7164186ce16777d6ebc2f398c765abbc41d631 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.curves.d.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export declare namespace curves { + function init(curve?: Curve): string; +} diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.font.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.font.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..d8a7e565ce3b06649db971abadab352a0dbebab4 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.font.d.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ +export declare namespace font { + function getFontByName(fontName: string): FontInfo; + function getSystemFontList(): Array; + function registerFont(options: FontOptions): void; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.matrix4.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.matrix4.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..29f253a989d28078c193956f21a11690401d0a65 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.matrix4.d.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ + +export declare namespace matrix4 { + function rotate(options: RotateOption): Matrix4Transit; + function copy(): Matrix4Transit; + function translate(options: TranslateOption): Matrix4Transit; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.prompt.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.prompt.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..d8a0fae2aac6e8af4a52dc294f23fe187d28f284 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.prompt.d.ts @@ -0,0 +1,58 @@ +/* + * 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. + */ +declare namespace prompt { + + interface ShowToastOptions { + message: string; + duration?: number; + bottom?: string | number; + } + interface Button { + text: string; + color: string; + } + interface ShowDialogSuccessResponse { + index: number; + } + interface ShowDialogOptions { + title?: string; + message?: string; + buttons?: [ + Button, + Button?, + Button? + ]; + } + interface ActionMenuSuccessResponse { + index: number; + } + interface ActionMenuOptions { + title?: string; + buttons: [ + Button, + Button?, + Button?, + Button?, + Button?, + Button? + ]; + } + function showToast(options: ShowToastOptions): void; + function showDialog(options: ShowDialogOptions, callback: AsyncCallback): void; + function showDialog(options: ShowDialogOptions): Promise; + function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback): void; + function showActionMenu(options: ActionMenuOptions): Promise; +} +export default prompt; diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.router.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.router.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..9c2e6dc51a3b83ba737b17072cac18e4d678398d --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@ohos.router.d.ts @@ -0,0 +1,23 @@ +/* + * 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. + */ + +export declare namespace router { + function push(options: RouterOptions): void; +} + +export interface BackRouterOptions { + uri?: string; + params?: Object; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@system.app.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@system.app.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..274e07311ccd4ebbf7d5ce242853d3012a68b401 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@system.app.d.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ +export default class App { + static setImageCacheCount(value: number): void; + static setImageRawDataCacheSize(value: number): void; + static setImageFileCacheSize(value: number): void; + static screenOnVisible(options?: ScreenOnVisibleOptions): void; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@system.prompt.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@system.prompt.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..cf2a916ea8b3603fc88e2f50f42a4853f197e6e5 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@system.prompt.d.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ +export default class Prompt { + static showToast(options: ShowToastOptions): void; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/@system.router.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/@system.router.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..771cd691992e9241b0a0f94cecca58e5bd9d2fdf --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/@system.router.d.ts @@ -0,0 +1,37 @@ +/* + * 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. + */ + +export default class Router { + static enableAlertBeforeBackPage(options: EnableAlertBeforeBackPageOptions): void; + static disableAlertBeforeBackPage(options?: DisableAlertBeforeBackPageOptions): void; + static replace(options: RouterOptions): void; + static clear(): void; +} + +export interface DisableAlertBeforeBackPageOptions { + success?: (errMsg: string) => void; + complete?: () => void; +} + +export interface RouterState { + index: number; + name: string; + path: string; +} + +export interface RouterOptions { + uri: string; + params?: Object; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/ChipGroup.d.ets b/ets2panda/linter/test/deprecatedapi/sdk/api/ChipGroup.d.ets new file mode 100644 index 0000000000000000000000000000000000000000..552b88513cf344f80c93b4409b36e817285e9fd1 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/ChipGroup.d.ets @@ -0,0 +1,17 @@ +/* + * 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. + */ +export interface ChipGroupItemOptions { + suffixIcon?: IconOptions; +} diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/action_sheet.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/action_sheet.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ad8ab60c94222eab5c432cbaaec1cf171730974 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/action_sheet.d.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ + +export interface ActionSheetOptions { + autoCancel?: boolean; + showInSubWindow?: boolean; + isModal?: boolean; +} + +export declare class ActionSheet { + static show(value: ActionSheetOptions); +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/alert_dialog.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/alert_dialog.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a26a6671d472ddf5d82fb800d2ed4e456975739b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/alert_dialog.d.ts @@ -0,0 +1,39 @@ +/* + * 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. + */ + +export declare class AlertDialog { + static show(value: AlertDialogParamWithConfirm | AlertDialogParamWithButtons | AlertDialogParamWithOptions); +} + +declare interface AlertDialogParamWithConfirm extends AlertDialogParam { + confirm?: AlertDialogButtonBaseOptions; +} + +declare interface AlertDialogParamWithButtons extends AlertDialogParam { + primaryButton: AlertDialogButtonBaseOptions; + secondaryButton: AlertDialogButtonBaseOptions; +} + +declare interface AlertDialogParamWithOptions extends AlertDialogParam { + buttons: Array; +} + +declare interface AlertDialogButtonBaseOptions {} + +declare interface AlertDialogParam {} + +declare interface AlertDialogButtonOptions extends AlertDialogButtonBaseOptions { + primary?: boolean; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/common.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/common.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..ab9ed204bd66018bf38960d81ae116ca120c54ac --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/common.d.ts @@ -0,0 +1,31 @@ +/* + * 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. + */ + +export declare interface CustomPopupOptions { + maskColor?: Color | string | Resource | number; +} + +export declare interface DragEvent { + getX(): number; + getY(): number; +} +declare class CommonMethod { + gridSpan(value: number): T; + gridOffset(value: number): T; +} +export declare interface LayoutInfo {} +export declare interface LayoutChild {} +export declare interface LayoutBorderInfo {} +export declare interface TransitionOptions {} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/common_ts_ets_api.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/common_ts_ets_api.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4498350f03186a2debad00175b32cd533f56ba7f --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/common_ts_ets_api.d.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +export declare class LocalStorage { + constructor(initializingProperties?: Object); + static getShared(): LocalStorage; +} + +export declare class Environment { + static EnvProp(key: string, value: S): boolean; + static Keys(): Array; + static EnvProps(props: { + key: string; + defaultValue: any; + }[]): void; +} + +export declare class AppStorage { + static IsMutable(propName: string): boolean; + static Get(propName: string): T | undefined; + static Clear(): boolean; + static Delete(propName: string): boolean; + static Size(): number; +} + +export declare class PersistentStorage { + static PersistProps(properties: { + key: string; + defaultValue: any; + }[]): void; + static Keys(): Array; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/enums.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/enums.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..f08eae1aea29c05b534457210c81d5a22c6619bb --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/enums.d.ts @@ -0,0 +1,21 @@ +/* + * 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. + */ + +export declare enum XComponentType { + SURFACEE, + COMPONENT, + TEXTURE, + NODE +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/grid.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/grid.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..49c677c793dfb970977a3ffeca4e5c178e0fffa4 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/grid.d.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export declare class GridAttribute extends ScrollableCommonMethod { + onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): GridAttribute; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/grid_container.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/grid_container.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..6cbc689ddd628a95391cfd57e7ecb9566b1d0580 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/grid_container.d.ts @@ -0,0 +1,37 @@ +/* + * 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. + */ + +export interface GridContainerInterface { + + (value?: GridContainerOptions): GridContainerAttribute; +} + +export declare class GridContainerAttribute extends ColumnAttribute { +} + +export declare enum SizeType { + Auto, + XS, + SM, + MD, + LG +} + +export declare interface GridContainerOptions { + columns?: number | "auto"; + sizeType?: SizeType; + gutter?: number | string; + margin?: number | string; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/list_item.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/list_item.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d8394f36bafdd354579db5e49ae75729d7047f35 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/list_item.d.ts @@ -0,0 +1,31 @@ +/* + * 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. + */ + +export declare class ListItemAttribute extends CommonMethod { + sticky(value: Sticky): ListItemAttribute; + editable(value: boolean | EditMode): ListItemAttribute; +} + +export declare enum Sticky { + None, + Normal, + Opacity +} + +export declare enum EditMode { + None, + Deletable, + Movable +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/nav_router.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/nav_router.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ddce579ce4cdf1ce5b613b2143b67ee8e921bb63 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/nav_router.d.ts @@ -0,0 +1,38 @@ +/* + * 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. + */ + +export declare const NavRouterInstance: NavRouterAttribute; +export declare const NavRouter: NavRouterInterface; + +export declare class NavRouterAttribute extends CommonMethod { + mode(mode: NavRouteMode): NavRouterAttribute; + onStateChange(callback: (isActivated: boolean) => void): NavRouterAttribute; +} + +export declare enum NavRouteMode{ + PUSH_WITH_RECREATE, + PUSH, + REPLACE +} + +export declare interface NavRouterInterface { + (): NavRouterAttribute + (value: RouteInfo): NavRouterAttribute; +} + +export declare interface RouteInfo { + name: string; + param?: unknown; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/navigator.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/navigator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a9894459b38b9fa1d352eab3f6e0ae084faa56c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/navigator.d.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ + +export declare const NavigatorInstance: NavigatorAttribute; +export declare const Navigator: NavigatorInterface; + +export declare class NavigatorAttribute extends CommonMethod { + active(value: boolean): NavigatorAttribute; + type(value: NavigationType): NavigatorAttribute; + target(value: string): NavigatorAttribute; + params(value: object): NavigatorAttribute; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/panel.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/panel.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..b011566efad9aec0da31ebd343302136d239738f --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/panel.d.ts @@ -0,0 +1,29 @@ +/* + * 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. + */ + +export declare enum PanelHeight { + WRAP_CONTENT = 'wrapContent' +} +export declare enum PanelType { + Minibar = 0, + Foldable = 1, + Temporary = 2, + CUSTOM = 3 +} +export declare enum PanelMode { + Mini, + Half, + Full +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/scroll.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/scroll.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96bb53c6482b7d53a7ee4311430a9cf73ed85bb2 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/scroll.d.ts @@ -0,0 +1,32 @@ +/* + * 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. + */ + +export declare class ScrollAttribute extends ScrollableCommonMethod { + onScroll(event: (xOffset: number, yOffset: number) => void): ScrollAttribute; + onScrollEnd(event: () => void): ScrollAttribute; +} + +export declare enum ScrollDirection { + Vertical, + Horizontal, + Free, + None +} +export declare class Scroller{ + scrollPage(value: { + next: boolean; + direction?: Axis; + }); +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/slider.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/slider.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f2aae70dd88065d93815de2de9480f26f4557d78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/slider.d.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ +export declare class SliderAttribute extends CommonMethod { + minLabel(value: string): SliderAttribute; + maxLabel(value: string): SliderAttribute; +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sdk/api/swiper.d.ts b/ets2panda/linter/test/deprecatedapi/sdk/api/swiper.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c33e754d3ab49d627939ac10257d55e2b197abb --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sdk/api/swiper.d.ts @@ -0,0 +1,35 @@ +/* + * 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. + */ + +export declare interface IndicatorStyle { + left?: Length; + top?: Length; + right?: Length; + bottom?: Length; + size?: Length; + mask?: boolean; + color?: ResourceColor; + selectedColor?: ResourceColor; +} +export declare class SwiperAttribute extends CommonMethod { + indicatorStyle(value?: IndicatorStyle): SwiperAttribute; +} + +export declare enum SwiperDisplayMode { + Stretch, + AutoLinear, + STRETCH, + AUTO_LINEAR +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..2adcbc65c5e9e47fa498a1e5ee11cbb438e674fd --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets @@ -0,0 +1,21 @@ +/* + * 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. + */ +import App from './sdk/api/@system.app'; + +export default class Req { + requestFullWindow() { + App.setImageCacheCount(104857600); + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..d53d7bd350bf64c8d86436d990c5a6aca459e6de --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "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": 19, + "column": 9, + "endLine": 19, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 28, + "endLine": 19, + "endColumn": 37, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.json b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..d391c2718ccca26b50f16cf76512cefc4705b5c0 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets @@ -0,0 +1,21 @@ +/* + * 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. + */ +import App from './sdk/api/@system.app'; + +export default class Req { + requestFullWindow() { + App.setImageFileCacheSize(104857600); + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..5f505ff2ec724a5d3fd88615cb5227a72b7c65be --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "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": 19, + "column": 9, + "endLine": 19, + "endColumn": 30, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 31, + "endLine": 19, + "endColumn": 40, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.json b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..8e717bba1fb9c70ec174ba47feafac997e8dd6ad --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets @@ -0,0 +1,21 @@ +/* + * 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. + */ +import App from './sdk/api/@system.app'; + +export default class Req { + requestFullWindow() { + App.setImageRawDataCacheSize(104857600); + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ea7d95ceec648ca7c330ae7cae8b137c45f47aec --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "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": 19, + "column": 9, + "endLine": 19, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 34, + "endLine": 19, + "endColumn": 43, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.json b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/shortName.ets b/ets2panda/linter/test/deprecatedapi/shortName.ets new file mode 100755 index 0000000000000000000000000000000000000000..a51ac48ceb7d93ead8aea6e9cbf39e76a91c84b7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/shortName.ets @@ -0,0 +1,19 @@ +/* + * 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. + */ +import { ElementName } from './sdk/api/elementName'; + +funtion a() { + console.log(ElementName.shortName) +} diff --git a/ets2panda/linter/test/deprecatedapi/shortName.ets.args.json b/ets2panda/linter/test/deprecatedapi/shortName.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/shortName.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/shortName.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/shortName.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/shortName.ets.arkts2.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/shortName.ets.json b/ets2panda/linter/test/deprecatedapi/shortName.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/shortName.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/showActionMenu.ets b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets new file mode 100755 index 0000000000000000000000000000000000000000..543db4aed1d7d5f0430132be6de1ae4a9c348768 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets @@ -0,0 +1,52 @@ +/* + * 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. + */ +import prompt from './sdk/api/@ohos.prompt'; + + +prompt.showActionMenu({ + title: 'Title Info', + buttons: [ + { + text: 'item1', + color: '#666666' + }, + { + text: 'item2', + color: '#000000' + }, + ] +}, (err, data) => { + if (err) { + console.info('showActionMenu err: ' + err); + return; + } + console.info('showActionMenu success callback, click button: ' + data.index); +}) + +prompt.showActionMenu({ + title: 'Title Info', + buttons: [ + { + text: 'item1', + color: '#666666' + }, + { + text: 'item2', + color: '#000000' + }, + ] +}).then(()=>{ + +}) \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.args.json b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..b44f2449617b1c6218a3775622194c04a81f140f --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.arkts2.json @@ -0,0 +1,118 @@ +{ + "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, + "column": 8, + "endLine": 18, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 3, + "endLine": 20, + "endColumn": 10, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 7, + "endLine": 27, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 5, + "endLine": 30, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 10, + "endLine": 30, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 8, + "endLine": 38, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 3, + "endLine": 40, + "endColumn": 10, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 7, + "endLine": 43, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 7, + "endLine": 47, + "endColumn": 12, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.json b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..496f2c021f17b4c85cd1fe5c601d30e5686c36e9 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.json @@ -0,0 +1,38 @@ +{ + "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": 30, + "column": 5, + "endLine": 30, + "endColumn": 8, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 10, + "endLine": 30, + "endColumn": 14, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/showToast_api.ets b/ets2panda/linter/test/deprecatedapi/showToast_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..a59df53bff76a6fa7a1da5fc6c3fdde2df680c97 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/showToast_api.ets @@ -0,0 +1,22 @@ +/* + * 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. + */ +import Prompt from "./sdk/api/@system.prompt" +class A{ + showToast() { + Prompt.showToast({ + message: 'Message Info', + }); + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/showToast_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/showToast_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/showToast_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/showToast_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/showToast_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..9f33816e3cec28049daae4692712ce23c2a5b084 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/showToast_api.ets.arkts2.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/showToast_api.ets.json b/ets2panda/linter/test/deprecatedapi/showToast_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f33816e3cec28049daae4692712ce23c2a5b084 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/showToast_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/sizeType.ets b/ets2panda/linter/test/deprecatedapi/sizeType.ets new file mode 100755 index 0000000000000000000000000000000000000000..ec52efea3e623cf9c7eb7b31292ae6d64b61a3ce --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sizeType.ets @@ -0,0 +1,45 @@ +/* + * 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. + */ +import { SizeType } from './sdk/api/grid_container' + +@Entry +@Component +struct GridContainerExample { + @State sizeType: SizeType = SizeType.XS + + build() { + Column({ space: 5 }) { + Text('Click Simulate to change the device width').fontSize(9).width('90%').fontColor(0xCCCCCC) + Row() { + Button('XS') + .onClick(() => { + this.sizeType = SizeType.XS + }).backgroundColor(0x317aff) + Button('SM') + .onClick(() => { + this.sizeType = SizeType.SM + }).backgroundColor(0x317aff) + Button('MD') + .onClick(() => { + this.sizeType = SizeType.MD + }).backgroundColor(0x317aff) + Button('LG') + .onClick(() => { + this.sizeType = SizeType.LG + }).backgroundColor(0x317aff) + } + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sizeType.ets.args.json b/ets2panda/linter/test/deprecatedapi/sizeType.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sizeType.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sizeType.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/sizeType.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..d3824f7d72530407fa1d0a5e53e9cdf686a39cc1 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sizeType.ets.arkts2.json @@ -0,0 +1,248 @@ +{ + "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": 20, + "column": 31, + "endLine": 20, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 40, + "endLine": 20, + "endColumn": 42, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 21, + "endLine": 23, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 66, + "endLine": 24, + "endColumn": 67, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 29, + "endLine": 28, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 38, + "endLine": 28, + "endColumn": 40, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 29, + "endLine": 32, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 38, + "endLine": 32, + "endColumn": 40, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 29, + "endLine": 36, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 38, + "endLine": 36, + "endColumn": 40, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 29, + "endLine": 40, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 38, + "endLine": 40, + "endColumn": 40, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 35, + "endLine": 43, + "endColumn": 36, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 7, + "endLine": 25, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 9, + "endLine": 26, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 9, + "endLine": 30, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 9, + "endLine": 34, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 9, + "endLine": 38, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sizeType.ets.json b/ets2panda/linter/test/deprecatedapi/sizeType.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sizeType.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..9f6cc8207dfe58be5217f4abed9573cf2c3d7a64 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ +import {SizeType} from './sdk/api/grid_container'; + +@Entry +@Component +struct ResponsiveExample { + @StorageLink('currentSizeType') currentSizeType: SizeType = SizeType.SM; + + build() { + Column() { + if (this.currentSizeType === SizeType.XS) { + } + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..969b9eb44b53b8bd38a164e1786f39e7e95d0428 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 20, + "column": 63, + "endLine": 20, + "endColumn": 71, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 72, + "endLine": 20, + "endColumn": 74, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 36, + "endLine": 24, + "endColumn": 44, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 45, + "endLine": 24, + "endColumn": 47, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"StorageLink\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.json b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/slider_api.ets b/ets2panda/linter/test/deprecatedapi/slider_api.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ec3620c2eb0995594f53b65e0a6179d1911ae52 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/slider_api.ets @@ -0,0 +1,30 @@ +/* + * 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. + */ +import {SliderAttribute} from './sdk/api/slider'; + +@Entry +@Component +struct SliderExample { + build() { + Column({ space: 8 }) { + Row() { + Slider() + .minLabel('aa') //error + .maxLabel('bb') //error + } + .width('100%') + }.width('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/slider_api.ets.json b/ets2panda/linter/test/deprecatedapi/slider_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/slider_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/swiper_api.ets b/ets2panda/linter/test/deprecatedapi/swiper_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..07a2506defed6a3f55e7cd2f8ef035df79fc6a89 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/swiper_api.ets @@ -0,0 +1,52 @@ +/* + * 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. + */ +import {IndicatorStyle,SwiperDisplayMode} from './sdk/api/swiper'; + +class Test extends Test implements IndicatorStyle{ //error + layoutInfo: IndicatorStyle|undefined = undefined;//error + get(option:Map){//error + option.set('',{top:100,color:1111});//error + option.set('',{bottom:SwiperDisplayMode.Stretch})//error + } + getInfo(){ + return this.layoutInfo; + } + set(){ + typeof this.layoutInfo?.left//error + this.layoutInfo?.right == 100//error + this.layoutInfo?.color?.toString()//error + const info = this.layoutInfo; + console.log(info?.selectedColor+'');//error + this.getInfo()?.mask//error + this.layoutInfo?.bottom//error + setTop(this.getInfo()) + } + setSize(layoutInfo: IndicatorStyle|undefined){//error + layoutInfo?.size ;//error + } +} +function setTop(layoutInfo: IndicatorStyle|undefined ){//error + layoutInfo?.top == 0;//error +} +function getBotton(){ + new Test().getInfo()?.bottom;//error + const test = new Test(); + return test.layoutInfo?.bottom;//error +} +function get(){ + const AutoLinear = SwiperDisplayMode.AutoLinear//error + typeof SwiperDisplayMode.Stretch;//error + return SwiperDisplayMode.AUTO_LINEAR;//error +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/swiper_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..9aeb20fcecfe373e000c3fd631edb1ef6f643bcc --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json @@ -0,0 +1,298 @@ +{ + "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": 37, + "endLine": 17, + "endColumn": 51, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 15, + "endLine": 18, + "endColumn": 29, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 25, + "endLine": 19, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 20, + "endLine": 20, + "endColumn": 23, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 24, + "endLine": 20, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 28, + "endLine": 20, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 34, + "endLine": 20, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 20, + "endLine": 21, + "endColumn": 26, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 45, + "endLine": 21, + "endColumn": 52, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 29, + "endLine": 27, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 22, + "endLine": 28, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 31, + "endLine": 28, + "endColumn": 34, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 22, + "endLine": 29, + "endColumn": 27, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 23, + "endLine": 31, + "endColumn": 36, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 21, + "endLine": 32, + "endColumn": 25, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 22, + "endLine": 33, + "endColumn": 28, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 23, + "endLine": 36, + "endColumn": 37, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 17, + "endLine": 37, + "endColumn": 21, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 29, + "endLine": 40, + "endColumn": 43, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 15, + "endLine": 41, + "endColumn": 18, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 22, + "endLine": 41, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 10, + "endLine": 43, + "endColumn": 19, + "problem": "LimitedReturnTypeInference", + "suggest": "", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 25, + "endLine": 44, + "endColumn": 31, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 27, + "endLine": 46, + "endColumn": 33, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 9, + "endLine": 49, + "endColumn": 50, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 40, + "endLine": 49, + "endColumn": 50, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 28, + "endLine": 50, + "endColumn": 35, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 28, + "endLine": 51, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/swiper_api.ets.json b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..828c0d03a22449f6f683532ff0b945b8eb38c668 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.json @@ -0,0 +1,28 @@ +{ + "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": 43, + "column": 10, + "endLine": 43, + "endColumn": 19, + "problem": "LimitedReturnTypeInference", + "suggest": "", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/system_prompt.ets b/ets2panda/linter/test/deprecatedapi/system_prompt.ets new file mode 100755 index 0000000000000000000000000000000000000000..af14dd835279282e24405ec1f4320cc49cd03c85 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/system_prompt.ets @@ -0,0 +1,30 @@ +/* + * 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. + */ + +import prompt, { ShowToastOptions } from '@system.prompt'; + +class A { + private options: ShowToastOptions = { // error + message: 'Message Info', // error + duration: 2000, // error + bottom: 10 // error + } + + showToast() { + prompt.showToast(this.options); + } +} + +export default new A() diff --git a/ets2panda/linter/test/deprecatedapi/system_prompt.ets.args.json b/ets2panda/linter/test/deprecatedapi/system_prompt.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/system_prompt.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/system_prompt.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/system_prompt.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..bd5ae47f21a1ec0032294ce564ef280810586df7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/system_prompt.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "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": 21, + "column": 15, + "endLine": 21, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 13, + "endLine": 22, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/system_prompt.ets.json b/ets2panda/linter/test/deprecatedapi/system_prompt.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..7633c79b6aa0073a72cf8f74a66e11dac370f619 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/system_prompt.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/system_router.ets b/ets2panda/linter/test/deprecatedapi/system_router.ets new file mode 100755 index 0000000000000000000000000000000000000000..fd53ea0ce38981d75b29b98e0b2de27ed12785b7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/system_router.ets @@ -0,0 +1,103 @@ +/* + * 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. + */ + +import router, { + BackRouterOptions, + DisableAlertBeforeBackPageOptions, + EnableAlertBeforeBackPageOptions, RouterOptions, RouterState } from '@system.router'; + +class K { + private router: RouterOptions = { + uri: 'pages/routerpage2/routerpage2', + params: { // error + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + } + + private options: BackRouterOptions = { + uri: 'pages/detail/detail', // error + params: { // error + data1: 'message' + } + } + + getState() { + let page: RouterState = router.getState(); // error + console.log('current index = ' + page.index); // error + console.log('current name = ' + page.name); // error + console.log('current path = ' + page.path); // error + } + + pushPage() { + router.push(this.router); // error + } + + defaultBack() { + router.back(this.options); // error + } +} + +export default new K() + +class L { + private options: EnableAlertBeforeBackPageOptions = { + message: 'Message Info', + success: () => { + console.log('success'); + }, + cancel: () => { // error + console.log('cancel'); + }, + complete: () => { // error + console.log('complete'); + } + } + + enableAlertBeforeBackPage() { + router.enableAlertBeforeBackPage(this.options); + } +} + +class M { + enableAlertBeforeBackPage() { + router.enableAlertBeforeBackPage({ + message: 'Message Info', + success: () => { // error + console.log('success'); + }, + cancel: () => { + console.log('cancel'); + } + }); + } +} + +class Z { + private options: DisableAlertBeforeBackPageOptions = { // error + success: () => { + console.log('success'); + }, + cancel: () => { + console.log('cancel'); + } + } + + disableAlertBeforeBackPage() { + router.disableAlertBeforeBackPage(this.options); + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/system_router.ets.args.json b/ets2panda/linter/test/deprecatedapi/system_router.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..4dfa4f20174c5965ff0a03fe9745d4cece7b7efa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/system_router.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/system_router.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/system_router.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..3379c9304b7f94d92d2e2d537d1a42654a012a6b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/system_router.ets.arkts2.json @@ -0,0 +1,78 @@ +{ + "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": 24, + "column": 13, + "endLine": 24, + "endColumn": 14, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 14, + "endLine": 26, + "endColumn": 15, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 17, + "endLine": 27, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 22, + "endLine": 27, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 27, + "endLine": 27, + "endColumn": 30, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 13, + "endLine": 34, + "endColumn": 14, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/system_router.ets.json b/ets2panda/linter/test/deprecatedapi/system_router.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..bc7f37b6ed6a7d55e4bb110bda7f253f21db8c88 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/system_router.ets.json @@ -0,0 +1,48 @@ +{ + "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": 24, + "column": 13, + "endLine": 24, + "endColumn": 14, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 14, + "endLine": 26, + "endColumn": 15, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 13, + "endLine": 34, + "endColumn": 14, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/temporary_api.ets b/ets2panda/linter/test/deprecatedapi/temporary_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..014b717110d37d6683ece1956e966f06832c080a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/temporary_api.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ +import {PanelType} from './sdk/api/panel' + +@@Entry +@Component +struct WrapContentPanelExample { + @State isVisible: boolean = true + build() { + Column() { + Panel(this.isVisible) + .type(PanelType.Temporary) // error + } + + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/temporary_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..6a24afa2aac4d5e054cd450c061e7d3ff0b6969c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 2, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 13, + "endLine": 24, + "endColumn": 22, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 23, + "endLine": 24, + "endColumn": 32, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 3, + "endLine": 17, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/temporary_api.ets.json b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/text_input.ets b/ets2panda/linter/test/deprecatedapi/text_input.ets new file mode 100644 index 0000000000000000000000000000000000000000..34ea448f8453d32505d6209f0535bbc998a9f1ab --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/text_input.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ + +@Entry +@Component +struct TextInputExample { + controller: TextInputController = new TextInputController(); + + build() { + Column() { + TextInput({ controller: this.controller }) + .onEditChanged((isEditing: boolean) => { //error + }) + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/text_input.ets.json b/ets2panda/linter/test/deprecatedapi/text_input.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/text_input.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/text_picker.ets b/ets2panda/linter/test/deprecatedapi/text_picker.ets new file mode 100644 index 0000000000000000000000000000000000000000..9cf5d2196f51eb2e7d1c6fd4bec01f98cd79815c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/text_picker.ets @@ -0,0 +1,40 @@ +/* + * 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. + */ + +@Entry +@Component +struct TextPickerExample { + private select: number = 1; + private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4']; + + + build() { + Column() { + Button("TextPickerDialog") + .margin(20) + .onClick(() => { + TextPickerDialog.show() //error + }) + + TextPicker({ + range: this.fruits, + selected: this.select, + value: this.fruits[this.select] + }).onAccept(()=> {}) //error + .onCancel(()=> {}) //error + + }.width('100%').height('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/text_picker.ets.json b/ets2panda/linter/test/deprecatedapi/text_picker.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/text_picker.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets new file mode 100755 index 0000000000000000000000000000000000000000..34cec151b3183d52dd3fa924a9f668d9f89b5698 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ +import {PanelHeight} from './sdk/api/panel' + +@@Entry +@Component +struct WrapContentPanelExample { + @State isVisible: boolean = true + build() { + Column() { + Panel(this.isVisible) + .height(PanelHeight.WRAP_CONTENT) //error + } + + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.args.json new file mode 100755 index 0000000000000000000000000000000000000000..948b846fe04969bf5ccbe8bd9dc4a18559ce0c2c --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json new file mode 100755 index 0000000000000000000000000000000000000000..2e6eb36ba331904bfaa72a500323fd751ed89a09 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "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": 2, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 15, + "endLine": 24, + "endColumn": 26, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 27, + "endLine": 24, + "endColumn": 39, + "problem": "NoDeprecatedApi", + "suggest": "", + "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 3, + "endLine": 17, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 12, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.json b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.json new file mode 100755 index 0000000000000000000000000000000000000000..9f305c86d7ff705098b1e480818e125d5e6e3a4a --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} diff --git a/ets2panda/linter/test/deprecatedapi/xcomponent.ets b/ets2panda/linter/test/deprecatedapi/xcomponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..89b2897eecb25d473319c2121b9a708d13beeb8b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/xcomponent.ets @@ -0,0 +1,34 @@ +/* + * 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. + */ + +@Entry +@Component +struct PreviewArea { + xcomponentController: XComponentController = new XComponentController() + build() { + Row() { + XComponent({ + id: 'xcomponent', + type: 'type', + controller: this.xcomponentController + }) + .onLoad(() => { + this.xcomponentController.setXComponentSurfaceSize({surfaceWidth:1920,surfaceHeight:1080}); //error + }) + } + .backgroundColor(Color.Black) + .position({x: 0, y: 48}) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/xcomponent.ets.json b/ets2panda/linter/test/deprecatedapi/xcomponent.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/xcomponent.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ 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 index 7795884ac22abfdf7f90c5a93e3138411c8a596c..af236ddbd9ee7ade4f0050759cf591322e71316a 100644 --- a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.autofix.json +++ b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 656, "end": 656, - "replacementText": "let foo = ESValue.load('./binary_operation_js_obj_js').getProperty('foo');\nlet m = ESValue.load('./binary_operation_js_obj_js').getProperty('m');\nlet n = ESValue.load('./binary_operation_js_obj_js').getProperty('n');\n", + "replacementText": "let foo = ESValue.load('./binary_operation_js_obj_js').getProperty('foo');\nlet m = ESValue.load('./binary_operation_js_obj_js').getProperty('m');\nlet n = ESValue.load('./binary_operation_js_obj_js').getProperty('n');", "line": 15, "column": 1, "endLine": 15, diff --git a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.ets b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.ets index 7a93ab3ecba4333743782320a30eabec62e44bc2..b22867f793c806789f4c788301cdd18f0cffb154 100644 --- a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.ets +++ b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.ets @@ -15,7 +15,6 @@ let foo = ESValue.load('./binary_operation_js_obj_js').getProperty('foo'); let m = ESValue.load('./binary_operation_js_obj_js').getProperty('m'); let n = ESValue.load('./binary_operation_js_obj_js').getProperty('n'); - let a = foo.getProperty("a") let b = foo.getProperty("b") a + b diff --git a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.json b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.json index f0dfd043375ffecce257d2610defd361d1df6f34..eba74eaf8742dbcfe30b877eb998a622f3a83a4a 100644 --- a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.json +++ b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.json @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 19, + "line": 18, "column": 5, - "endLine": 19, + "endLine": 18, "endColumn": 29, "problem": "AnyType", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 20, + "line": 19, "column": 5, - "endLine": 20, + "endLine": 19, "endColumn": 29, "problem": "AnyType", "suggest": "", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 1, - "endLine": 26, + "endLine": 25, "endColumn": 15, "problem": "MathPow", "suggest": "", @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 30, + "line": 29, "column": 1, - "endLine": 30, + "endLine": 29, "endColumn": 37, "problem": "MathPow", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 35, "column": 1, - "endLine": 36, + "endLine": 35, "endColumn": 15, "problem": "MathPow", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 48, + "line": 47, "column": 1, - "endLine": 48, + "endLine": 47, "endColumn": 17, "problem": "MathPow", "suggest": "", diff --git a/ets2panda/linter/test/interop/call_function.ets.autofix.json b/ets2panda/linter/test/interop/call_function.ets.autofix.json index 7cd0add150f08855931ca29b1f7e8feab09320f7..b1910efb3d5a91a376022ee75a391ec36a5cae32 100644 --- a/ets2panda/linter/test/interop/call_function.ets.autofix.json +++ b/ets2panda/linter/test/interop/call_function.ets.autofix.json @@ -31,9 +31,9 @@ "endColumn": 43 }, { - "start": 685, - "end": 685, - "replacementText": "let foo = ESValue.load('./call_function_js').getProperty('foo');\nlet bar = ESValue.load('./call_function_js').getProperty('bar');\n", + "start": 646, + "end": 646, + "replacementText": "let foo = ESValue.load('./call_function_js').getProperty('foo');\nlet bar = ESValue.load('./call_function_js').getProperty('bar');", "line": 15, "column": 1, "endLine": 15, @@ -63,7 +63,7 @@ { "start": 685, "end": 685, - "replacementText": "let a = ESValue.load('./call_function_js').getProperty('a');\nlet b = ESValue.load('./call_function_js').getProperty('b');\n", + "replacementText": "let a = ESValue.load('./call_function_js').getProperty('a');\nlet b = ESValue.load('./call_function_js').getProperty('b');", "line": 16, "column": 1, "endLine": 16, diff --git a/ets2panda/linter/test/interop/call_function.ets.migrate.ets b/ets2panda/linter/test/interop/call_function.ets.migrate.ets index 042ce8662304511b08dd6ed0e4c2d2690e8fb522..dfacfa530a2a15d81bfb991440298883f59da1ba 100644 --- a/ets2panda/linter/test/interop/call_function.ets.migrate.ets +++ b/ets2panda/linter/test/interop/call_function.ets.migrate.ets @@ -12,12 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -let a = ESValue.load('./call_function_js').getProperty('a'); -let b = ESValue.load('./call_function_js').getProperty('b'); let foo = ESValue.load('./call_function_js').getProperty('foo'); let bar = ESValue.load('./call_function_js').getProperty('bar'); - +let a = ESValue.load('./call_function_js').getProperty('a'); +let b = ESValue.load('./call_function_js').getProperty('b'); foo.invoke() bar.invoke(ESValue.wrap(123.0)) diff --git a/ets2panda/linter/test/interop/call_function.ets.migrate.json b/ets2panda/linter/test/interop/call_function.ets.migrate.json index 91b9ceb2aa0000b0fcf083ec6fae6e69465d5096..2ca11b5859e69c41117613fd5c92d56af705b129 100644 --- a/ets2panda/linter/test/interop/call_function.ets.migrate.json +++ b/ets2panda/linter/test/interop/call_function.ets.migrate.json @@ -15,40 +15,40 @@ ], "result": [ { - "line": 16, + "line": 15, "column": 5, - "endLine": 16, - "endColumn": 60, + "endLine": 15, + "endColumn": 64, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 17, + "line": 16, "column": 5, - "endLine": 17, - "endColumn": 60, + "endLine": 16, + "endColumn": 64, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 18, + "line": 17, "column": 5, - "endLine": 18, - "endColumn": 64, + "endLine": 17, + "endColumn": 60, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 19, + "line": 18, "column": 5, - "endLine": 19, - "endColumn": 64, + "endLine": 18, + "endColumn": 60, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", diff --git a/ets2panda/linter/test/interop/call_object_methods.ets.autofix.json b/ets2panda/linter/test/interop/call_object_methods.ets.autofix.json index 0168feead4146a8ff3979eb4846aba20c577ec20..00cdf6a59e5ec307ff6745fc7a892f1468ce27c7 100644 --- a/ets2panda/linter/test/interop/call_object_methods.ets.autofix.json +++ b/ets2panda/linter/test/interop/call_object_methods.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 650, "end": 650, - "replacementText": "let foo = ESValue.load('./call_object_methods_js').getProperty('foo');\n", + "replacementText": "let foo = ESValue.load('./call_object_methods_js').getProperty('foo');", "line": 15, "column": 1, "endLine": 15, diff --git a/ets2panda/linter/test/interop/call_object_methods.ets.migrate.ets b/ets2panda/linter/test/interop/call_object_methods.ets.migrate.ets index e9e2087b586717af5c059e9675bdb27e7179ed28..c92ae9f532301f757cb685d7d746ea3f91203579 100644 --- a/ets2panda/linter/test/interop/call_object_methods.ets.migrate.ets +++ b/ets2panda/linter/test/interop/call_object_methods.ets.migrate.ets @@ -14,6 +14,5 @@ */ let foo = ESValue.load('./call_object_methods_js').getProperty('foo'); - foo.invokeMethod("bar", ESValue.wrap(123.0)) diff --git a/ets2panda/linter/test/interop/ignore_files/unique_types2.ts b/ets2panda/linter/test/interop/ignore_files/unique_types2.ts new file mode 100644 index 0000000000000000000000000000000000000000..e915e9bb10b8a7abf3f4fdae9f26467d37d00f80 --- /dev/null +++ b/ets2panda/linter/test/interop/ignore_files/unique_types2.ts @@ -0,0 +1,268 @@ +/* + * 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. + */ + +// any +let any_var: any = 10; +any_var = "string"; +export { any_var } + +// unknown +export let unknown_var: unknown = 10; + +// Symbol +export let symbol_var: symbol = Symbol("description"); + +// Function +export let function_var: Function = function () { + console.log("Hello, World!"); + return true; +}; + +// objectLiteral +export let objectLiteral_var: { x: number, y: string } = { x: 10, y: "hello" }; +export let objectLiteral_var2 = { x: 10, y: "hello" }; +export let objectLiteral_var3:{}; +export let objectLiteral_var32={}; +export let objectLiteral_var4 = { x: 1 }; +export function objectLiteral_var5() { + return { x: 1 }; +} +export function objectLiteral_var51(aa:{}):{}{ + return { x: 1 }; +} + +export class objectLiteral_var6 { + get() { return { a: '1' }; } + get2():{} { return {}; } + get3() { return {}; } + get4():{}|undefined {return; } + get1(): { x: number }|undefined { + return; + } + set(aa: { x: 1 }) { } + set3(aa: {}) { } + set1(aa: { x: 1 }|boolean) { } + set2(aa: { x: 1,y: string }|boolean,bb:string) { } +} +// enum +export enum enum_var { + a = 0, + b = '1', +} + +// function type +export type func_type = (arg: number) => string; +export type func_type2 = {(arg: number): string}; + +// Construct signature +export let constructor_type: { new(name: string): { name: string } } = class { + constructor(public name: string) { } +}; + +// Index Signature +let objIndexSignature_var: { [index: number]: string } = {}; +objIndexSignature_var[0] = "zero"; +objIndexSignature_var[1] = "one"; +export { objIndexSignature_var } + +// Intersection +interface TypeA { + a: number; +} +interface TypeB { + b: string; +} + +export let Intersection_obj: TypeA & TypeB = { a: 10, b: "hello" }; + +// keyof +export interface X { + a: number; + b: string; +} + +export type KeyOf_Type = keyof X; +export let de: KeyOf_Type; +export let key: keyof X; +export function keyFuns(){ + return key; +} +export class Keys{ + keys:keyof X; + set(x:keyof X|undefined){} + get():keyof X|void{} + get1(){ return this.keys} +} + +// typeof +let p = { x: 1, y: "" }; +export let typeOf_type = typeof p; +export let typeOf_type1: typeof p; +// let q: typeof p = { x: 2, y: "world" }; + +export let user = { name: "John", age: 25 }; + +export type SomeType = { + name: string, +} +//indexed access: type[index]。 +const MyArray = [{ name: "Alice", age: 15 }] +export type Person = typeof MyArray[number] +export let Person1 = MyArray[0] +type StringArray = string[]; +export type ElementType = StringArray[number]; +type Demo = { + id: number; + name: string; + address: { city: string; }; +}; +type NameType = Demo["name"]; +type CityType = Demo["address"]["city"]; +export type NameOrAddress =Demo["name" | "address"]; +export function getInfo(name:NameType){ + return name as CityType; +} +type Tuple = [string, number, boolean]; +type FirstElement = Tuple[0]; +type LastElement = Tuple[2]; +export class IndexAccess{ + par:Person; + set(city:CityType,NameOrAddr:NameOrAddress){} + get(name:NameType):Tuple|FirstElement|LastElement{ + return getInfo(name); + } +} +type UserKeys = keyof Demo; +export type UserValueTypes = Demo[UserKeys]; + +//Template Literal Types:${T}${U}... +type UnionString = "A" | "B"; +export type TemplateLiteralType =` ${UnionString}_id`; +type Direction = "up" | "down" | "left" | "right"; +type Action = "move" | "rotate"; +export type Commands = `${Action}_${Direction}`; +type PropEventNames = `${T}Changed`; +export type NameChanged = PropEventNames<"name">; +type Colors1 = "red" | "blue"; +type Sizes = "small" | "large"; +export type Variants = `${Colors1}_${Sizes}`; +type IsString = T extends string ? true : false; +export type Check = `${T}` extends string ? true : false; +export function testTemplateLiteralType(bb:Commands){ + let a :PropEventNames<"name">; +} + +export let objectLiteralType: SomeType; +export let mixedEnumType: X; +export let intersectionType: SomeType & X; +export let templateLiteralType: TemplateLiteralType|undefined; + +export function tsFunction() { }; +export let stringType: string; +export class Test{ + returnStr(){ + return stringType; + } +} +//conditional types:T extends U ? X : Y +type ExtractNumber = T extends number ? T : never; +export type NumbersOnly = ExtractNumber; +export type ReturnVal any> = + T extends (...args: any[]) => infer R ? R : never; +export type Num = ReturnVal<() => number>; + +//mapped types:{[K in KeyType]: TypeExpression} +type Readonly = { + readonly [K in keyof T]: T[K]; +}; +export type ReadonlyUser = Readonly; +export type Partial = { + [K in keyof T]?: T[K]; +}; +export type OptionalUser = Partial; +type Original = { + [key: string]: number; + name: string; +}; +export type Mapped = { + [K in keyof Original]: Original[K]; +}; + +export let sumType: { [index: number]: string ,temp:TemplateLiteralType,index:UserValueTypes} ; +//tool +type User = { + name: string; + age: number; + email: string; +}; +type Colors = 'red' | 'blue' | 'green' | 'yellow'; +// Pick +export type NameAndEmail = Pick; +// Omit +export type WithoutEmail = Omit; +// Exclude +export type PrimaryColors = Exclude; +// Extract +type Values = string | number | boolean | null; +export type PrimitiveValues = Extract; +// NonNullable +type Data = string | null | undefined; +export type CleanData = NonNullable; +// Parameters +function add(a: number, b: string): void { } +export type AddParams = Parameters; +// ConstructorParameters +class Per { + constructor(name: string, age: number) { } +} +export type PerParams = ConstructorParameters; +// ReturnType +function createUser(): { id: number; name: string } { + return { id: 1, name: 'Alice' }; +} +export type UserType = ReturnType; +// InstanceType +class Point { + x: number; + y: number; +} +export type PointInstance = InstanceType; +// NoInfer +type NoInfer = [T][T extends any ? 0 : never]; +export function identity(x: T, y: NoInfer): T { + return x; +} +// ThisParameterType +type getThis = (this: { name: string }) => void; +export type thisParameterType = ThisParameterType; +// OmitThisParameter +type GetThis = (this: { name: string }, x: number) => void; +export type WithoutThis = OmitThisParameter; +// ThisType +export type ClassThisType = ThisType<{ + getName(): string; +}>; +// Uppercase +type Greeting = 'hello'; +export type ShoutGreeting = Uppercase; +// Lowercase +export type QuietGreeting = Lowercase; +// Capitalize +export type CapitalizedWord = Capitalize; +// Uncapitalize +export type UncapitalizedWord = Uncapitalize; +export function getCapitalize(): Capitalize { + return 'Hello'; +} \ 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 index f8d8a8cfdc1ba30ef321a989822442291959bd07..465ba2da807da1e35435da6a6f7b6a33016d2af3 100644 --- a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.autofix.json +++ b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 655, "end": 655, - "replacementText": "let foo = ESValue.load('./increases_decreases_js_obj_js').getProperty('foo');\n", + "replacementText": "let foo = ESValue.load('./increases_decreases_js_obj_js').getProperty('foo');", "line": 15, "column": 1, "endLine": 15, 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 cf3c50c2c8a89af985acb0b136fe0c30360eac52..1cd740b7b56eff7959389116baf2e35e3b15c86c 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 @@ -13,7 +13,6 @@ * limitations under the License. */ let foo = ESValue.load('./increases_decreases_js_obj_js').getProperty('foo'); - let a: number =0.0 a = foo.getProperty("num").toNumber() foo.setProperty(num, a + 1.0) diff --git a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.json b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.json index 2d9436fba2c494e011863cffb8548f5f6d263639..f9906637d18ef0f43d5e7e4e13cef33aad5184fe 100644 --- a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.json +++ b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.json @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 35, + "line": 34, "column": 5, - "endLine": 35, + "endLine": 34, "endColumn": 46, "problem": "AnyType", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 39, + "line": 38, "column": 5, - "endLine": 39, + "endLine": 38, "endColumn": 46, "problem": "AnyType", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 43, + "line": 42, "column": 5, - "endLine": 43, + "endLine": 42, "endColumn": 46, "problem": "AnyType", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 47, + "line": 46, "column": 5, - "endLine": 47, + "endLine": 46, "endColumn": 46, "problem": "AnyType", "suggest": "", diff --git a/ets2panda/linter/test/interop/instantiated_js_obj.ets.autofix.json b/ets2panda/linter/test/interop/instantiated_js_obj.ets.autofix.json index 40daaaa99e5deaa49cd6d17eeb16b8db96f71b3f..d00f4ee0da5ca1764dd8f2f81533ce6f14c0af62 100644 --- a/ets2panda/linter/test/interop/instantiated_js_obj.ets.autofix.json +++ b/ets2panda/linter/test/interop/instantiated_js_obj.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 655, "end": 655, - "replacementText": "let Foo = ESValue.load('./instantiated_js_obj_js').getProperty('Foo');\nlet Foo1 = ESValue.load('./instantiated_js_obj_js').getProperty('Foo1');\n", + "replacementText": "let Foo = ESValue.load('./instantiated_js_obj_js').getProperty('Foo');\nlet Foo1 = ESValue.load('./instantiated_js_obj_js').getProperty('Foo1');", "line": 16, "column": 1, "endLine": 16, diff --git a/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.ets b/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.ets index 9f8564ec60c420c654dce212ba8110f1a975cd17..5ad9c490c7a58acadc8886b9f09523ed64f8e8ad 100644 --- a/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.ets +++ b/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.ets @@ -15,7 +15,6 @@ let Foo = ESValue.load('./instantiated_js_obj_js').getProperty('Foo'); let Foo1 = ESValue.load('./instantiated_js_obj_js').getProperty('Foo1'); - class A { num: number = 1.0; constructor() { 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 728ef37abc8c8fc19fc711e9b8947b4640fb45f7..8f8b73e3cdbb7c0e0f2a2cfd2c00ea33fe9881d9 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json @@ -43,7 +43,7 @@ { "start": 740, "end": 740, - "replacementText": "let foo = ESValue.load('./interop_convert_import_js.js').getProperty('foo');\r\nlet foo2 = ESValue.load('./interop_convert_import_js.js').getProperty('foo2');\r\nlet foo3 = ESValue.load('./interop_convert_import_js.js').getProperty('foo3');\r\nlet foo4 = ESValue.load('./interop_convert_import_js.js').getProperty('foo4');\r\nlet array_val = ESValue.load('./interop_convert_import_js.js').getProperty('array_val');\r\nlet null_val = ESValue.load('./interop_convert_import_js.js').getProperty('null_val');\r\nlet undefined_val = ESValue.load('./interop_convert_import_js.js').getProperty('undefined_val');\r\n", + "replacementText": "let foo = ESValue.load('./interop_convert_import_js.js').getProperty('foo');\r\nlet foo2 = ESValue.load('./interop_convert_import_js.js').getProperty('foo2');\r\nlet foo3 = ESValue.load('./interop_convert_import_js.js').getProperty('foo3');\r\nlet foo4 = ESValue.load('./interop_convert_import_js.js').getProperty('foo4');\r\nlet array_val = ESValue.load('./interop_convert_import_js.js').getProperty('array_val');\r\nlet null_val = ESValue.load('./interop_convert_import_js.js').getProperty('null_val');\r\nlet undefined_val = ESValue.load('./interop_convert_import_js.js').getProperty('undefined_val');", "line": 17, "column": 2, "endLine": 17, diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.ets b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.ets index b90e38880f2bf78c88e511682f3394ffc28975d4..2b727d66126cbe57d0abd8e2b63ea341b63ab076 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.ets @@ -22,7 +22,6 @@ let array_val = ESValue.load('./interop_convert_import_js.js').getProperty('arra let null_val = ESValue.load('./interop_convert_import_js.js').getProperty('null_val'); let undefined_val = ESValue.load('./interop_convert_import_js.js').getProperty('undefined_val'); - let a: number = foo.getProperty("num").toNumber() let a1: boolean = foo2.getProperty("bool").toBoolean() let a2: string = foo3.getProperty("str").toString() diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json index e2860e27258d30de9de0d714726d7602804025d9..169c0b6ce01c22d2aac5a7fd59241d93a5b78c79 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 32, + "line": 31, "column": 44, - "endLine": 32, + "endLine": 31, "endColumn": 68, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 42, + "line": 41, "column": 8, - "endLine": 42, + "endLine": 41, "endColumn": 24, "problem": "InterOpConvertImport", "suggest": "", diff --git a/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json b/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json index 92a6f21d60838df553b40b2a30752dce56c1e4ef..3203f645acdc0de2bb729cf49897e7bb51653af4 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json @@ -14,371 +14,371 @@ "limitations under the License." ], "result": [ - { - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 58, - "problem": "InterOpImportJs", - "autofix": [ - { - "start": 605, - "end": 662, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 58 + { + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 58, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 605, + "end": 662, + "replacementText": "", + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 58 + }, + { + "start": 662, + "end": 662, + "replacementText": "let a = ESValue.load('./interop_equality_judgment_js').getProperty('a');\nlet b = ESValue.load('./interop_equality_judgment_js').getProperty('b');\nlet c = ESValue.load('./interop_equality_judgment_js').getProperty('c');\nlet d = ESValue.load('./interop_equality_judgment_js').getProperty('d');", + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 58 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" }, { - "start": 662, - "end": 662, - "replacementText": "let a = ESValue.load('./interop_equality_judgment_js').getProperty('a');\nlet b = ESValue.load('./interop_equality_judgment_js').getProperty('b');\nlet c = ESValue.load('./interop_equality_judgment_js').getProperty('c');\nlet d = ESValue.load('./interop_equality_judgment_js').getProperty('d');\n", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 58 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 7, - "problem": "InteropEqualityJudgment", - "autofix": [ - { - "start": 663, - "end": 669, - "replacementText": "a.areEqual(b)", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 7 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 7, - "problem": "InteropEqualityJudgment", - "autofix": [ + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 7, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 663, + "end": 669, + "replacementText": "a.areEqual(b)", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, { - "start": 670, - "end": 676, - "replacementText": "!a.areEqual(b)", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 7 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 8, - "problem": "InteropEqualityJudgment", - "autofix": [ + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 7, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 670, + "end": 676, + "replacementText": "!a.areEqual(b)", + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, { - "start": 677, - "end": 684, - "replacementText": "a.areStrictlyEqual(b)", - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 8 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 8, - "problem": "InteropEqualityJudgment", - "autofix": [ + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 8, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 677, + "end": 684, + "replacementText": "a.areStrictlyEqual(b)", + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 8 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, { - "start": 685, - "end": 692, - "replacementText": "!a.areStrictlyEqual(b)", - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 8 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 17, - "problem": "InteropEqualityJudgment", - "autofix": [ + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 8, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 685, + "end": 692, + "replacementText": "!a.areStrictlyEqual(b)", + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 8 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, { - "start": 693, - "end": 709, - "replacementText": "c.getProperty(\"num1\").areEqual(d.getProperty(\"num1\"))", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 17 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 7, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 17, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 693, + "end": 709, + "replacementText": "c.getProperty(\"num1\").areEqual(d.getProperty(\"num1\"))", + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, { - "start": 693, - "end": 699, - "replacementText": "c.getProperty(\"num1\")", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 7 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 11, - "endLine": 21, - "endColumn": 17, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 7, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 693, + "end": 699, + "replacementText": "c.getProperty(\"num1\")", + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, { - "start": 703, - "end": 709, - "replacementText": "d.getProperty(\"num1\")", - "line": 21, - "column": 11, - "endLine": 21, - "endColumn": 17 - } - ], - "suggest": "", - "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": 17, - "problem": "InteropEqualityJudgment", - "autofix": [ + "line": 21, + "column": 11, + "endLine": 21, + "endColumn": 17, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 703, + "end": 709, + "replacementText": "d.getProperty(\"num1\")", + "line": 21, + "column": 11, + "endLine": 21, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, { - "start": 710, - "end": 726, - "replacementText": "!c.getProperty(\"num1\").areEqual(d.getProperty(\"num2\"))", - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 17 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 7, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 17, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 710, + "end": 726, + "replacementText": "!c.getProperty(\"num1\").areEqual(d.getProperty(\"num2\"))", + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, { - "start": 710, - "end": 716, - "replacementText": "c.getProperty(\"num1\")", - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 7 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 11, - "endLine": 22, - "endColumn": 17, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 7, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 710, + "end": 716, + "replacementText": "c.getProperty(\"num1\")", + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, { - "start": 720, - "end": 726, - "replacementText": "d.getProperty(\"num2\")", - "line": 22, - "column": 11, - "endLine": 22, - "endColumn": 17 - } - ], - "suggest": "", - "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": 18, - "problem": "InteropEqualityJudgment", - "autofix": [ + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 17, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 720, + "end": 726, + "replacementText": "d.getProperty(\"num2\")", + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, { - "start": 727, - "end": 744, - "replacementText": "c.getProperty(\"num1\").areStrictlyEqual(d.getProperty(\"num1\"))", - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 18 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 7, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 18, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 727, + "end": 744, + "replacementText": "c.getProperty(\"num1\").areStrictlyEqual(d.getProperty(\"num1\"))", + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, { - "start": 727, - "end": 733, - "replacementText": "c.getProperty(\"num1\")", - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 7 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 23, - "column": 12, - "endLine": 23, - "endColumn": 18, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 7, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 727, + "end": 733, + "replacementText": "c.getProperty(\"num1\")", + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, { - "start": 738, - "end": 744, - "replacementText": "d.getProperty(\"num1\")", - "line": 23, - "column": 12, - "endLine": 23, - "endColumn": 18 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 18, - "problem": "InteropEqualityJudgment", - "autofix": [ + "line": 23, + "column": 12, + "endLine": 23, + "endColumn": 18, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 738, + "end": 744, + "replacementText": "d.getProperty(\"num1\")", + "line": 23, + "column": 12, + "endLine": 23, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, { - "start": 745, - "end": 762, - "replacementText": "!c.getProperty(\"num1\").areStrictlyEqual(d.getProperty(\"num2\"))", - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 18 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 7, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 18, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 745, + "end": 762, + "replacementText": "!c.getProperty(\"num1\").areStrictlyEqual(d.getProperty(\"num2\"))", + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, { - "start": 745, - "end": 751, - "replacementText": "c.getProperty(\"num1\")", - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 7 - } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 12, - "endLine": 24, - "endColumn": 18, - "problem": "InteropObjectProperty", - "autofix": [ + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 7, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 745, + "end": 751, + "replacementText": "c.getProperty(\"num1\")", + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, { - "start": 756, - "end": 762, - "replacementText": "d.getProperty(\"num2\")", - "line": 24, - "column": 12, - "endLine": 24, - "endColumn": 18 + "line": 24, + "column": 12, + "endLine": 24, + "endColumn": 18, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 756, + "end": 762, + "replacementText": "d.getProperty(\"num2\")", + "line": 24, + "column": 12, + "endLine": 24, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" } - ], - "suggest": "", - "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", - "severity": "ERROR" - } ] } diff --git a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets index 4280a2dfb4e3d5f0dd505b1e767914205234e520..97c56d0dda0f930edb5db48d1f6fd0b9810fae45 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets @@ -17,7 +17,6 @@ let a = ESValue.load('./interop_equality_judgment_js').getProperty('a'); let b = ESValue.load('./interop_equality_judgment_js').getProperty('b'); let c = ESValue.load('./interop_equality_judgment_js').getProperty('c'); let d = ESValue.load('./interop_equality_judgment_js').getProperty('d'); - a.areEqual(b) !a.areEqual(b) a.areStrictlyEqual(b) diff --git a/ets2panda/linter/test/interop/interop_import_js.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js.ets.autofix.json index 95ff8c7ad144fd1bbf3e921de6e130eb0251c586..968a9c014ed5b655e79bef8a1209714677507427 100755 --- a/ets2panda/linter/test/interop/interop_import_js.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js.ets.autofix.json @@ -31,9 +31,9 @@ "endColumn": 38 }, { - "start": 952, - "end": 952, - "replacementText": "let Cjs = ESValue.load('../main/js_lib').getProperty('Cjs');\n", + "start": 643, + "end": 643, + "replacementText": "let Cjs = ESValue.load('../main/js_lib').getProperty('Cjs');", "line": 16, "column": 1, "endLine": 16, @@ -61,9 +61,9 @@ "endColumn": 38 }, { - "start": 952, - "end": 952, - "replacementText": "let fjs = ESValue.load('../main/js_lib').getProperty('fjs');\n", + "start": 681, + "end": 681, + "replacementText": "let fjs = ESValue.load('../main/js_lib').getProperty('fjs');", "line": 17, "column": 1, "endLine": 17, @@ -91,9 +91,9 @@ "endColumn": 64 }, { - "start": 952, - "end": 952, - "replacementText": "let CPreview = ESValue.load('./jsfiles/preview_import_js').getProperty('CPreview');\nlet bar = ESValue.load('./jsfiles/preview_import_js').getProperty('bar');\nlet foo = ESValue.load('./jsfiles/preview_import_js').getProperty('foo');\n", + "start": 745, + "end": 745, + "replacementText": "let CPreview = ESValue.load('./jsfiles/preview_import_js').getProperty('CPreview');\nlet bar = ESValue.load('./jsfiles/preview_import_js').getProperty('bar');\nlet foo = ESValue.load('./jsfiles/preview_import_js').getProperty('foo');", "line": 18, "column": 1, "endLine": 18, @@ -121,9 +121,9 @@ "endColumn": 44 }, { - "start": 952, - "end": 952, - "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');\n", + "start": 789, + "end": 789, + "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');", "line": 19, "column": 1, "endLine": 19, @@ -151,9 +151,9 @@ "endColumn": 57 }, { - "start": 952, - "end": 952, - "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');\nlet ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA');\nlet Dog = ESValue.load('./interop_import_js_js').getProperty('Dog');\n", + "start": 846, + "end": 846, + "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');\nlet ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA');\nlet Dog = ESValue.load('./interop_import_js_js').getProperty('Dog');", "line": 20, "column": 1, "endLine": 20, @@ -181,9 +181,9 @@ "endColumn": 47 }, { - "start": 952, - "end": 952, - "replacementText": "let tjs = ESValue.load('./interop_import_js_js').getProperty('tjs');\n", + "start": 893, + "end": 893, + "replacementText": "let tjs = ESValue.load('./interop_import_js_js').getProperty('tjs');", "line": 21, "column": 1, "endLine": 21, @@ -213,7 +213,7 @@ { "start": 952, "end": 952, - "replacementText": "let Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');\nlet Doge = ESValue.load('./interop_import_js_js').getProperty('Dog');\n", + "replacementText": "let Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');\nlet Doge = ESValue.load('./interop_import_js_js').getProperty('Dog');", "line": 22, "column": 1, "endLine": 22, diff --git a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.ets b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.ets index 4ac9329ef8aa702c969d0b66d3bf030d342fc626..8a7215433eb02d96fc996ea94e32321d41b25965 100644 --- a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.ets @@ -13,21 +13,15 @@ * limitations under the License. */ - - - - - - -let Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki'); -let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog'); -let tjs = ESValue.load('./interop_import_js_js').getProperty('tjs'); -let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa'); -let ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA'); -let Dog = ESValue.load('./interop_import_js_js').getProperty('Dog'); -let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa'); +let Cjs = ESValue.load('../main/js_lib').getProperty('Cjs'); +let fjs = ESValue.load('../main/js_lib').getProperty('fjs'); let CPreview = ESValue.load('./jsfiles/preview_import_js').getProperty('CPreview'); let bar = ESValue.load('./jsfiles/preview_import_js').getProperty('bar'); let foo = ESValue.load('./jsfiles/preview_import_js').getProperty('foo'); -let fjs = ESValue.load('../main/js_lib').getProperty('fjs'); -let Cjs = ESValue.load('../main/js_lib').getProperty('Cjs'); +let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa'); +let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa'); +let ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA'); +let Dog = ESValue.load('./interop_import_js_js').getProperty('Dog'); +let tjs = ESValue.load('./interop_import_js_js').getProperty('tjs'); +let Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki'); +let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog'); \ No newline at end of file diff --git a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json index b401dd1af61260112e1f58f838d259e0d8fc0397..d20b189b4f292fa53920f6579a542b3f8c2651aa 100644 --- a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json @@ -15,69 +15,69 @@ ], "result": [ { - "line": 22, + "line": 16, "column": 5, - "endLine": 22, - "endColumn": 70, + "endLine": 16, + "endColumn": 60, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 23, + "line": 17, "column": 5, - "endLine": 23, - "endColumn": 69, + "endLine": 17, + "endColumn": 60, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 24, + "line": 18, "column": 5, - "endLine": 24, - "endColumn": 68, + "endLine": 18, + "endColumn": 83, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 25, + "line": 19, "column": 5, - "endLine": 25, - "endColumn": 70, + "endLine": 19, + "endColumn": 73, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 26, + "line": 20, "column": 5, - "endLine": 26, - "endColumn": 74, + "endLine": 20, + "endColumn": 73, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 27, + "line": 21, "column": 5, - "endLine": 27, - "endColumn": 68, + "endLine": 21, + "endColumn": 70, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 28, + "line": 22, "column": 5, - "endLine": 28, + "endLine": 22, "endColumn": 70, "problem": "AnyType", "suggest": "", @@ -85,50 +85,50 @@ "severity": "ERROR" }, { - "line": 29, + "line": 23, "column": 5, - "endLine": 29, - "endColumn": 83, + "endLine": 23, + "endColumn": 74, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 30, + "line": 24, "column": 5, - "endLine": 30, - "endColumn": 73, + "endLine": 24, + "endColumn": 68, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 31, + "line": 25, "column": 5, - "endLine": 31, - "endColumn": 73, + "endLine": 25, + "endColumn": 68, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 32, + "line": 26, "column": 5, - "endLine": 32, - "endColumn": 60, + "endLine": 26, + "endColumn": 70, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 33, + "line": 27, "column": 5, - "endLine": 33, - "endColumn": 60, + "endLine": 27, + "endColumn": 69, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", diff --git a/ets2panda/linter/test/interop/interop_import_js_compare.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_compare.ets.autofix.json index 069c2730b0bf41cb95c272d3e7df974d866ccd2d..9740ccecdb5c1c4db9305c73019fd3fd1960e556 100644 --- a/ets2panda/linter/test/interop/interop_import_js_compare.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js_compare.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 663, "end": 663, - "replacementText": "let foo = ESValue.load('./interop_import_js_compare_js').getProperty('foo');\nlet m = ESValue.load('./interop_import_js_compare_js').getProperty('m');\nlet n = ESValue.load('./interop_import_js_compare_js').getProperty('n');\n", + "replacementText": "let foo = ESValue.load('./interop_import_js_compare_js').getProperty('foo');\nlet m = ESValue.load('./interop_import_js_compare_js').getProperty('m');\nlet n = ESValue.load('./interop_import_js_compare_js').getProperty('n');", "line": 17, "column": 1, "endLine": 17, diff --git a/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.ets b/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.ets index a95b861772eda6a44fce54e779ec10ee6f350566..e9bab633c586092ecb5e0e4e11d6a1e4cefe7ff9 100644 --- a/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.ets @@ -17,7 +17,6 @@ let foo = ESValue.load('./interop_import_js_compare_js').getProperty('foo'); let m = ESValue.load('./interop_import_js_compare_js').getProperty('m'); let n = ESValue.load('./interop_import_js_compare_js').getProperty('n'); - let a = foo.getProperty("a") let b = foo.getProperty("b") a > b diff --git a/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.json b/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.json index b425bd1e5ac7fb8023a82667b073b90995e83676..69216fdae77b5bc16727b2286af5d86722cf4e9e 100644 --- a/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.json @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 21, + "line": 20, "column": 5, - "endLine": 21, + "endLine": 20, "endColumn": 29, "problem": "AnyType", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 22, + "line": 21, "column": 5, - "endLine": 22, + "endLine": 21, "endColumn": 29, "problem": "AnyType", "suggest": "", 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 1fe5631167a5a613ca82d7557fa08ec86d26432f..1452fdc6b3e8444ed1e7a92bc16b1f4bd111fbbe 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 @@ -31,9 +31,9 @@ "endColumn": 51 }, { - "start": 703, - "end": 703, - "replacementText": "let ff3 = ESValue.load('./interop_import_js_rules_js').getProperty('ff3');\n", + "start": 654, + "end": 654, + "replacementText": "let ff3 = ESValue.load('./interop_import_js_rules_js').getProperty('ff3');", "line": 15, "column": 1, "endLine": 15, @@ -63,7 +63,7 @@ { "start": 703, "end": 703, - "replacementText": "let foo = ESValue.load('./interop_import_js_index_js').getProperty('foo');\n", + "replacementText": "let foo = ESValue.load('./interop_import_js_index_js').getProperty('foo');", "line": 16, "column": 1, "endLine": 16, @@ -478,26 +478,26 @@ "endLine": 34, "endColumn": 2, "problem": "InteropJsObjectTraverseJsInstance", - "autofix": [ - { - "start": 970, - "end": 989, - "replacementText": "let tmp_1 = 0; tmp_1 < arr1.getProperty('length').toNumber(); ++tmp_1", - "line": 30, - "column": 1, - "endLine": 34, - "endColumn": 2 - }, - { - "start": 1008, - "end": 1015, - "replacementText": "arr1.getProperty(tmp_1).toNumber()", - "line": 30, - "column": 1, - "endLine": 34, - "endColumn": 2 - } - ], + "autofix": [ + { + "start": 970, + "end": 989, + "replacementText": "let tmp_1 = 0; tmp_1 < arr1.getProperty('length').toNumber(); ++tmp_1", + "line": 30, + "column": 1, + "endLine": 34, + "endColumn": 2 + }, + { + "start": 1008, + "end": 1015, + "replacementText": "arr1.getProperty(tmp_1).toNumber()", + "line": 30, + "column": 1, + "endLine": 34, + "endColumn": 2 + } + ], "suggest": "", "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-traverse-js-instance)", "severity": "ERROR" diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.ets b/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.ets index 989d010fbfabd2d1e5fe99526d0b5ab71ed22eb9..60b5b30251ea5240c208b64bac57a2d6bffd5ed3 100644 --- a/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.ets @@ -12,10 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -let foo = ESValue.load('./interop_import_js_index_js').getProperty('foo'); let ff3 = ESValue.load('./interop_import_js_rules_js').getProperty('ff3'); - +let foo = ESValue.load('./interop_import_js_index_js').getProperty('foo'); let arr = foo.getProperty("arr") arr.getProperty(1.0) arr.setProperty(3.0, ESValue.wrap(4.0)) diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.json b/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.json index 7c8632a14d0aa211a01cfd232c5bb6d98dc13369..191b2c2b9ec307fab46144da63bef106269577e4 100644 --- a/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 16, + "line": 15, "column": 5, - "endLine": 16, + "endLine": 15, "endColumn": 74, "problem": "AnyType", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 17, + "line": 16, "column": 5, - "endLine": 17, + "endLine": 16, "endColumn": 74, "problem": "AnyType", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 19, + "line": 17, "column": 5, - "endLine": 19, + "endLine": 17, "endColumn": 33, "problem": "AnyType", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 23, + "line": 21, "column": 5, - "endLine": 23, + "endLine": 21, "endColumn": 34, "problem": "AnyType", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 27, + "line": 25, "column": 9, - "endLine": 27, + "endLine": 25, "endColumn": 43, "problem": "AnyType", "suggest": "", 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 3d0767dc095e442493cb7c589057d5c9ad6606c1..c4175a21f1e94e44965f5dde24dda0498d62fbc6 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 @@ -41,9 +41,9 @@ "endColumn": 51 }, { - "start": 1092, - "end": 1092, - "replacementText": "let foo = ESValue.load('./interop_import_js_rules_js').getProperty('foo');\n", + "start": 669, + "end": 669, + "replacementText": "let foo = ESValue.load('./interop_import_js_rules_js').getProperty('foo');", "line": 17, "column": 1, "endLine": 17, @@ -81,9 +81,9 @@ "endColumn": 56 }, { - "start": 1092, - "end": 1092, - "replacementText": "let ff1 = ESValue.load('./interop_import_js_rules_js').getProperty('ff1');\nlet ff2 = ESValue.load('./interop_import_js_rules_js').getProperty('ff2');\n", + "start": 725, + "end": 725, + "replacementText": "let ff1 = ESValue.load('./interop_import_js_rules_js').getProperty('ff1');\nlet ff2 = ESValue.load('./interop_import_js_rules_js').getProperty('ff2');", "line": 18, "column": 1, "endLine": 18, @@ -121,9 +121,9 @@ "endColumn": 49 }, { - "start": 1092, - "end": 1092, - "replacementText": "let A = ESValue.load('./interop_import_js_rules_js').getProperty('A');\n", + "start": 775, + "end": 775, + "replacementText": "let A = ESValue.load('./interop_import_js_rules_js').getProperty('A');", "line": 20, "column": 1, "endLine": 20, @@ -161,9 +161,9 @@ "endColumn": 49 }, { - "start": 1092, - "end": 1092, - "replacementText": "let C = ESValue.load('./interop_import_js_rules_js').getProperty('C');\n", + "start": 824, + "end": 824, + "replacementText": "let C = ESValue.load('./interop_import_js_rules_js').getProperty('C');", "line": 21, "column": 1, "endLine": 21, @@ -201,9 +201,9 @@ "endColumn": 51 }, { - "start": 1092, - "end": 1092, - "replacementText": "let ff3 = ESValue.load('./interop_import_js_rules_js').getProperty('ff3');\n", + "start": 876, + "end": 876, + "replacementText": "let ff3 = ESValue.load('./interop_import_js_rules_js').getProperty('ff3');", "line": 23, "column": 1, "endLine": 23, @@ -241,9 +241,9 @@ "endColumn": 51 }, { - "start": 1092, - "end": 1092, - "replacementText": "let ff4 = ESValue.load('./interop_import_js_rules_js').getProperty('ff4');\n", + "start": 928, + "end": 928, + "replacementText": "let ff4 = ESValue.load('./interop_import_js_rules_js').getProperty('ff4');", "line": 25, "column": 1, "endLine": 25, @@ -281,9 +281,9 @@ "endColumn": 54 }, { - "start": 1092, - "end": 1092, - "replacementText": "let handle = ESValue.load('./interop_import_js_rules_js').getProperty('handle');\n", + "start": 983, + "end": 983, + "replacementText": "let handle = ESValue.load('./interop_import_js_rules_js').getProperty('handle');", "line": 27, "column": 1, "endLine": 27, @@ -321,9 +321,9 @@ "endColumn": 54 }, { - "start": 1092, - "end": 1092, - "replacementText": "let expand = ESValue.load('./interop_import_js_rules_js').getProperty('expand');\n", + "start": 1038, + "end": 1038, + "replacementText": "let expand = ESValue.load('./interop_import_js_rules_js').getProperty('expand');", "line": 29, "column": 1, "endLine": 29, @@ -363,7 +363,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let orange = ESValue.load('./interop_import_js_rules_js').getProperty('orange');\n", + "replacementText": "let orange = ESValue.load('./interop_import_js_rules_js').getProperty('orange');", "line": 30, "column": 1, "endLine": 30, @@ -1110,26 +1110,26 @@ "endLine": 92, "endColumn": 2, "problem": "InteropJsObjectTraverseJsInstance", - "autofix": [ - { - "start": 1882, - "end": 1900, - "replacementText": "let tmp_1 = 0; tmp_1 < arr.getProperty('length').toNumber(); ++tmp_1", - "line": 88, - "column": 1, - "endLine": 92, - "endColumn": 2 - }, - { - "start": 1910, - "end": 1917, - "replacementText": "arr.getProperty(tmp_1).toNumber()", - "line": 88, - "column": 1, - "endLine": 92, - "endColumn": 2 - } - ], + "autofix": [ + { + "start": 1882, + "end": 1900, + "replacementText": "let tmp_1 = 0; tmp_1 < arr.getProperty('length').toNumber(); ++tmp_1", + "line": 88, + "column": 1, + "endLine": 92, + "endColumn": 2 + }, + { + "start": 1910, + "end": 1917, + "replacementText": "arr.getProperty(tmp_1).toNumber()", + "line": 88, + "column": 1, + "endLine": 92, + "endColumn": 2 + } + ], "suggest": "", "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-traverse-js-instance)", "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 index cfe6324f31b9569623dcf5cff392d058c33e4fbd..616283816bbf0bb6f611360a8277ff27d8543a91 100644 --- a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json @@ -31,9 +31,9 @@ "endColumn": 69 }, { - "start": 783, - "end": 783, - "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');\nlet ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA');\nlet Dog = ESValue.load('./interop_import_js_js').getProperty('Dog');\nlet Person = ESValue.load('./interop_import_js_js').getProperty('Person');\nlet Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');\n", + "start": 674, + "end": 674, + "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');\nlet ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA');\nlet Dog = ESValue.load('./interop_import_js_js').getProperty('Dog');\nlet Person = ESValue.load('./interop_import_js_js').getProperty('Person');\nlet Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');", "line": 16, "column": 1, "endLine": 16, @@ -61,9 +61,9 @@ "endColumn": 54 }, { - "start": 783, - "end": 783, - "replacementText": "let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog');\n", + "start": 728, + "end": 728, + "replacementText": "let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog');", "line": 17, "column": 1, "endLine": 17, @@ -93,7 +93,7 @@ { "start": 783, "end": 783, - "replacementText": "let wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');\n", + "replacementText": "let wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');", "line": 18, "column": 1, "endLine": 18, diff --git a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.ets b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.ets index f7cde32163d4c0c4031ce29b783bcaf61fa964b0..e50da4c9173f7bfd0f2eed73da25c765aa50da14 100644 --- a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.ets @@ -13,16 +13,13 @@ * limitations under the License. */ - - -let wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki'); -let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog'); let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa'); let ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA'); let Dog = ESValue.load('./interop_import_js_js').getProperty('Dog'); let Person = ESValue.load('./interop_import_js_js').getProperty('Person'); let Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki'); - +let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog'); +let wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki'); myAaa.invoke().typeOf(); //error let fun = myAaa.invoke(); diff --git a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.json b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.json index fadac292b142e8d2c1b87a492ad418d41482c1a0..5c235089d9987874d5bcaceb721be697c9149d90 100644 --- a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 18, + "line": 16, "column": 5, - "endLine": 18, + "endLine": 16, "endColumn": 70, "problem": "AnyType", "suggest": "", @@ -25,29 +25,29 @@ "severity": "ERROR" }, { - "line": 19, + "line": 17, "column": 5, - "endLine": 19, - "endColumn": 69, + "endLine": 17, + "endColumn": 74, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 20, + "line": 18, "column": 5, - "endLine": 20, - "endColumn": 70, + "endLine": 18, + "endColumn": 68, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 21, + "line": 19, "column": 5, - "endLine": 21, + "endLine": 19, "endColumn": 74, "problem": "AnyType", "suggest": "", @@ -55,29 +55,29 @@ "severity": "ERROR" }, { - "line": 22, + "line": 20, "column": 5, - "endLine": 22, - "endColumn": 68, + "endLine": 20, + "endColumn": 70, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 23, + "line": 21, "column": 5, - "endLine": 23, - "endColumn": 74, + "endLine": 21, + "endColumn": 69, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 24, + "line": 22, "column": 5, - "endLine": 24, + "endLine": 22, "endColumn": 70, "problem": "AnyType", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 28, + "line": 25, "column": 5, - "endLine": 28, + "endLine": 25, "endColumn": 25, "problem": "AnyType", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 33, "column": 5, - "endLine": 36, + "endLine": 33, "endColumn": 35, "problem": "AnyType", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 42, + "line": 39, "column": 5, - "endLine": 42, + "endLine": 39, "endColumn": 37, "problem": "AnyType", "suggest": "", @@ -115,9 +115,9 @@ "severity": "ERROR" }, { - "line": 43, + "line": 40, "column": 5, - "endLine": 43, + "endLine": 40, "endColumn": 42, "problem": "AnyType", "suggest": "", @@ -125,9 +125,9 @@ "severity": "ERROR" }, { - "line": 56, + "line": 53, "column": 7, - "endLine": 56, + "endLine": 53, "endColumn": 13, "problem": "InvalidIdentifier", "suggest": "", 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 index b04c0809f27df7a14f1bd9d691a8aa696d54ad26..3947650ebf6cea8ecc00ecee25461b05543d600b 100644 --- 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 @@ -43,7 +43,7 @@ { "start": 723, "end": 723, - "replacementText": "let foo = ESValue.load('./interop_not_have_property_js').getProperty('foo');\nlet person = ESValue.load('./interop_not_have_property_js').getProperty('person');\nlet TestHelper = ESValue.load('./interop_not_have_property_js').getProperty('TestHelper');\nlet Machine = ESValue.load('./interop_not_have_property_js').getProperty('Machine');\nlet User = ESValue.load('./interop_not_have_property_js').getProperty('User');\nlet Person = ESValue.load('./interop_not_have_property_js').getProperty('Person');\nlet Employee = ESValue.load('./interop_not_have_property_js').getProperty('Employee');\n", + "replacementText": "let foo = ESValue.load('./interop_not_have_property_js').getProperty('foo');\nlet person = ESValue.load('./interop_not_have_property_js').getProperty('person');\nlet TestHelper = ESValue.load('./interop_not_have_property_js').getProperty('TestHelper');\nlet Machine = ESValue.load('./interop_not_have_property_js').getProperty('Machine');\nlet User = ESValue.load('./interop_not_have_property_js').getProperty('User');\nlet Person = ESValue.load('./interop_not_have_property_js').getProperty('Person');\nlet Employee = ESValue.load('./interop_not_have_property_js').getProperty('Employee');", "line": 17, "column": 1, "endLine": 17, diff --git a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.migrate.ets b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.migrate.ets index 3a19e5d1511c66c75b76ff0903e5120d555ac0f3..6320fe717df369223c3167f10f2ccae5a26d767d 100644 --- a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.migrate.ets @@ -22,7 +22,6 @@ let User = ESValue.load('./interop_not_have_property_js').getProperty('User'); let Person = ESValue.load('./interop_not_have_property_js').getProperty('Person'); let Employee = ESValue.load('./interop_not_have_property_js').getProperty('Employee'); - foo.getProperty("name") foo.setProperty("name", ESValue.wrap("456")) person.setProperty("age", ESValue.wrap(23.0)) diff --git a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.migrate.json b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.migrate.json index b8e566357c116732b2dc8a4c11f7e2deceea02af..02a85bc4f7389ef43420da02e57155643a3600ec 100644 --- a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.migrate.json @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 33, + "line": 32, "column": 5, - "endLine": 33, + "endLine": 32, "endColumn": 26, "problem": "AnyType", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 35, "column": 5, - "endLine": 36, + "endLine": 35, "endColumn": 85, "problem": "AnyType", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 38, + "line": 37, "column": 9, - "endLine": 38, + "endLine": 37, "endColumn": 32, "problem": "AnyType", "suggest": "", @@ -115,9 +115,9 @@ "severity": "ERROR" }, { - "line": 38, + "line": 37, "column": 23, - "endLine": 38, + "endLine": 37, "endColumn": 30, "problem": "DynamicCtorCall", "suggest": "", @@ -125,9 +125,9 @@ "severity": "ERROR" }, { - "line": 43, + "line": 42, "column": 9, - "endLine": 43, + "endLine": 42, "endColumn": 31, "problem": "AnyType", "suggest": "", @@ -135,9 +135,9 @@ "severity": "ERROR" }, { - "line": 43, + "line": 42, "column": 20, - "endLine": 43, + "endLine": 42, "endColumn": 24, "problem": "DynamicCtorCall", "suggest": "", @@ -145,9 +145,9 @@ "severity": "ERROR" }, { - "line": 48, + "line": 47, "column": 5, - "endLine": 48, + "endLine": 47, "endColumn": 26, "problem": "AnyType", "suggest": "", @@ -155,9 +155,9 @@ "severity": "ERROR" }, { - "line": 48, + "line": 47, "column": 16, - "endLine": 48, + "endLine": 47, "endColumn": 20, "problem": "DynamicCtorCall", "suggest": "", @@ -165,9 +165,9 @@ "severity": "ERROR" }, { - "line": 53, + "line": 52, "column": 9, - "endLine": 53, + "endLine": 52, "endColumn": 30, "problem": "AnyType", "suggest": "", @@ -175,9 +175,9 @@ "severity": "ERROR" }, { - "line": 53, + "line": 52, "column": 20, - "endLine": 53, + "endLine": 52, "endColumn": 24, "problem": "DynamicCtorCall", "suggest": "", @@ -185,9 +185,9 @@ "severity": "ERROR" }, { - "line": 58, + "line": 57, "column": 9, - "endLine": 58, + "endLine": 57, "endColumn": 30, "problem": "AnyType", "suggest": "", @@ -195,9 +195,9 @@ "severity": "ERROR" }, { - "line": 58, + "line": 57, "column": 20, - "endLine": 58, + "endLine": 57, "endColumn": 24, "problem": "DynamicCtorCall", "suggest": "", @@ -205,9 +205,9 @@ "severity": "ERROR" }, { - "line": 63, + "line": 62, "column": 9, - "endLine": 63, + "endLine": 62, "endColumn": 43, "problem": "AnyType", "suggest": "", @@ -215,9 +215,9 @@ "severity": "ERROR" }, { - "line": 63, + "line": 62, "column": 23, - "endLine": 63, + "endLine": 62, "endColumn": 29, "problem": "DynamicCtorCall", "suggest": "", @@ -225,9 +225,9 @@ "severity": "ERROR" }, { - "line": 68, + "line": 67, "column": 9, - "endLine": 68, + "endLine": 67, "endColumn": 34, "problem": "AnyType", "suggest": "", @@ -235,9 +235,9 @@ "severity": "ERROR" }, { - "line": 68, + "line": 67, "column": 24, - "endLine": 68, + "endLine": 67, "endColumn": 32, "problem": "DynamicCtorCall", "suggest": "", 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 index e2cc9e5d4c304a7e81e9f0161e212837f15bf57f..25cdadbfd4c2e3743b117d209932ef636e18c2c3 100644 --- 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 @@ -33,7 +33,7 @@ { "start": 650, "end": 650, - "replacementText": "let foo = ESValue.load('./interop_property_num_js').getProperty('foo');\n", + "replacementText": "let foo = ESValue.load('./interop_property_num_js').getProperty('foo');", "line": 16, "column": 1, "endLine": 16, diff --git a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.ets b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.ets index b67f968b2194a5096ebe9bbeb12b2b56d3755b3c..90055be46b6d01d93842863a922186d8022e2efa 100644 --- a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.ets @@ -15,7 +15,6 @@ let foo = ESValue.load('./interop_property_num_js').getProperty('foo'); - +foo.getProperty("num").toNumber(); -foo.getProperty("num").toNumber(); !foo.getProperty("num").toNumber(); diff --git a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.json b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.json index 5c300a0f06e69097793e229c1c3690f080cc48ef..8e9afac340f76cb36ff554e32f871a46d7f06406 100644 --- a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.json @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 19, + "line": 18, "column": 1, - "endLine": 19, + "endLine": 18, "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 20, + "line": 19, "column": 1, - "endLine": 20, + "endLine": 19, "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 22, + "line": 21, "column": 1, - "endLine": 22, + "endLine": 21, "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 23, + "line": 22, "column": 1, - "endLine": 23, + "endLine": 22, "endColumn": 37, "problem": "UnaryArithmNotNumber", "suggest": "", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 24, + "line": 23, "column": 1, - "endLine": 24, + "endLine": 23, "endColumn": 37, "problem": "UnaryArithmNotNumber", "suggest": "", @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 1, - "endLine": 26, + "endLine": 25, "endColumn": 37, "problem": "UnaryArithmNotNumber", "suggest": "", diff --git a/ets2panda/linter/test/interop/no_await_js_promise.ets.autofix.json b/ets2panda/linter/test/interop/no_await_js_promise.ets.autofix.json index 196e9489ea59563866b74d541eaf24afc2c81604..84a00a559c9d9f6d6f93195bd855662ab88891d1 100644 --- a/ets2panda/linter/test/interop/no_await_js_promise.ets.autofix.json +++ b/ets2panda/linter/test/interop/no_await_js_promise.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 693, "end": 693, - "replacementText": "let p = ESValue.load('./no_await_js_promise_export').getProperty('p');\nlet foo = ESValue.load('./no_await_js_promise_export').getProperty('foo');\nlet pFuncCall = ESValue.load('./no_await_js_promise_export').getProperty('pFuncCall');\nlet arrowFunc = ESValue.load('./no_await_js_promise_export').getProperty('arrowFunc');\nlet pArrowCall = ESValue.load('./no_await_js_promise_export').getProperty('pArrowCall');\n", + "replacementText": "let p = ESValue.load('./no_await_js_promise_export').getProperty('p');\nlet foo = ESValue.load('./no_await_js_promise_export').getProperty('foo');\nlet pFuncCall = ESValue.load('./no_await_js_promise_export').getProperty('pFuncCall');\nlet arrowFunc = ESValue.load('./no_await_js_promise_export').getProperty('arrowFunc');\nlet pArrowCall = ESValue.load('./no_await_js_promise_export').getProperty('pArrowCall');", "line": 16, "column": 1, "endLine": 16, diff --git a/ets2panda/linter/test/interop/no_await_js_promise.ets.migrate.ets b/ets2panda/linter/test/interop/no_await_js_promise.ets.migrate.ets index 7729b47d7a6cd5c444ef70ccab73a8c18dce3602..4454b4727ac15368882bf9900140174ed1ed5c8e 100644 --- a/ets2panda/linter/test/interop/no_await_js_promise.ets.migrate.ets +++ b/ets2panda/linter/test/interop/no_await_js_promise.ets.migrate.ets @@ -19,7 +19,6 @@ let pFuncCall = ESValue.load('./no_await_js_promise_export').getProperty('pFuncC let arrowFunc = ESValue.load('./no_await_js_promise_export').getProperty('arrowFunc'); let pArrowCall = ESValue.load('./no_await_js_promise_export').getProperty('pArrowCall'); - async function awaitPromise() { return await p.toPromise(); } diff --git a/ets2panda/linter/test/interop/no_await_js_promise.ets.migrate.json b/ets2panda/linter/test/interop/no_await_js_promise.ets.migrate.json index 0b6e2511ceacaa613c5a0fe7631766f9321db601..908d63c7c2200bdaaad08d4e0b3920a051552bf1 100644 --- a/ets2panda/linter/test/interop/no_await_js_promise.ets.migrate.json +++ b/ets2panda/linter/test/interop/no_await_js_promise.ets.migrate.json @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 23, + "line": 22, "column": 16, - "endLine": 23, + "endLine": 22, "endColumn": 28, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 27, + "line": 26, "column": 16, - "endLine": 27, + "endLine": 26, "endColumn": 33, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 16, - "endLine": 31, + "endLine": 30, "endColumn": 31, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 35, + "line": 34, "column": 16, - "endLine": 35, + "endLine": 34, "endColumn": 30, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 39, + "line": 38, "column": 16, - "endLine": 39, + "endLine": 38, "endColumn": 32, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -115,9 +115,9 @@ "severity": "ERROR" }, { - "line": 44, + "line": 43, "column": 9, - "endLine": 44, + "endLine": 43, "endColumn": 20, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -125,9 +125,9 @@ "severity": "ERROR" }, { - "line": 48, + "line": 47, "column": 13, - "endLine": 50, + "endLine": 49, "endColumn": 4, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -135,9 +135,9 @@ "severity": "ERROR" }, { - "line": 53, + "line": 52, "column": 20, - "endLine": 53, + "endLine": 52, "endColumn": 21, "problem": "ObjectLiteralNoContextType", "suggest": "", @@ -145,9 +145,9 @@ "severity": "ERROR" }, { - "line": 54, + "line": 53, "column": 3, - "endLine": 56, + "endLine": 55, "endColumn": 4, "problem": "ObjectLiteralProperty", "suggest": "", @@ -155,9 +155,9 @@ "severity": "ERROR" }, { - "line": 54, + "line": 53, "column": 9, - "endLine": 54, + "endLine": 53, "endColumn": 18, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -165,9 +165,9 @@ "severity": "ERROR" }, { - "line": 58, + "line": 57, "column": 17, - "endLine": 60, + "endLine": 59, "endColumn": 4, "problem": "LimitedReturnTypeInference", "suggest": "", diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json b/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json index 653a902126e27bc67f81ab01aaccf13af138d7ce..5f8e3d35ed8db01159f4d98d96c6dcdadc0ce492 100644 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 692, "end": 692, - "replacementText": "let Foo = ESValue.load('./no_js_instanceof_file.js').getProperty('Foo');\nlet foo = ESValue.load('./no_js_instanceof_file.js').getProperty('foo');\nlet CreatePerson = ESValue.load('./no_js_instanceof_file.js').getProperty('CreatePerson');\nlet a = ESValue.load('./no_js_instanceof_file.js').getProperty('a');\nlet b = ESValue.load('./no_js_instanceof_file.js').getProperty('b');\nlet MyNamespace = ESValue.load('./no_js_instanceof_file.js').getProperty('MyNamespace');\n", + "replacementText": "let Foo = ESValue.load('./no_js_instanceof_file.js').getProperty('Foo');\nlet foo = ESValue.load('./no_js_instanceof_file.js').getProperty('foo');\nlet CreatePerson = ESValue.load('./no_js_instanceof_file.js').getProperty('CreatePerson');\nlet a = ESValue.load('./no_js_instanceof_file.js').getProperty('a');\nlet b = ESValue.load('./no_js_instanceof_file.js').getProperty('b');\nlet MyNamespace = ESValue.load('./no_js_instanceof_file.js').getProperty('MyNamespace');", "line": 16, "column": 1, "endLine": 16, diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets index 619b63d4659038a813e10087178256f80689a392..514aa17d73fad1ecf96ea84c512d62f579b4b841 100644 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets @@ -20,7 +20,6 @@ let a = ESValue.load('./no_js_instanceof_file.js').getProperty('a'); let b = ESValue.load('./no_js_instanceof_file.js').getProperty('b'); let MyNamespace = ESValue.load('./no_js_instanceof_file.js').getProperty('MyNamespace'); - class Foo1 {} let foo1 = new Foo1() diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json index 7833e5b9a6ab314cc65509d10791e321d4eebf47..e84613a98b0ffcea08f2166fca6dd43a8c79448b 100644 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 70, + "line": 69, "column": 19, - "endLine": 70, + "endLine": 69, "endColumn": 24, "problem": "ClassAsObjectError", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 74, + "line": 73, "column": 21, - "endLine": 74, + "endLine": 73, "endColumn": 26, "problem": "ClassAsObjectError", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 78, + "line": 77, "column": 36, - "endLine": 78, + "endLine": 77, "endColumn": 59, "problem": "DynamicCtorCall", "suggest": "", diff --git a/ets2panda/linter/test/interop/unary_operation_js_obj.ets.autofix.json b/ets2panda/linter/test/interop/unary_operation_js_obj.ets.autofix.json index 855bd5e9a2c3b9bc81eb5ff2062c5e5f36b6b445..1639c66b412dc43d47a5a1f6c9ffe703bc258160 100644 --- a/ets2panda/linter/test/interop/unary_operation_js_obj.ets.autofix.json +++ b/ets2panda/linter/test/interop/unary_operation_js_obj.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 654, "end": 654, - "replacementText": "let foo = ESValue.load('./unary_operation_js_obj_js.js').getProperty('foo');\n", + "replacementText": "let foo = ESValue.load('./unary_operation_js_obj_js.js').getProperty('foo');", "line": 15, "column": 1, "endLine": 15, diff --git a/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.ets b/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.ets index 2cdab6f2ed8d1721df7d852f267de441a29f8765..2f5119402182c7fb7dd3ff4188c3ced36f307a0f 100644 --- a/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.ets +++ b/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.ets @@ -14,7 +14,6 @@ */ let foo = ESValue.load('./unary_operation_js_obj_js.js').getProperty('foo'); - +foo.getProperty("num").toNumber(); -foo.getProperty("num").toNumber(); !foo.getProperty("num").toNumber(); diff --git a/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.json b/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.json index cb1d1f02e88ce65beb43b91ed8e53709c9bc7eb2..8ebd88e3904eb9a6a65cbed9738408e716e0f904 100644 --- a/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.json +++ b/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.json @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 18, + "line": 17, "column": 1, - "endLine": 18, + "endLine": 17, "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 19, + "line": 18, "column": 1, - "endLine": 19, + "endLine": 18, "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 21, + "line": 20, "column": 1, - "endLine": 21, + "endLine": 20, "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", diff --git a/ets2panda/linter/test/interop/unique_types.ets.arkts2.json b/ets2panda/linter/test/interop/unique_types.ets.arkts2.json index 3f87d2a6a43c4ef31f9b8c3f266ea1db2dee1bd4..ad93ff0af7b8299c75bcd115e8855c4864cfffb3 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.arkts2.json +++ b/ets2panda/linter/test/interop/unique_types.ets.arkts2.json @@ -64,6 +64,16 @@ "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, + { + "line": 75, + "column": 1, + "endLine": 75, + "endColumn": 9, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, { "line": 75, "column": 16, diff --git a/ets2panda/linter/test/interop/unique_types.ets.autofix.json b/ets2panda/linter/test/interop/unique_types.ets.autofix.json index 3cce68fecd036b141897b44f2e90344630de6550..203ab57067c1c62fe267b24574d87c2363f5f097 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.autofix.json +++ b/ets2panda/linter/test/interop/unique_types.ets.autofix.json @@ -75,6 +75,16 @@ "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, + { + "line": 75, + "column": 1, + "endLine": 75, + "endColumn": 9, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, { "line": 75, "column": 16, diff --git a/ets2panda/linter/test/interop/unique_types.ets.migrate.json b/ets2panda/linter/test/interop/unique_types.ets.migrate.json index c5e5bd52294413eeb045dbe8cf23bcd7ea75b084..3eb75a8fe4df6211f5934d4e04459e0469c9770a 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.migrate.json +++ b/ets2panda/linter/test/interop/unique_types.ets.migrate.json @@ -44,6 +44,26 @@ "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, + { + "line": 72, + "column": 1, + "endLine": 72, + "endColumn": 13, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 1, + "endLine": 75, + "endColumn": 9, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, { "line": 78, "column": 7, diff --git a/ets2panda/linter/test/interop/unique_types2.ets b/ets2panda/linter/test/interop/unique_types2.ets new file mode 100644 index 0000000000000000000000000000000000000000..245729ec2cf9007e5ad193d6de5ad53c30acb744 --- /dev/null +++ b/ets2panda/linter/test/interop/unique_types2.ets @@ -0,0 +1,120 @@ +/* + * 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. +*/ +import { + NameAndEmail, + WithoutEmail, + PrimaryColors, + PrimitiveValues, + CleanData, + AddParams, + PerParams, + UserType, + PointInstance, + identity, + thisParameterType, + WithoutThis, + ClassThisType, + ShoutGreeting, + QuietGreeting, + CapitalizedWord, + UncapitalizedWord, + getCapitalize +} from './ignore_files/unique_types2'; + +//tools +const res :ShoutGreeting = 'HELLO'; //error + +const withoutThis: WithoutThis = {name: 'aaa'}; //error +class AA{ + private email:WithoutEmail={name:'1',age:10}; //error + set(color:PrimaryColors){ //error + } + get():PrimitiveValues|undefined{ //error + this.email as thisParameterType //error + const cc:ClassThisType = {} //error + return ; + } +} +function test(user:UserType,point:PointInstance,per:PerParams){} //error*3 +@Entry +@Component +struct MyComponent { + // 1. Pick/Omit 示例 + @State user: NameAndEmail = { name: 'Alice', email: 'alice@example.com' }; //error + @State partialUser: WithoutEmail = { name: 'Bob', age: 30 }; //error + + // 2. Exclude/Extract 示例 + @State primaryColor: PrimaryColors = 'red'; //error + @State primitiveValue: PrimitiveValues = true; //error + + // 3. NonNullable 示例 + @State validData: CleanData = 'valid'; //error + + // 4. Parameters/ConstructorParameters 示例 + private handleParams = (params: AddParams) => { //error + } + + // 5. ReturnType/InstanceType 示例 + @State userData: UserType = { id: 1, name: 'Charlie' }; //error + private point: PointInstance = { x: 10, y: 20 }; //error + + // 6. NoInfer 示例 + private useIdentity = () => { + const numResult = identity(123, 456); //error + // const errorResult = identity(123, 'abc'); //error + console.log('Identity result:', numResult); + } + + // 7. ThisParameterType/OmitThisParameter 示例 + private thisContext: thisParameterType = { name: 'Context' }; //error + private noThisFunc: WithoutThis = (x) => { //error + console.log('Without this:', x); + } + + // 8. 字符串工具类型示例 + @State shout: ShoutGreeting = 'HELLO'; //error + @State quiet: QuietGreeting = 'hello'; //error + @State capitalized: CapitalizedWord = 'Hello'; //error + @State uncapitalized: UncapitalizedWord = 'hello'; //error + + // 9. getCapitalize 函数 + computedWord= getCapitalize(); //error + + build() { + Column() { + // 显示用户信息 + Text(`Name: ${this.user.name}`) + Text(`Email: ${this.user.email}`) + + // 显示颜色和值 + Text(`Primary Color: ${this.primaryColor}`) + Text(`Primitive Value: ${this.primitiveValue}`) + + // 显示字符串转换结果 + Text(`Shout: ${this.shout}`) + Text(`Quiet: ${this.quiet}`) + Text(`Capitalized: ${this.capitalized}`) + Text(`Computed: ${this.computedWord}`) + + // 按钮触发函数 + Button('Call Identity') + .onClick(this.useIdentity) + + Button('Submit Parameters') + .onClick(() => this.handleParams([123, 'test'])) + } + .width('100%') + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/interop/unique_types2.ets.args.json b/ets2panda/linter/test/interop/unique_types2.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..bc4d2071daf6e9354e711c3b74b6be2b56659066 --- /dev/null +++ b/ets2panda/linter/test/interop/unique_types2.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/interop/unique_types2.ets.arkts2.json b/ets2panda/linter/test/interop/unique_types2.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..2ff6a935c471b27421e63a39e6fb72f51cf3d8fc --- /dev/null +++ b/ets2panda/linter/test/interop/unique_types2.ets.arkts2.json @@ -0,0 +1,668 @@ +{ + "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": 37, + "column": 12, + "endLine": 37, + "endColumn": 25, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 20, + "endLine": 39, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 34, + "endLine": 39, + "endColumn": 35, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 19, + "endLine": 41, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 32, + "endLine": 41, + "endColumn": 33, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 46, + "endLine": 41, + "endColumn": 48, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 15, + "endLine": 42, + "endColumn": 28, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 11, + "endLine": 44, + "endColumn": 26, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 21, + "endLine": 45, + "endColumn": 38, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 16, + "endLine": 46, + "endColumn": 29, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 20, + "endLine": 50, + "endColumn": 28, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 35, + "endLine": 50, + "endColumn": 48, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 53, + "endLine": 50, + "endColumn": 62, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 16, + "endLine": 55, + "endColumn": 28, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 31, + "endLine": 55, + "endColumn": 32, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 23, + "endLine": 56, + "endColumn": 35, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 38, + "endLine": 56, + "endColumn": 39, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 58, + "endLine": 56, + "endColumn": 60, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 24, + "endLine": 59, + "endColumn": 37, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 26, + "endLine": 60, + "endColumn": 41, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 21, + "endLine": 63, + "endColumn": 30, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 35, + "endLine": 66, + "endColumn": 44, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 20, + "endLine": 70, + "endColumn": 28, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 31, + "endLine": 70, + "endColumn": 32, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 37, + "endLine": 70, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 18, + "endLine": 71, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 39, + "endLine": 71, + "endColumn": 41, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 46, + "endLine": 71, + "endColumn": 48, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 11, + "endLine": 75, + "endColumn": 41, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 23, + "endLine": 75, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 32, + "endLine": 75, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 37, + "endLine": 75, + "endColumn": 40, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 24, + "endLine": 81, + "endColumn": 41, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 44, + "endLine": 81, + "endColumn": 45, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 23, + "endLine": 82, + "endColumn": 34, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 87, + "column": 17, + "endLine": 87, + "endColumn": 30, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 88, + "column": 17, + "endLine": 88, + "endColumn": 30, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 89, + "column": 23, + "endLine": 89, + "endColumn": 38, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 90, + "column": 25, + "endLine": 90, + "endColumn": 42, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 17, + "endLine": 93, + "endColumn": 30, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 18, + "endLine": 116, + "endColumn": 56, + "problem": "LimitedReturnTypeInference", + "suggest": "", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 43, + "endLine": 116, + "endColumn": 46, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 2, + "endLine": 51, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 2, + "endLine": 52, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 4, + "endLine": 55, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 4, + "endLine": 56, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 4, + "endLine": 59, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 4, + "endLine": 60, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 63, + "column": 4, + "endLine": 63, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 4, + "endLine": 70, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 87, + "column": 4, + "endLine": 87, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 88, + "column": 4, + "endLine": 88, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 89, + "column": 4, + "endLine": 89, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 90, + "column": 4, + "endLine": 90, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 96, + "column": 5, + "endLine": 96, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 7, + "endLine": 98, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 7, + "endLine": 99, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 102, + "column": 7, + "endLine": 102, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 103, + "column": 7, + "endLine": 103, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 106, + "column": 7, + "endLine": 106, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 107, + "column": 7, + "endLine": 107, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 108, + "column": 7, + "endLine": 108, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 109, + "column": 7, + "endLine": 109, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 112, + "column": 7, + "endLine": 112, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 115, + "column": 7, + "endLine": 115, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/interop/unique_types2.ets.json b/ets2panda/linter/test/interop/unique_types2.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ee4603f669d4004aed50443f8205fcf73b955ba3 --- /dev/null +++ b/ets2panda/linter/test/interop/unique_types2.ets.json @@ -0,0 +1,88 @@ +{ + "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": 39, + "column": 34, + "endLine": 39, + "endColumn": 35, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 32, + "endLine": 41, + "endColumn": 33, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 31, + "endLine": 55, + "endColumn": 32, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 56, + "column": 38, + "endLine": 56, + "endColumn": 39, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 31, + "endLine": 70, + "endColumn": 32, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 44, + "endLine": 81, + "endColumn": 45, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 18, + "endLine": 116, + "endColumn": 56, + "problem": "LimitedReturnTypeInference", + "suggest": "", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/interop/unique_types3.ets b/ets2panda/linter/test/interop/unique_types3.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e80761e144ed99290aa56d7c7bfa9ebce63aeee --- /dev/null +++ b/ets2panda/linter/test/interop/unique_types3.ets @@ -0,0 +1,214 @@ +/* + * 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. +*/ +import { + any_var, + symbol_var, + user, + unknown_var, + function_var, + func_type2, + objectLiteral_var, + objectLiteral_var2, + objectLiteral_var3, + objectLiteral_var32, + objectLiteral_var4, + objectLiteral_var5, + objectLiteral_var51, + objectLiteral_var6, + enum_var, + func_type, + constructor_type, + objIndexSignature_var, + Intersection_obj, + KeyOf_Type, + de, + key, + keyFuns, + Keys, + SomeType, + Person, + Person1, + ElementType, + NameOrAddress, + getInfo, + IndexAccess, + UserValueTypes, + stringType, + NumbersOnly, + ReturnVal, + Num, + typeOf_type, + typeOf_type1, + templateLiteralType, + TemplateLiteralType, + NameChanged, + testTemplateLiteralType, + Test, + ReadonlyUser, + Partial, + OptionalUser, + Mapped, + sumType +} from "./ignore_files/unique_types2" + +class TestHelper { + test(arg0: () => boolean, arg1: string) { + throw new Error("Method not implemented."); + } + constructor(name: string) { + } +} +export function test_unique_type(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_UNIQUE_TYPE"); + + test_helper.test(() => { + return typeof any_var === 'object' //error + }, "any_var ") + + test_helper.test(() => { + return typeof unknown_var === 'number' //error + }, "unknown_var ") + + test_helper.test(() => { + return typeof symbol_var === 'object' //error + }, "symbol_var ") + + test_helper.test(() => { + return function_var() === true //error + }, "function_var ") + + test_helper.test(() => { + return enum_var.a === 0 //error + }, "enum_var ") + + test_helper.test(() => { + const res = new objectLiteral_var6().set({}); //error + const res2 = new objectLiteral_var6().set1(true); //error + const res3 = new objectLiteral_var6().set2({},true); //error + const res3 = new objectLiteral_var6().set3(); + return typeof res === 'object' + }, "objectLiteral_var7 ") + + test_helper.test(() => { + const res = new objectLiteral_var6().get(); //error + const res2 = new objectLiteral_var6().get1(); //error + const res3 = new objectLiteral_var6().get2(); //error + const res4 = new objectLiteral_var6().get3(); //error + const res5 = new objectLiteral_var6().get4(); + return typeof res === 'object' + }, "objectLiteral_var6 ") + + test_helper.test(() => { + typeof objectLiteral_var2 === 'object' //error + typeof objectLiteral_var3 === 'object' + typeof objectLiteral_var32 === 'object' //error + typeof objectLiteral_var4 === 'object' //error + typeof objectLiteral_var5 === 'object' //error + typeof objectLiteral_var51 === 'object' //error + return typeof objectLiteral_var === 'object' //error + }, "objectLiteral_var ") + + test_helper.test(() => { + console.log(typeOf_type) + console.log(typeOf_type1+'') //error + return typeof user === 'object' //error + }, "typeof") + + test_helper.test(() => { + let fun: func_type = (arg: number) => { //error + return arg.toString(); + }; + let fun2: func_type2 = (arg: number) => { //error + }; + return fun2(1) === '111' + }, "func_type ") + + test_helper.test(() => { + return typeof user === 'object' //error + }, "user ") + + test_helper.test(() => { + // const aa = '' as SomeType; + return typeof ('object' as SomeType) === 'object' //error + }, "SomeType ") + + + test_helper.test(() => { + return objIndexSignature_var[0] === "zero" //error + }, "objIndexSignature_var ") + + test_helper.test(() => { + return Intersection_obj.a === 10 && Intersection_obj.b === 'hello' //error*2 + }, "Intersection_obj ") + + test_helper.test(() => { + let keyof_var1: KeyOf_Type = 'a'; //error + let kk = de; //error + console.log(key) //error + keyFuns(); //error + const keys = new Keys(); + keys.set(undefined); //error + new Keys().get(); //error + keys.get1(); //error + return keyof_var1 === 'a' + }, "KeyOf_Type ") + + test_helper.test(() => { + let a :Person= {name:'a',age:1}; //error + a=Person1; //error + const b = 'a' as ElementType; //error + getInfo(b) as NameOrAddress; //error*2 + typeof new IndexAccess().par; //error + const indexAcc = new IndexAccess(); + indexAcc.set('',''); //error + indexAcc.get(''); //error + let c = '' as UserValueTypes //error + return typeof a === 'object' + }, "indexed access type") + + test_helper.test(() => { + new Test().returnStr(); //error? + return typeof stringType === 'object' //error? + }, "stringType ") + + test_helper.test(() => { + const c:NumbersOnly|undefined = undefined; //error + let d:ReturnVal = c as Num; //error*2 + return typeof c === 'boolean' + }, "conditional types ") + + test_helper.test(() => { + const c:ReadonlyUser|OptionalUser|undefined = undefined; //error*2 + let d:Mapped|boolean = false; //error + let e : Partial; //error + return typeof c === 'boolean' + }, "mapped types ") + + test_helper.test(() => { + const res: NameChanged = testTemplateLiteralType(''); //error*2 + let b :TemplateLiteralType; //error + return typeof templateLiteralType !== "undefined" //error + }, "templateLiteralType ") + + test_helper.test(() => { + let instance = new constructor_type("Alice"); //error + return instance.name === 'Alice' + }, "constructor_type ") + + test_helper.test(() => { + return typeof sumType !== "undefined" //error + }, "sumType ") + +} \ No newline at end of file diff --git a/ets2panda/linter/test/interop/unique_types3.ets.args.json b/ets2panda/linter/test/interop/unique_types3.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..bc4d2071daf6e9354e711c3b74b6be2b56659066 --- /dev/null +++ b/ets2panda/linter/test/interop/unique_types3.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json b/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..aabbdb78be04ab1345c2781a79d78fefb24ae10e --- /dev/null +++ b/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json @@ -0,0 +1,738 @@ +{ + "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": 77, + "column": 19, + "endLine": 77, + "endColumn": 26, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 19, + "endLine": 81, + "endColumn": 30, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 85, + "column": 19, + "endLine": 85, + "endColumn": 29, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 89, + "column": 12, + "endLine": 89, + "endColumn": 24, + "problem": "ExplicitFunctionType", + "suggest": "", + "rule": "The function type should be explicit (arkts-no-ts-like-function-call)", + "severity": "ERROR" + }, + { + "line": 89, + "column": 12, + "endLine": 89, + "endColumn": 24, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 12, + "endLine": 93, + "endColumn": 20, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 27, + "endLine": 93, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 17, + "endLine": 97, + "endColumn": 49, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 42, + "endLine": 97, + "endColumn": 45, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 46, + "endLine": 97, + "endColumn": 47, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 18, + "endLine": 98, + "endColumn": 53, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 43, + "endLine": 98, + "endColumn": 47, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 18, + "endLine": 99, + "endColumn": 56, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 43, + "endLine": 99, + "endColumn": 47, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 48, + "endLine": 99, + "endColumn": 49, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 100, + "column": 18, + "endLine": 100, + "endColumn": 49, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 105, + "column": 42, + "endLine": 105, + "endColumn": 45, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 106, + "column": 43, + "endLine": 106, + "endColumn": 47, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 107, + "column": 43, + "endLine": 107, + "endColumn": 47, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 108, + "column": 43, + "endLine": 108, + "endColumn": 47, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 114, + "column": 12, + "endLine": 114, + "endColumn": 30, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 12, + "endLine": 116, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 117, + "column": 12, + "endLine": 117, + "endColumn": 30, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 118, + "column": 12, + "endLine": 118, + "endColumn": 30, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 119, + "column": 12, + "endLine": 119, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 120, + "column": 19, + "endLine": 120, + "endColumn": 36, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 125, + "column": 17, + "endLine": 125, + "endColumn": 29, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 126, + "column": 19, + "endLine": 126, + "endColumn": 23, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 130, + "column": 14, + "endLine": 130, + "endColumn": 23, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 133, + "column": 15, + "endLine": 133, + "endColumn": 25, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 135, + "column": 17, + "endLine": 135, + "endColumn": 18, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 139, + "column": 19, + "endLine": 139, + "endColumn": 23, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 144, + "column": 32, + "endLine": 144, + "endColumn": 40, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 149, + "column": 12, + "endLine": 149, + "endColumn": 36, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 149, + "column": 12, + "endLine": 149, + "endColumn": 33, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 153, + "column": 12, + "endLine": 153, + "endColumn": 28, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 153, + "column": 35, + "endLine": 153, + "endColumn": 37, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 153, + "column": 41, + "endLine": 153, + "endColumn": 57, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 157, + "column": 21, + "endLine": 157, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 158, + "column": 14, + "endLine": 158, + "endColumn": 16, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 159, + "column": 17, + "endLine": 159, + "endColumn": 20, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 160, + "column": 5, + "endLine": 160, + "endColumn": 12, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 162, + "column": 10, + "endLine": 162, + "endColumn": 13, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 163, + "column": 16, + "endLine": 163, + "endColumn": 19, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 164, + "column": 10, + "endLine": 164, + "endColumn": 14, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 169, + "column": 12, + "endLine": 169, + "endColumn": 18, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 169, + "column": 20, + "endLine": 169, + "endColumn": 21, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 169, + "column": 34, + "endLine": 169, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 170, + "column": 7, + "endLine": 170, + "endColumn": 14, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 171, + "column": 22, + "endLine": 171, + "endColumn": 33, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 172, + "column": 5, + "endLine": 172, + "endColumn": 12, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 172, + "column": 19, + "endLine": 172, + "endColumn": 32, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 173, + "column": 30, + "endLine": 173, + "endColumn": 33, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 175, + "column": 14, + "endLine": 175, + "endColumn": 17, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 176, + "column": 14, + "endLine": 176, + "endColumn": 17, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 177, + "column": 19, + "endLine": 177, + "endColumn": 33, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 187, + "column": 13, + "endLine": 187, + "endColumn": 24, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 188, + "column": 11, + "endLine": 188, + "endColumn": 20, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 188, + "column": 28, + "endLine": 188, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 193, + "column": 13, + "endLine": 193, + "endColumn": 25, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 193, + "column": 26, + "endLine": 193, + "endColumn": 38, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 194, + "column": 11, + "endLine": 194, + "endColumn": 17, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 195, + "column": 13, + "endLine": 195, + "endColumn": 20, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 200, + "column": 16, + "endLine": 200, + "endColumn": 27, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 200, + "column": 30, + "endLine": 200, + "endColumn": 57, + "problem": "LimitedVoidType", + "suggest": "", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 200, + "column": 30, + "endLine": 200, + "endColumn": 53, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 201, + "column": 12, + "endLine": 201, + "endColumn": 31, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 202, + "column": 19, + "endLine": 202, + "endColumn": 38, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 206, + "column": 24, + "endLine": 206, + "endColumn": 40, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 206, + "column": 24, + "endLine": 206, + "endColumn": 40, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 211, + "column": 19, + "endLine": 211, + "endColumn": 26, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 188, + "column": 23, + "endLine": 188, + "endColumn": 31, + "problem": "StrictDiagnostic", + "suggest": "Conversion of type 'undefined' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.", + "rule": "Conversion of type 'undefined' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/interop/unique_types3.ets.json b/ets2panda/linter/test/interop/unique_types3.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ba08ebc2873f575bc7978e7ac86eff69ea2a415b --- /dev/null +++ b/ets2panda/linter/test/interop/unique_types3.ets.json @@ -0,0 +1,68 @@ +{ + "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": 97, + "column": 46, + "endLine": 97, + "endColumn": 47, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 48, + "endLine": 99, + "endColumn": 49, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 149, + "column": 12, + "endLine": 149, + "endColumn": 36, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 169, + "column": 20, + "endLine": 169, + "endColumn": 21, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 188, + "column": 23, + "endLine": 188, + "endColumn": 31, + "problem": "StrictDiagnostic", + "suggest": "Conversion of type 'undefined' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.", + "rule": "Conversion of type 'undefined' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/collections_module.ets b/ets2panda/linter/test/main/collections_module.ets index 5fba982f6b6426a38730e4019763ff9658df5fc2..0d73282ec64470e2564c0681afdf0ec6ee331414 100644 --- a/ets2panda/linter/test/main/collections_module.ets +++ b/ets2panda/linter/test/main/collections_module.ets @@ -19,7 +19,7 @@ import { collections as collectionsAlias } from './oh_modules/@arkts.collections import { collections as kitCollections } from './oh_modules/@kit.ArkTS'; -import { collections as definedCollections } from 'user_defined_worker'; //legal +import { collections as definedCollections } from './ignore_files/user_defined_collections'; //legal function tesCollectionsUsage() { @@ -36,3 +36,7 @@ function tesCollectionsUsage() { let collections6: definedCollections.Array; // legal } + +function test(array: collections.Array) { + const map = collections.Map(); +} diff --git a/ets2panda/linter/test/main/collections_module.ets.arkts2.json b/ets2panda/linter/test/main/collections_module.ets.arkts2.json index 584e375a01ba06e7a2ecd03772a34d762c5ccbba..7286b3c366e4d8b32395b1830bd48e1ac22a1207 100644 --- a/ets2panda/linter/test/main/collections_module.ets.arkts2.json +++ b/ets2panda/linter/test/main/collections_module.ets.arkts2.json @@ -24,16 +24,6 @@ "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", "severity": "ERROR" }, - { - "line": 18, - "column": 10, - "endLine": 18, - "endColumn": 21, - "problem": "NoNeedStdLibSendableContainer", - "suggest": "", - "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", - "severity": "ERROR" - }, { "line": 18, "column": 25, @@ -44,16 +34,6 @@ "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", "severity": "ERROR" }, - { - "line": 20, - "column": 10, - "endLine": 20, - "endColumn": 21, - "problem": "NoNeedStdLibSendableContainer", - "suggest": "", - "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", - "severity": "ERROR" - }, { "line": 20, "column": 25, @@ -133,6 +113,46 @@ "suggest": "", "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", "severity": "ERROR" + }, + { + "line": 40, + "column": 22, + "endLine": 40, + "endColumn": 33, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 11, + "endLine": 41, + "endColumn": 50, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 17, + "endLine": 41, + "endColumn": 28, + "problem": "NoNeedStdLibSendableContainer", + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 29, + "endLine": 41, + "endColumn": 32, + "problem": "ClassAsObjectError", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "ERROR" } ] } diff --git a/ets2panda/linter/test/main/collections_module.ets.autofix.json b/ets2panda/linter/test/main/collections_module.ets.autofix.json index 3b091c13f428361247667bb4cc8bd51cef9274b9..1d3cd393a428875374beb8c8f466ccfb77fa4307 100644 --- a/ets2panda/linter/test/main/collections_module.ets.autofix.json +++ b/ets2panda/linter/test/main/collections_module.ets.autofix.json @@ -24,24 +24,11 @@ { "start": 605, "end": 667, - "replacementText": "" - } - ], - "suggest": "", - "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 10, - "endLine": 18, - "endColumn": 21, - "problem": "NoNeedStdLibSendableContainer", - "autofix": [ - { - "start": 669, - "end": 751, - "replacementText": "" + "replacementText": "", + "line": 16, + "column": 10, + "endLine": 16, + "endColumn": 21 } ], "suggest": "", @@ -58,24 +45,11 @@ { "start": 669, "end": 751, - "replacementText": "" - } - ], - "suggest": "", - "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 10, - "endLine": 20, - "endColumn": 21, - "problem": "NoNeedStdLibSendableContainer", - "autofix": [ - { - "start": 753, - "end": 825, - "replacementText": "" + "replacementText": "", + "line": 18, + "column": 25, + "endLine": 18, + "endColumn": 41 } ], "suggest": "", @@ -92,7 +66,11 @@ { "start": 753, "end": 825, - "replacementText": "" + "replacementText": "", + "line": 20, + "column": 25, + "endLine": 20, + "endColumn": 39 } ], "suggest": "", @@ -107,9 +85,13 @@ "problem": "NoNeedStdLibSendableContainer", "autofix": [ { - "start": 965, - "end": 982, - "replacementText": "Array" + "start": 985, + "end": 1002, + "replacementText": "Array", + "line": 26, + "column": 23, + "endLine": 26, + "endColumn": 34 } ], "suggest": "", @@ -124,9 +106,13 @@ "problem": "NoNeedStdLibSendableContainer", "autofix": [ { - "start": 997, - "end": 1014, - "replacementText": "Array" + "start": 1017, + "end": 1034, + "replacementText": "Array", + "line": 26, + "column": 55, + "endLine": 26, + "endColumn": 66 } ], "suggest": "", @@ -141,9 +127,13 @@ "problem": "NoNeedStdLibSendableContainer", "autofix": [ { - "start": 1054, - "end": 1076, - "replacementText": "Array" + "start": 1074, + "end": 1096, + "replacementText": "Array", + "line": 28, + "column": 28, + "endLine": 28, + "endColumn": 44 } ], "suggest": "", @@ -158,9 +148,13 @@ "problem": "NoNeedStdLibSendableContainer", "autofix": [ { - "start": 1116, - "end": 1136, - "replacementText": "Array" + "start": 1136, + "end": 1156, + "replacementText": "Array", + "line": 30, + "column": 28, + "endLine": 30, + "endColumn": 42 } ], "suggest": "", @@ -175,9 +169,13 @@ "problem": "NoNeedStdLibSendableContainer", "autofix": [ { - "start": 1169, - "end": 1191, - "replacementText": "Array" + "start": 1189, + "end": 1211, + "replacementText": "Array", + "line": 32, + "column": 21, + "endLine": 32, + "endColumn": 37 } ], "suggest": "", @@ -192,9 +190,13 @@ "problem": "NoNeedStdLibSendableContainer", "autofix": [ { - "start": 1224, - "end": 1246, - "replacementText": "Array" + "start": 1244, + "end": 1266, + "replacementText": "Array", + "line": 34, + "column": 23, + "endLine": 34, + "endColumn": 39 } ], "suggest": "", @@ -209,14 +211,80 @@ "problem": "NoNeedStdLibSendableContainer", "autofix": [ { - "start": 1261, - "end": 1283, - "replacementText": "Array" + "start": 1281, + "end": 1303, + "replacementText": "Array", + "line": 34, + "column": 60, + "endLine": 34, + "endColumn": 76 + } + ], + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 22, + "endLine": 40, + "endColumn": 33, + "problem": "NoNeedStdLibSendableContainer", + "autofix": [ + { + "start": 1404, + "end": 1421, + "replacementText": "Array", + "line": 40, + "column": 22, + "endLine": 40, + "endColumn": 33 + } + ], + "suggest": "", + "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 11, + "endLine": 41, + "endColumn": 50, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 17, + "endLine": 41, + "endColumn": 28, + "problem": "NoNeedStdLibSendableContainer", + "autofix": [ + { + "start": 1449, + "end": 1464, + "replacementText": "Map", + "line": 41, + "column": 17, + "endLine": 41, + "endColumn": 28 } ], "suggest": "", "rule": "Sendable containers are not supported (arkts-no-need-stdlib-sendable-containers)", "severity": "ERROR" + }, + { + "line": 41, + "column": 29, + "endLine": 41, + "endColumn": 32, + "problem": "ClassAsObjectError", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "ERROR" } ] } diff --git a/ets2panda/linter/test/main/collections_module.ets.json b/ets2panda/linter/test/main/collections_module.ets.json index ca88f857e960b437dcf767c0ac40be998c8f1236..c85948ef43d15c11df4ea2642653f1aa07028852 100644 --- a/ets2panda/linter/test/main/collections_module.ets.json +++ b/ets2panda/linter/test/main/collections_module.ets.json @@ -13,5 +13,26 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [] -} \ No newline at end of file + "result": [ + { + "line": 41, + "column": 11, + "endLine": 41, + "endColumn": 50, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 29, + "endLine": 41, + "endColumn": 32, + "problem": "ClassAsObject", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "WARNING" + } + ] +} diff --git a/ets2panda/linter/test/main/collections_module.ets.migrate.ets b/ets2panda/linter/test/main/collections_module.ets.migrate.ets index 02fc9aaad5de07117bf611e6701de10bcfd98aa1..81cfa37dfc52720a009fc7648421b1f1158efd5a 100644 --- a/ets2panda/linter/test/main/collections_module.ets.migrate.ets +++ b/ets2panda/linter/test/main/collections_module.ets.migrate.ets @@ -19,7 +19,7 @@ -import { collections as definedCollections } from 'user_defined_worker'; //legal +import { collections as definedCollections } from './ignore_files/user_defined_collections'; //legal function tesCollectionsUsage() { @@ -36,3 +36,7 @@ function tesCollectionsUsage() { let collections6: definedCollections.Array; // legal } + +function test(array: Array) { + const map = Map(); +} diff --git a/ets2panda/linter/test/main/collections_module.ets.migrate.json b/ets2panda/linter/test/main/collections_module.ets.migrate.json index 4dcf9e56dbc14e1fbd427eeb3ad24f841cacf0ce..dd7b500c7435da5e5cbdc0a12e60930e24375f66 100644 --- a/ets2panda/linter/test/main/collections_module.ets.migrate.json +++ b/ets2panda/linter/test/main/collections_module.ets.migrate.json @@ -13,6 +13,16 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [] + "result": [ + { + "line": 41, + "column": 11, + "endLine": 41, + "endColumn": 38, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] } - diff --git a/ets2panda/linter/test/main/ignore_files/user_created_collections.ets b/ets2panda/linter/test/main/ignore_files/user_created_collections.ets new file mode 100644 index 0000000000000000000000000000000000000000..f900dc1034ce5799ff90b47fcc74be9ab3301d19 --- /dev/null +++ b/ets2panda/linter/test/main/ignore_files/user_created_collections.ets @@ -0,0 +1,28 @@ +/* + * 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. + */ + +export namespace collections { + export class Array implements ConcatArray { + constructor(); + } + + export class Map { + constructor(entries?: readonly (readonly [K, V])[] | null); + } + + export interface ConcatArray { + + } +} diff --git a/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.ets b/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.ets index ec7742adfb5b2ee082fb7a749ce18649f122ccb5..4fcec2676d87b284296b19f507e5d75feed4910f 100644 --- a/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.ets +++ b/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.ets @@ -38,6 +38,6 @@ function concurrency () { process.isIsolatedProcess(); taskpool.cancel(); ArkTSUtils.locks.AsyncLock -collections.Set() -collections.Set() +Set() +Set() fooAs.getFoo(); diff --git a/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.json b/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.json index ca88f857e960b437dcf767c0ac40be998c8f1236..c7db0a9d1487d65a3b6d10b4de007317aece3726 100644 --- a/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.json +++ b/ets2panda/linter/test/main/no_import_concurrency.ets.migrate.json @@ -13,5 +13,26 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [] -} \ No newline at end of file + "result": [ + { + "line": 41, + "column": 1, + "endLine": 41, + "endColumn": 6, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 1, + "endLine": 42, + "endColumn": 6, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/main/oh_modules/@ohos.app.ability.AbilityStage.d.ts b/ets2panda/linter/test/main/oh_modules/@ohos.app.ability.AbilityStage.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b55881d9048802032a602b6e48b83a8722ba7b5a --- /dev/null +++ b/ets2panda/linter/test/main/oh_modules/@ohos.app.ability.AbilityStage.d.ts @@ -0,0 +1,25 @@ +/* + * 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. + */ + +import ApplicationContext from './ApplicationContext'; + +export default class AbilityStage { + + context: ApplicationContext; + + onCreate(): void; + +} + diff --git a/ets2panda/linter/test/main/oh_modules/ApplicationContext.d.ts b/ets2panda/linter/test/main/oh_modules/ApplicationContext.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..838e34b98c58a262b5b7a8c175ee0e70ab88129a --- /dev/null +++ b/ets2panda/linter/test/main/oh_modules/ApplicationContext.d.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ + +export default class ApplicationContext { + on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): number; + off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback): void; + getApplicationContext(): ApplicationContext; +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle.ets b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle.ets index 71d8cd2396a17b3ef5261f5ddb4d43efe5230b73..b3af1c4b7764f50f47272f85f4e3c83fe158323d 100644 --- a/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle.ets +++ b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle.ets @@ -14,28 +14,58 @@ */ import { UIAbility } from '@kit.AbilityKit'; +import { UIExtensionAbility } from '@kit.AbilityKit'; +import { AutoFillExtensionAbility } from '@kit.AbilityKit'; +import { ServiceExtensionAbility } from '@kit.AbilityKit'; function sleep(ms: number): Promise { return new Promise((resolve, reject) => { setTimeout(resolve, ms) }) } -export default class MyUIAbility extends UIAbility { - async onDestroy(): Promise { // ❌ Error + +function sleep1(ms: number): void { + return void +} + +export default class MyUIAbility1 extends UIAbility { + async onDestroy(): Promise { // use UIAbility onDestroy, should report error hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); return sleep(1000); } } +export default class MyUIAbility2 extends UIExtensionAbility { + async onDestroy(): Promise { // use UIExtensionAbility onDestroy, should report error + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + return sleep(1000); + } +} -function sleep(ms: number): Promise { - return new Promise((resolve, reject) => { - setTimeout(resolve, ms) - }) +export default class MyUIAbility3 extends AutoFillExtensionAbility { + async onDestroy(): Promise { // use AutoFillExtensionAbility onDestroy, should report error + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + return sleep(1000); + } } -export default class MyUIAbility extends UIAbility { - onDestroy() { // ❌ Error + +export default class MyUIAbility4 extends ServiceExtensionAbility { + async onDisconnect(): Promise { // use UIAbility onDestroy, should report error hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); return sleep(1000); } } + +export default class MyUIAbility5 extends UIAbility { + onDestroy() { // use UIAbility onDestroy with Promise return, should report error + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + return sleep(1000); + } +} + +export default class MyUIAbility6 extends UIAbility { + onDestroy() { // use UIAbility onDestroy with void return, should not report error + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + return sleep1(1000); + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle.ets.arkts2.json b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle.ets.arkts2.json index dd37cd82be901a52af98be7a50ce82d1870dcb01..423ad83ad2f85bf7c107bf44a8f895f378362bc3 100644 --- a/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle.ets.arkts2.json +++ b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle.ets.arkts2.json @@ -15,29 +15,29 @@ ], "result": [ { - "line": 18, - "column": 1, - "endLine": 22, - "endColumn": 2, - "problem": "TsOverload", + "line": 22, + "column": 10, + "endLine": 24, + "endColumn": 5, + "problem": "GenericCallNoTypeArgs", "suggest": "", - "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, { - "line": 19, + "line": 28, "column": 10, - "endLine": 21, - "endColumn": 5, - "problem": "GenericCallNoTypeArgs", + "endLine": 28, + "endColumn": 14, + "problem": "VoidOperator", "suggest": "", - "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "rule": "\"void\" operator is not supported (arkts-no-void-operator)", "severity": "ERROR" }, { - "line": 24, + "line": 32, "column": 3, - "endLine": 27, + "endLine": 35, "endColumn": 4, "problem": "LimitedVoidTypeFromSdk", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 24, + "line": 32, "column": 9, - "endLine": 24, + "endLine": 32, "endColumn": 18, "problem": "SdkAbilityAsynchronousLifecycle", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 34, "column": 18, - "endLine": 26, + "endLine": 34, "endColumn": 22, "problem": "NumericSemantics", "suggest": "", @@ -65,29 +65,79 @@ "severity": "ERROR" }, { - "line": 31, - "column": 1, - "endLine": 35, - "endColumn": 2, - "problem": "TsOverload", + "line": 39, + "column": 3, + "endLine": 42, + "endColumn": 4, + "problem": "LimitedVoidTypeFromSdk", "suggest": "", - "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "rule": "Type \"void\" has no instances.(sdk-limited-void-type)", "severity": "ERROR" }, { - "line": 32, - "column": 10, - "endLine": 34, - "endColumn": 5, - "problem": "GenericCallNoTypeArgs", + "line": 39, + "column": 9, + "endLine": 39, + "endColumn": 18, + "problem": "SdkAbilityAsynchronousLifecycle", "suggest": "", - "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "rule": "1.2 Void cannot be combined. OnDestroy/onDisconnect (The return type of the method is now void | Promise) needs to be split into two interfaces. (sdk-ability-asynchronous-lifecycle)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 18, + "endLine": 41, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 9, + "endLine": 46, + "endColumn": 18, + "problem": "SdkAbilityAsynchronousLifecycle", + "suggest": "", + "rule": "1.2 Void cannot be combined. OnDestroy/onDisconnect (The return type of the method is now void | Promise) needs to be split into two interfaces. (sdk-ability-asynchronous-lifecycle)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 18, + "endLine": 48, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 37, + "line": 53, + "column": 9, + "endLine": 53, + "endColumn": 21, + "problem": "SdkAbilityAsynchronousLifecycle", + "suggest": "", + "rule": "1.2 Void cannot be combined. OnDestroy/onDisconnect (The return type of the method is now void | Promise) needs to be split into two interfaces. (sdk-ability-asynchronous-lifecycle)", + "severity": "ERROR" + }, + { + "line": 55, + "column": 18, + "endLine": 55, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 60, "column": 3, - "endLine": 40, + "endLine": 63, "endColumn": 4, "problem": "LimitedVoidTypeFromSdk", "suggest": "", @@ -95,9 +145,9 @@ "severity": "ERROR" }, { - "line": 37, + "line": 60, "column": 3, - "endLine": 37, + "endLine": 60, "endColumn": 12, "problem": "SdkAbilityAsynchronousLifecycle", "suggest": "", @@ -105,14 +155,34 @@ "severity": "ERROR" }, { - "line": 39, + "line": 62, "column": 18, - "endLine": 39, + "endLine": 62, "endColumn": 22, "problem": "NumericSemantics", "suggest": "", "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" + }, + { + "line": 67, + "column": 3, + "endLine": 70, + "endColumn": 4, + "problem": "LimitedVoidTypeFromSdk", + "suggest": "", + "rule": "Type \"void\" has no instances.(sdk-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 19, + "endLine": 69, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets new file mode 100644 index 0000000000000000000000000000000000000000..d480eb33021fa05682128f0e7e3b3f00db3e9aa9 --- /dev/null +++ b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets @@ -0,0 +1,37 @@ +/* + * 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. + */ + +import { ServiceExtensionAbility } from '@kit.AbilityKit'; + +function sleep(ms: number): Promise { + return new Promise((resolve, reject) => { + setTimeout(resolve, ms) + }) +} + +export default class MyUIAbility1 extends ServiceExtensionAbility { + async onDestroy(): Promise { // use ServiceExtensionAbility onDestroy, should not report error + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + return sleep(1000); + } +} + +class UIAbility {} +export default class MyUIAbility2 extends UIAbility { + async onDestroy(): Promise { // use UIAbility not from SDK, should not report error + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + return sleep(1000); + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.args.json b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..66fb88f85945924e8be0e83d90123507033f4c5d --- /dev/null +++ b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } +} diff --git a/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.arkts2.json b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..e5e2d851980528aac83f9b8a48bfbeac0f63876b --- /dev/null +++ b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.arkts2.json @@ -0,0 +1,48 @@ +{ + "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": 19, + "column": 10, + "endLine": 21, + "endColumn": 5, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 18, + "endLine": 27, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 18, + "endLine": 35, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.json b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/main/sdk_ability_asynchronous_lifecycle_2.ets.json @@ -0,0 +1,17 @@ +{ + "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": [] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets index a204f773197277e1b47b3e819c5e992938846f32..b3c46a743715c647bfe939c22f9f54d46d4dd7d6 100644 --- a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets +++ b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets @@ -13,23 +13,76 @@ * limitations under the License. */ -import { UIAbility } from '@kit.AbilityKit'; -import { MyAbility } from 'X'; +import AbilityStage from './oh_modules/@ohos.app.ability.AbilityStage'; +import ApplicationContext from './oh_modules/ApplicationContext'; class MyAbilityStage extends AbilityStage { onCreate() { let abilityLifecycleCallback: AbilityLifecycleCallback = { - onAbilityCreate(ability:UIAbility) { - let myAbility:MyAbility = ability as MyAbility; - myAbility.foo() + onAbilityCreate(ability) { + }, + onWindowStageCreate: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageActive: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageInactive: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageDestroy: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onAbilityDestroy: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityForeground: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityBackground: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityContinue: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + } } + let applicationContext = this.context.getApplicationContext(); + let lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback); // report error normally } - let applicationContext = appMgr.getApplicationContext(); - try { - // 2.通过applicationContext注册监听应用内生命周期 - lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback); // Error - } catch (paramError) { - console.error(`error: ${(paramError as BusinessError).code}, ${(paramError as BusinessError).message}`); +} + +class MyAbilityStage extends AbilityStage { + onCreate() { + let abilityLifecycleCallback: AbilityLifecycleCallback = { + onAbilityCreate(ability) { + }, + onWindowStageCreate: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageActive: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageInactive: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageDestroy: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onAbilityDestroy: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityForeground: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityBackground: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityContinue: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + } } + let applicationContext = new ApplicationContext(); + let lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback); // report error normally } } + diff --git a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets.arkts2.json b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets.arkts2.json index 1bb9b8c66ff1e070ddc91480fad1d52e4bc853c3..9a76fd60376d25fe87eb98c5bad5f73c7682fb7c 100644 --- a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets.arkts2.json +++ b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets.arkts2.json @@ -1,10 +1,24 @@ { + "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": 22, "column": 7, - "endLine": 25, - "endColumn": 6, + "endLine": 23, + "endColumn": 8, "problem": "ObjectLiteralProperty", "suggest": "", "rule": "Object literal properties can only contain name-value pairs (arkts-obj-literal-props)", @@ -21,54 +35,64 @@ "severity": "ERROR" }, { - "line": 22, - "column": 31, - "endLine": 22, - "endColumn": 40, - "problem": "AnyType", + "line": 50, + "column": 9, + "endLine": 50, + "endColumn": 90, + "problem": "NumericSemantics", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 27, - "column": 9, - "endLine": 27, - "endColumn": 60, - "problem": "AnyType", + "line": 50, + "column": 23, + "endLine": 50, + "endColumn": 90, + "problem": "SdkAbilityLifecycleMonitor", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "The UIAbility of 1.2 needs to be listened by the new StaticAbilityLifecycleCallback. The original AbilityLifecycleCallback can only listen to the UIAbility of 1.1 (sdk-ability-lifecycle-monitor)", "severity": "ERROR" }, { - "line": 30, - "column": 21, - "endLine": 30, - "endColumn": 88, - "problem": "SdkAbilityLifecycleMonitor", + "line": 57, + "column": 7, + "endLine": 58, + "endColumn": 8, + "problem": "ObjectLiteralProperty", "suggest": "", - "rule": "The UIAbility of 1.2 needs to be listened by the new StaticAbilityLifecycleCallback. The original AbilityLifecycleCallback can only listen to the UIAbility of 1.1 (sdk-ability-lifecycle-monitor)", + "rule": "Object literal properties can only contain name-value pairs (arkts-obj-literal-props)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 23, + "endLine": 57, + "endColumn": 30, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 32, - "column": 46, - "endLine": 32, - "endColumn": 59, - "problem": "UIInterfaceImport", + "line": 85, + "column": 9, + "endLine": 85, + "endColumn": 90, + "problem": "NumericSemantics", "suggest": "", - "rule": "The ArkUI interface \"BusinessError\" should be imported before it is used (arkui-modular-interface)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 32, - "column": 85, - "endLine": 32, - "endColumn": 98, - "problem": "UIInterfaceImport", + "line": 85, + "column": 23, + "endLine": 85, + "endColumn": 90, + "problem": "SdkAbilityLifecycleMonitor", "suggest": "", - "rule": "The ArkUI interface \"BusinessError\" should be imported before it is used (arkui-modular-interface)", + "rule": "The UIAbility of 1.2 needs to be listened by the new StaticAbilityLifecycleCallback. The original AbilityLifecycleCallback can only listen to the UIAbility of 1.1 (sdk-ability-lifecycle-monitor)", "severity": "ERROR" } ] -} +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets.json b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets.json index d651a483feeff55940b384a204da36fb4dd6ddf6..81beed97c616587a30286ec0e80e1fd643531b12 100644 --- a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets.json +++ b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor.ets.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": 22, @@ -11,20 +25,10 @@ "severity": "ERROR" }, { - "line": 22, - "column": 31, - "endLine": 22, - "endColumn": 40, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 27, - "column": 9, - "endLine": 27, - "endColumn": 60, + "line": 57, + "column": 23, + "endLine": 57, + "endColumn": 30, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", diff --git a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a16dab7436ce3fba442cfd7d0e0729ca4b569bf --- /dev/null +++ b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets @@ -0,0 +1,59 @@ +/* + * 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. + */ + +class AbilityStage { + context: ApplicationContext; + onCreate(): void; +} + +class ApplicationContext { + on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): number; + off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback): void; + getApplicationContext(): ApplicationContext; +} +class MyAbilityStage extends AbilityStage { + onCreate() { + let abilityLifecycleCallback: AbilityLifecycleCallback = { + onAbilityCreate(ability) { + }, + onWindowStageCreate: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageActive: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageInactive: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onWindowStageDestroy: (ability: UIAbility, windowStage: window.WindowStage): void => { + throw new Error('Function not implemented.'); + }, + onAbilityDestroy: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityForeground: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityBackground: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + }, + onAbilityContinue: (ability: UIAbility): void => { + throw new Error('Function not implemented.'); + } + } + let applicationContext = this.context.getApplicationContext(); + let lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback); // No report error for the source is not target + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.args.json b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..b214d57430c6b63de949705fe4fc0db53c4bb327 --- /dev/null +++ b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.args.json @@ -0,0 +1,19 @@ +{ + "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": "" + } + } diff --git a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.arkts2.json b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..e4b1cf0272d520cfef98a19210a6d6f54b659d81 --- /dev/null +++ b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.arkts2.json @@ -0,0 +1,58 @@ +{ + "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": 29, + "column": 7, + "endLine": 30, + "endColumn": 8, + "problem": "ObjectLiteralProperty", + "suggest": "", + "rule": "Object literal properties can only contain name-value pairs (arkts-obj-literal-props)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 23, + "endLine": 29, + "endColumn": 30, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 9, + "endLine": 57, + "endColumn": 90, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 3, + "endLine": 17, + "endColumn": 10, + "problem": "StrictDiagnostic", + "suggest": "Property 'context' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'context' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.json b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..20ef67fcd05fda79aa98cd3c55147ad84eae4786 --- /dev/null +++ b/ets2panda/linter/test/main/sdk_ability_lifecycle_monitor_2.ets.json @@ -0,0 +1,38 @@ +{ + "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": 29, + "column": 23, + "endLine": 29, + "endColumn": 30, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 3, + "endLine": 17, + "endColumn": 10, + "problem": "StrictDiagnostic", + "suggest": "Property 'context' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'context' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/undefined_check_calls.ets.json b/ets2panda/linter/test/main/undefined_check_calls.ets.json index 65d18bdd6ce29e4f1a1a9139c61c2fb109978060..2085f45b054f42c324cfb371cebe43666612f6ab 100644 --- a/ets2panda/linter/test/main/undefined_check_calls.ets.json +++ b/ets2panda/linter/test/main/undefined_check_calls.ets.json @@ -1,6 +1,6 @@ { "copyright": [ - "Copyright (c) 2023-2024 Huawei Device Co., Ltd.", + "Copyright (c) 2023-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", @@ -145,4 +145,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +}