From 959a88077f237ba87adb8aa6005cc93ed15e4156 Mon Sep 17 00:00:00 2001 From: wangjiahui Date: Wed, 3 Sep 2025 10:14:01 +0800 Subject: [PATCH] 0702 sync 0728 Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICW3FP Signed-off-by: wangjiahui --- .../checker/migration/NumericSemanticCheck.ts | 6 +- ets2panda/linter/src/lib/CookBookMsg.ts | 3 +- ets2panda/linter/src/lib/TypeScriptLinter.ts | 66 ++- .../linter/src/lib/autofixes/Autofixer.ts | 39 +- .../src/lib/data/DeprecatedApiList.json | 21 + .../src/lib/utils/consts/ArkuiConstants.ts | 4 + .../src/lib/utils/consts/ArkuiDecorator.ts | 55 +++ .../src/lib/utils/consts/ArkuiImportList.ts | 29 -- .../src/lib/utils/consts/DeprecatedApi.ts | 57 +-- .../test/deprecatedapi/Back.ets.arkts2.json | 10 - .../NavigationType.ets.arkts2.json | 30 -- .../test/deprecatedapi/Push.ets.arkts2.json | 10 - .../deprecatedapi/Replace.ets.arkts2.json | 10 - .../ability_component.ets.arkts2.json | 10 - .../appscreenOnVisible_api.ets.arkts2.json | 10 - .../test/deprecatedapi/common.ets.arkts2.json | 70 ---- .../deprecatedapi/common_api.ets.arkts2.json | 10 - .../deprecatedapi/custom_api.ets.arkts2.json | 10 - .../foldable_api.ets.arkts2.json | 10 - ...ContainerOptionsMargin_api.ets.arkts2.json | 30 -- .../grid_container.ets.arkts2.json | 70 ---- .../deprecatedapi/minibar_api.ets.arkts2.json | 10 - .../navigator_api.ets.arkts2.json | 10 - .../panelModePanelMode_api.ets.arkts2.json | 30 -- .../temporary_api.ets.arkts2.json | 10 - .../wrap_content_api.ets.arkts2.json | 10 - .../test/interop/unique_types.ets.arkts2.json | 12 +- .../interop/unique_types.ets.autofix.json | 12 +- .../interop/unique_types.ets.migrate.json | 42 +- .../interop/unique_types2.ets.arkts2.json | 82 +--- .../interop/unique_types3.ets.arkts2.json | 382 +----------------- .../test/main/arkts-array-type-immutable.ets | 2 + ...arkts-array-type-immutable.ets.arkts2.json | 10 + .../linter/test/main/interface_import_5.ets | 1 - .../main/interface_import_5.ets.arkts2.json | 12 +- .../main/interface_import_5.ets.autofix.json | 76 ++-- .../main/interface_import_5.ets.migrate.ets | 6 +- .../test/main/no_ts_like_smart_type.ets | 29 ++ .../no_ts_like_smart_type.ets.arkts2.json | 74 ++++ .../test/main/no_ts_like_smart_type.ets.json | 64 +++ 40 files changed, 436 insertions(+), 998 deletions(-) create mode 100644 ets2panda/linter/src/lib/utils/consts/ArkuiDecorator.ts diff --git a/ets2panda/linter/homecheck/src/checker/migration/NumericSemanticCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/NumericSemanticCheck.ts index 359b025482..bff6fd3a64 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/NumericSemanticCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/NumericSemanticCheck.ts @@ -1014,9 +1014,11 @@ export class NumericSemanticCheck implements BaseChecker { const ets1Class = ets1SDK.getDeclaringArkClass(); const ets1Namespace = ets1Class.getDeclaringArkNamespace(); if (ets1Namespace === undefined) { - return ets2File.getClassWithName(ets1Class.getName())?.getMethodWithName(ets1SDK.getName()) ?? null; + const ets2Class = ets2File.getClassWithName(ets1Class.getName()); + return ets2Class?.getMethodWithName(ets1SDK.getName()) ?? ets2Class?.getStaticMethodWithName(ets1SDK.getName()) ?? null; } - return ets2File.getNamespaceWithName(ets1Namespace.getName())?.getClassWithName(ets1Class.getName())?.getMethodWithName(ets1SDK.getName()) ?? null; + const ets2Class = ets2File.getNamespaceWithName(ets1Namespace.getName())?.getClassWithName(ets1Class.getName()); + return ets2Class?.getMethodWithName(ets1SDK.getName()) ?? ets2Class?.getStaticMethodWithName(ets1SDK.getName()) ?? null; } // 判断类型是否为int,当前ArkAnalyzer对于int的表示应该是name为int的AliasType或UnclearReferenceType diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index 7a3f6d4552..cfd5fc0a1b 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -440,7 +440,8 @@ cookBookTag[410] = 'Numeric literal exceeds allowed range (arkts-no-large-numeri cookBookTag[411] = '"instanceof" operator can\'t be applied to function (arkts-no-instanceof-func)'; cookBookTag[412] = 'No unfixed length tuple support (arkts-no-unfixed-len-tuple)'; -cookBookTag[413] = 'Subclass can\'t call members of super class in static context (arkts-no-super-call-in-static-context)'; +cookBookTag[413] = + 'Subclass can\'t call members of super class in static context (arkts-no-super-call-in-static-context)'; for (let i = 0; i <= cookBookTag.length; i++) { cookBookMsg[i] = ''; } diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index bdd815d5ef..cb56e385e1 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -225,6 +225,7 @@ import { COMPONENT_DECORATOR, SELECT_IDENTIFIER, SELECT_OPTIONS, STRING_ERROR_LI import { ES_OBJECT } from './utils/consts/ESObject'; import { cookBookMsg } from './CookBookMsg'; import { getCommonApiInfoMap } from './utils/functions/CommonApiInfo'; +import { arkuiDecoratorSet } from './utils/consts/ArkuiDecorator'; export class TypeScriptLinter extends BaseTypeScriptLinter { supportedStdCallApiChecker: SupportedStdCallApiChecker; @@ -1634,6 +1635,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private checkUsageOfTsTypes(baseType: ts.Type, node: ts.Node): void { const typeString = this.tsTypeChecker.typeToString(baseType); + + const symbol = baseType.getSymbol(); + if (symbol && !isStdLibrarySymbol(symbol)) { + return; + } + if ( TsUtils.isAnyType(baseType) || TsUtils.isUnknownType(baseType) || @@ -1934,7 +1941,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } - const extendedIdent = parent.heritageClauses.at(0); + const extendedIdent = parent.heritageClauses[0]; if (!TsUtils.hasModifier(propDecl.modifiers, ts.SyntaxKind.ReadonlyKeyword)) { return; @@ -1960,7 +1967,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return undefined; } - const extendedType = extended.types.at(0); + const extendedType = extended.types[0]; if (!extendedType) { return undefined; } @@ -8350,6 +8357,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const isArray = this.tsUtils.isArray(lhsType) && this.tsUtils.isArray(rhsType); + if (isArray && this.tsTypeChecker.typeToString(lhsType) === 'never[]') { + return; + } const isTuple = this.tsUtils.isOrDerivedFrom(lhsType, TsUtils.isTuple) && this.tsUtils.isOrDerivedFrom(rhsType, TsUtils.isTuple); if (!((isArray || isTuple) && lhsType !== rhsType)) { @@ -12458,7 +12468,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } return; } - if (actualTypeName !== expectedType) { + if (actualTypeName !== expectedType && expectedType !== 'any') { this.incrementCounters(arg, FaultID.NoTsLikeSmartType); } } @@ -12692,6 +12702,14 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { methodReturnType: ts.Type ): void { const propName = propAccess.name.getText(); + const decl = this.tsTypeChecker.getSymbolAtLocation(propAccess.name)?.declarations?.[0]; + if (decl && ts.isPropertyDeclaration(decl) && decl.type) { + if (decl.type.kind === ts.SyntaxKind.BooleanKeyword && decl.questionToken === undefined) { + return; + } else if (!this.tsTypeChecker.getTypeAtLocation(decl.name).isUnion()) { + return; + } + } const propType = propsMap.get(propName); if (propType && this.isExactlySameType(propType, methodReturnType)) { @@ -14386,7 +14404,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const deprecatedApiCheckMap = TypeScriptLinter.getDeprecatedApiCheckMapForCallExpression(decl, parName); this.reportDeprecatedApi(node, name, deprecatedApiCheckMap); this.checkCallExpressionForSdkApi(node, name, parName, !!isNeedGetResolvedSignature, deprecatedApiCheckMap); - this.checkSpecialApiForDeprecatedApi(node, name, decl); + this.checkSpecialApiForDeprecatedApi(node, name); + this.checkOnScrollApiForDeprecatedApi(name, decl); } private static getDeprecatedApiCheckMapForCallExpression( @@ -14474,9 +14493,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const problemStr = this.getFaultIdWithMatchedDeprecatedApi(name.text, deprecatedApiCheckMap, apiType); if (problemStr.length > 0) { const autofix = this.autofixer?.fixDeprecatedApiForCallExpression(node); - if (autofix) { - this.interfacesNeedToImport.add('getUIContext'); - } const isSdkCommon = apiType === SDK_COMMON_TYPE; const faultID = TypeScriptLinter.getFinalSdkFaultIdByProblem(problemStr, apiType); if (!faultID) { @@ -14505,11 +14521,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return sdkFaultId; } - private checkSpecialApiForDeprecatedApi( - node: ts.CallExpression, - name: ts.Identifier, - decl: ts.Declaration | undefined - ): void { + private checkSpecialApiForDeprecatedApi(node: ts.CallExpression, name: ts.Identifier): void { if (('mask' === name.getText() || 'clip' === name.getText()) && node.arguments.length === 1) { const types = ['CircleAttribute', 'EllipseAttribute', ' PathAttribute', 'RectAttribute']; const arg = node.arguments[0]; @@ -14528,13 +14540,25 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const autofix = this.autofixer?.fixSpecialDeprecatedApiForCallExpression(node, name); - this.incrementCounters(name, FaultID.NoDeprecatedApi, autofix); + this.incrementCounters( + name, + FaultID.NoDeprecatedApi, + autofix, + TypeScriptLinter.getErrorMsgForSdkCommonApi(name.getText(), FaultID.NoDeprecatedApi) + ); return; } - this.incrementCounters(name, FaultID.NoDeprecatedApi); - return; + this.incrementCounters( + name, + FaultID.NoDeprecatedApi, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(name.getText(), FaultID.NoDeprecatedApi) + ); } } + } + + private checkOnScrollApiForDeprecatedApi(name: ts.Identifier, decl: ts.Declaration | undefined): void { if (decl?.parent && ts.isClassDeclaration(decl.parent) && 'onScroll' === name.getText()) { let parentName = ''; decl.parent.heritageClauses?.forEach((clause) => { @@ -14545,7 +14569,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { }); }); if (parentName === 'ScrollableCommonMethod') { - this.incrementCounters(name, FaultID.NoDeprecatedApi); + this.incrementCounters( + name, + FaultID.NoDeprecatedApi, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(name.getText(), FaultID.NoDeprecatedApi) + ); } } } @@ -15412,6 +15441,11 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!this.options.arkts2 || !TypeScriptLinter.builtApiInfo) { return; } + + if (arkuiDecoratorSet.has(decorator.expression.getText())) { + return; + } + const type = this.tsTypeChecker.getTypeAtLocation(decorator.expression); const aliasSymbol = type.aliasSymbol; const declaration = aliasSymbol?.declarations?.[0]; diff --git a/ets2panda/linter/src/lib/autofixes/Autofixer.ts b/ets2panda/linter/src/lib/autofixes/Autofixer.ts index 8fec792915..1972b3e1e1 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -43,7 +43,10 @@ import { NEW_PROP_DECORATOR_SUFFIX, VIRTUAL_SCROLL_IDENTIFIER, DISABLE_VIRTUAL_SCROLL_IDENTIFIER, - USE_STATIC_STATEMENT + USE_STATIC_STATEMENT, + UI_CONTEXT, + GET_FOCUSED_UI_CONTEXT, + GET_CONTEXT } from '../utils/consts/ArkuiConstants'; import { ES_VALUE } from '../utils/consts/ESObject'; import type { IncrementDecrementNodeInfo } from '../utils/consts/InteropAPI'; @@ -5312,18 +5315,11 @@ export class Autofixer { } 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 newExpression = Autofixer.createUIContextAccess(methodName); const newText = this.printer.printNode(ts.EmitHint.Unspecified, newExpression, callExpr.getSourceFile()); return [ { @@ -5338,23 +5334,38 @@ export class Autofixer { if (ts.isIdentifier(callExpr.expression)) { const identifierText = callExpr.expression.getText(); const methodName = identifierReplacements.get(identifierText); - if (methodName) { - const newExpression = createUIContextAccess(methodName); + const accessExpr = Autofixer.createUIContextAccess(methodName); + const newExpression = identifierText === GET_CONTEXT + ? ts.factory.createCallChain(accessExpr, undefined, undefined, []) + : accessExpr; + const start = identifierText === GET_CONTEXT ? callExpr.getStart() : callExpr.expression.getStart(); + const end = identifierText === GET_CONTEXT ? callExpr.getEnd() : callExpr.expression.getEnd(); const newText = this.printer.printNode(ts.EmitHint.Unspecified, newExpression, callExpr.getSourceFile()); return [ { - start: callExpr.expression.getStart(), - end: callExpr.expression.getEnd(), + start: start, + end: end, replacementText: newText } ]; } } - return undefined; } + private static createUIContextAccess(methodName: string): ts.PropertyAccessExpression { + return ts.factory.createPropertyAccessChain( + ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression( + ts.factory.createIdentifier(UI_CONTEXT), + ts.factory.createIdentifier(GET_FOCUSED_UI_CONTEXT) + ), undefined, []), + ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), + ts.factory.createIdentifier(methodName) + ); + } + fixSpecialDeprecatedApiForCallExpression(callExpr: ts.CallExpression, name: ts.Identifier): Autofix[] | undefined { if (name.getText() !== 'clip' || !ts.isNewExpression(callExpr.arguments[0])) { return undefined; diff --git a/ets2panda/linter/src/lib/data/DeprecatedApiList.json b/ets2panda/linter/src/lib/data/DeprecatedApiList.json index 2c05b55d14..310ca8b05d 100644 --- a/ets2panda/linter/src/lib/data/DeprecatedApiList.json +++ b/ets2panda/linter/src/lib/data/DeprecatedApiList.json @@ -10364,6 +10364,27 @@ }, "import_path": [], "is_global": true + }, + { + "file_path": "api/@internal/component/ets/context_menu.d.ts", + "api_info": { + "line": 1, + "problem": "", + "api_name": "close", + "api_type": "MethodSignature", + "parent_api": [ + { + "api_name": "ContextMenu", + "api_type": "" + } + ], + "code_kind": 173, + "api_optional": false, + "api_func_args": [], + "method_return_type": "any" + }, + "import_path": [], + "is_global": true } ] } \ No newline at end of file diff --git a/ets2panda/linter/src/lib/utils/consts/ArkuiConstants.ts b/ets2panda/linter/src/lib/utils/consts/ArkuiConstants.ts index 5b17c7dad5..7165daa561 100644 --- a/ets2panda/linter/src/lib/utils/consts/ArkuiConstants.ts +++ b/ets2panda/linter/src/lib/utils/consts/ArkuiConstants.ts @@ -185,3 +185,7 @@ export const GLOBAL_CONNECT_FUNC_NAME = 'globalConnect'; export const CONNECT_FUNC_NAME = 'connect'; export const USE_STATIC_STATEMENT = 'use static'; + +export const GET_CONTEXT = 'getContext'; +export const UI_CONTEXT = 'UIContext'; +export const GET_FOCUSED_UI_CONTEXT = 'getFocusedUIContext'; diff --git a/ets2panda/linter/src/lib/utils/consts/ArkuiDecorator.ts b/ets2panda/linter/src/lib/utils/consts/ArkuiDecorator.ts new file mode 100644 index 0000000000..6fd2d824c5 --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/ArkuiDecorator.ts @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 arkuiDecoratorSet: Set = new Set([ + 'Styles', + 'Extend', + 'Entry', + 'Preview', + 'Component', + 'Builder', + 'LocalBuilder', + 'BuilderParam', + 'AnimatableExtend', + 'Require', + 'Reusable', + 'State', + 'Prop', + 'Link', + 'Provide', + 'Consume', + 'Observed', + 'ObjectLink', + 'LocalStorageProp', + 'LocalStorageLink', + 'StorageProp', + 'StorageLink', + 'Watch', + 'Track', + 'ObservedV2', + 'Trace', + 'ComponentV2', + 'Local', + 'Param', + 'Once', + 'Event', + 'Provider', + 'Consumer', + 'Monitor', + 'Computed', + 'Type', + 'ReusableV2', + 'CustomDialog' +]); diff --git a/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts b/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts index d4b3959341..f838d0e6de 100644 --- a/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts +++ b/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts @@ -15,8 +15,6 @@ export const arkuiImportList: Set = new Set([ 'ASTCResource', - 'AbilityComponent', - 'AbilityComponentAttribute', 'AbstractProperty', 'AccelerationOptions', 'AccessibilityAction', @@ -27,14 +25,12 @@ export const arkuiImportList: Set = new Set([ 'AccessibilityOptions', 'AccessibilityRoleType', 'AccessibilitySamePageMode', - 'ActionSheet', 'ActionSheetButtonOptions', 'ActionSheetOffset', 'ActionSheetOptions', 'AdaptiveColor', 'AdsBlockedDetails', 'Affinity', - 'AlertDialog', 'AlertDialogButtonBaseOptions', 'AlertDialogButtonOptions', 'AlertDialogParam', @@ -245,7 +241,6 @@ export const arkuiImportList: Set = new Set([ 'ContentSlotAttribute', 'ContentType', 'Context', - 'ContextMenu', 'ContextMenuAnimationOptions', 'ContextMenuEditStateFlags', 'ContextMenuInputFieldType', @@ -507,9 +502,6 @@ export const arkuiImportList: Set = new Set([ 'GridColAttribute', 'GridColColumnOption', 'GridColOptions', - 'GridContainer', - 'GridContainerAttribute', - 'GridContainerOptions', 'GridDirection', 'GridItem', 'GridItemAlignment', @@ -797,9 +789,6 @@ export const arkuiImportList: Set = new Set([ 'NavExtender', 'NavPathInfo', 'NavPathStack', - 'NavRouteMode', - 'NavRouter', - 'NavRouterAttribute', 'Navigation', 'NavigationAnimatedTransition', 'NavigationAttribute', @@ -818,9 +807,6 @@ export const arkuiImportList: Set = new Set([ 'NavigationTitleOptions', 'NavigationToolbarOptions', 'NavigationTransitionProxy', - 'NavigationType', - 'Navigator', - 'NavigatorAttribute', 'NestedScrollInfo', 'NestedScrollMode', 'NestedScrollOptions', @@ -943,11 +929,6 @@ export const arkuiImportList: Set = new Set([ 'PanGestureOptions', 'PanGestureParams', 'PanRecognizer', - 'Panel', - 'PanelAttribute', - 'PanelHeight', - 'PanelMode', - 'PanelType', 'ParagraphStyle', 'ParagraphStyleInterface', 'Param', @@ -1181,7 +1162,6 @@ export const arkuiImportList: Set = new Set([ 'RotationRecognizer', 'RoundRectShapeOptions', 'RoundedRectOptions', - 'RouteInfo', 'RouteMapConfig', 'RouteType', 'RouterPageInfo', @@ -1287,7 +1267,6 @@ export const arkuiImportList: Set = new Set([ 'SizeOptions', 'SizeResult', 'SizeT', - 'SizeType', 'SlideEffect', 'SlideRange', 'Slider', @@ -1603,22 +1582,14 @@ export const arkuiImportList: Set = new Set([ 'XComponentController', 'XComponentOptions', 'XComponentType', - 'animateTo', 'animateToImmediately', 'cursorControl', 'focusControl', - 'fp2px', - 'getContext', 'getInspectorNodeById', 'getInspectorNodes', - 'lpx2px', 'postCardAction', - 'px2fp', - 'px2lpx', - 'px2vp', 'setAppBgColor', 'sharedTransitionOptions', - 'vp2px', '$r', '$rawfile' ]); diff --git a/ets2panda/linter/src/lib/utils/consts/DeprecatedApi.ts b/ets2panda/linter/src/lib/utils/consts/DeprecatedApi.ts index fc29b7df09..235da17e68 100644 --- a/ets2panda/linter/src/lib/utils/consts/DeprecatedApi.ts +++ b/ets2panda/linter/src/lib/utils/consts/DeprecatedApi.ts @@ -20,38 +20,39 @@ export const propertyAccessReplacements = new Map([ ['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'], + ['MeasureText.measureTextSize', 'getMeasureUtils().measureTextSize'], + ['MeasureText.measureText', 'getMeasureUtils().measureText'], + ['dragController.getDragPreview', 'getDragController().getDragPreview'], + ['dragController.createDragAction', 'getDragController().createDragAction'], + ['dragController.executeDrag', 'getDragController().executeDrag'], ['LocalStorage.getShared', 'getSharedLocalStorage'], - ['inspector.createComponentObserver', 'createInspector.createComponentObserver'], + ['inspector.createComponentObserver', 'getUIInspector().createComponentObserver'], ['Animator.create', 'createAnimator'], - ['mediaquery.matchMediaSync', 'createMediaQuery.matchMediaSync'], + ['mediaquery.matchMediaSync', 'getMediaQuery().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'], + ['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'] + ['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', 'getFont().registerFont'], + ['font.getSystemFontList', 'getFont().getSystemFontList'], + ['font.getFontByName', 'getFont().getFontByName'], + ['ContextMenu.close', 'getContextMenuController().close'] ]); export const identifierReplacements = new Map([ diff --git a/ets2panda/linter/test/deprecatedapi/Back.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/Back.ets.arkts2.json index 6be00cdd54..79ca3f8436 100644 --- a/ets2panda/linter/test/deprecatedapi/Back.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/Back.ets.arkts2.json @@ -44,16 +44,6 @@ "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, diff --git a/ets2panda/linter/test/deprecatedapi/NavigationType.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/NavigationType.ets.arkts2.json index 1ea98ff096..c85423f896 100644 --- a/ets2panda/linter/test/deprecatedapi/NavigationType.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/NavigationType.ets.arkts2.json @@ -44,16 +44,6 @@ "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, @@ -64,16 +54,6 @@ "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, @@ -84,16 +64,6 @@ "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, diff --git a/ets2panda/linter/test/deprecatedapi/Push.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/Push.ets.arkts2.json index 6be00cdd54..79ca3f8436 100644 --- a/ets2panda/linter/test/deprecatedapi/Push.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/Push.ets.arkts2.json @@ -44,16 +44,6 @@ "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, diff --git a/ets2panda/linter/test/deprecatedapi/Replace.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/Replace.ets.arkts2.json index e80599387d..94ef98fd56 100644 --- a/ets2panda/linter/test/deprecatedapi/Replace.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/Replace.ets.arkts2.json @@ -44,16 +44,6 @@ "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, diff --git a/ets2panda/linter/test/deprecatedapi/ability_component.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/ability_component.ets.arkts2.json index 977dd1e591..5cc78ac9d9 100644 --- a/ets2panda/linter/test/deprecatedapi/ability_component.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/ability_component.ets.arkts2.json @@ -43,16 +43,6 @@ "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/appscreenOnVisible_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json index 1c07495231..63f68e3612 100644 --- a/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json @@ -23,16 +23,6 @@ "suggest": "", "rule": "The ArkUI interface \"screenOnVisible\" is deprecated (arkui-deprecated-interface)", "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/common.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/common.ets.arkts2.json index ad8333f4ad..5e1cfd3740 100644 --- a/ets2panda/linter/test/deprecatedapi/common.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/common.ets.arkts2.json @@ -144,16 +144,6 @@ "rule": "The ArkUI interface \"Context\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, - { - "line": 34, - "column": 36, - "endLine": 34, - "endColumn": 46, - "problem": "UIInterfaceImport", - "suggest": "", - "rule": "The ArkUI interface \"getContext\" should be imported before it is used (arkui-modular-interface)", - "severity": "ERROR" - }, { "line": 38, "column": 3, @@ -193,66 +183,6 @@ "suggest": "", "rule": "The ArkUI interface \"MouseEvent\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" - }, - { - "line": 66, - "column": 1, - "endLine": 66, - "endColumn": 7, - "problem": "UIInterfaceImport", - "suggest": "", - "rule": "The ArkUI interface \"px2lpx\" should be imported before it is used (arkui-modular-interface)", - "severity": "ERROR" - }, - { - "line": 67, - "column": 1, - "endLine": 67, - "endColumn": 7, - "problem": "UIInterfaceImport", - "suggest": "", - "rule": "The ArkUI interface \"lpx2px\" should be imported before it is used (arkui-modular-interface)", - "severity": "ERROR" - }, - { - "line": 68, - "column": 1, - "endLine": 68, - "endColumn": 6, - "problem": "UIInterfaceImport", - "suggest": "", - "rule": "The ArkUI interface \"px2fp\" should be imported before it is used (arkui-modular-interface)", - "severity": "ERROR" - }, - { - "line": 69, - "column": 1, - "endLine": 69, - "endColumn": 6, - "problem": "UIInterfaceImport", - "suggest": "", - "rule": "The ArkUI interface \"fp2px\" should be imported before it is used (arkui-modular-interface)", - "severity": "ERROR" - }, - { - "line": 70, - "column": 1, - "endLine": 70, - "endColumn": 6, - "problem": "UIInterfaceImport", - "suggest": "", - "rule": "The ArkUI interface \"px2vp\" should be imported before it is used (arkui-modular-interface)", - "severity": "ERROR" - }, - { - "line": 71, - "column": 1, - "endLine": 71, - "endColumn": 6, - "problem": "UIInterfaceImport", - "suggest": "", - "rule": "The ArkUI interface \"vp2px\" 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.arkts2.json b/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json index d74d9c0a2c..5519918a56 100644 --- a/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json @@ -444,16 +444,6 @@ "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, diff --git a/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json index 57081a47c2..6a2cfe1b53 100644 --- a/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json @@ -83,16 +83,6 @@ "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" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json index 272fe50def..100a40b54d 100644 --- a/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json @@ -83,16 +83,6 @@ "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" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.arkts2.json index 5037aad424..3839d44cb9 100644 --- a/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/gridContainerOptionsMargin_api.ets.arkts2.json @@ -44,26 +44,6 @@ "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, @@ -73,16 +53,6 @@ "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/grid_container.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/grid_container.ets.arkts2.json index a3163ebbec..9a2a529d88 100644 --- a/ets2panda/linter/test/deprecatedapi/grid_container.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/grid_container.ets.arkts2.json @@ -44,36 +44,6 @@ "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, @@ -84,16 +54,6 @@ "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, @@ -124,16 +84,6 @@ "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, @@ -194,16 +144,6 @@ "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, @@ -213,16 +153,6 @@ "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/minibar_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json index c6074fab7b..edcd8a66bc 100644 --- a/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json @@ -83,16 +83,6 @@ "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" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json index d89f2a2fbf..2d2b3de8eb 100644 --- a/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json @@ -193,16 +193,6 @@ "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/panelModePanelMode_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json index ef40455b9c..d613a8c7df 100644 --- a/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json @@ -114,16 +114,6 @@ "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, @@ -134,16 +124,6 @@ "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, @@ -154,16 +134,6 @@ "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, diff --git a/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json index e534260a3e..923c8512cd 100644 --- a/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json @@ -83,16 +83,6 @@ "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" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json index 65983ca6ef..bc2b988f76 100644 --- a/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json @@ -83,16 +83,6 @@ "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" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/interop/unique_types.ets.arkts2.json b/ets2panda/linter/test/interop/unique_types.ets.arkts2.json index aba8201c3c..296fd8ba8f 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.arkts2.json +++ b/ets2panda/linter/test/interop/unique_types.ets.arkts2.json @@ -64,16 +64,6 @@ "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, @@ -535,4 +525,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/unique_types.ets.autofix.json b/ets2panda/linter/test/interop/unique_types.ets.autofix.json index a15230739c..2a66da2e17 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.autofix.json +++ b/ets2panda/linter/test/interop/unique_types.ets.autofix.json @@ -75,16 +75,6 @@ "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, @@ -546,4 +536,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/unique_types.ets.migrate.json b/ets2panda/linter/test/interop/unique_types.ets.migrate.json index 28d850fbfb..70014c9268 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.migrate.json +++ b/ets2panda/linter/test/interop/unique_types.ets.migrate.json @@ -54,16 +54,6 @@ "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, @@ -445,14 +435,14 @@ "severity": "ERROR" }, { - "line": 323, - "column": 5, - "endLine": 325, - "endColumn": 6, - "problem": "NoLocalClass", - "suggest": "", - "rule": "Creating local classes is not supported (arkts-no-local-class)", - "severity": "ERROR" + "line": 323, + "column": 5, + "endLine": 325, + "endColumn": 6, + "problem": "NoLocalClass", + "suggest": "", + "rule": "Creating local classes is not supported (arkts-no-local-class)", + "severity": "ERROR" }, { "line": 357, @@ -475,14 +465,14 @@ "severity": "ERROR" }, { - "line": 372, - "column": 5, - "endLine": 374, - "endColumn": 6, - "problem": "NoLocalClass", - "suggest": "", - "rule": "Creating local classes is not supported (arkts-no-local-class)", - "severity": "ERROR" + "line": 372, + "column": 5, + "endLine": 374, + "endColumn": 6, + "problem": "NoLocalClass", + "suggest": "", + "rule": "Creating local classes is not supported (arkts-no-local-class)", + "severity": "ERROR" }, { "line": 184, diff --git a/ets2panda/linter/test/interop/unique_types2.ets.arkts2.json b/ets2panda/linter/test/interop/unique_types2.ets.arkts2.json index fcdd5c1d78..b5e56dd566 100644 --- a/ets2panda/linter/test/interop/unique_types2.ets.arkts2.json +++ b/ets2panda/linter/test/interop/unique_types2.ets.arkts2.json @@ -84,16 +84,6 @@ "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, @@ -104,26 +94,6 @@ "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, @@ -214,16 +184,6 @@ "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, @@ -234,36 +194,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "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": 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": 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, @@ -324,16 +254,6 @@ "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, @@ -575,4 +495,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json b/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json index 88d820858d..bbc9ee2e0a 100644 --- a/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json +++ b/ets2panda/linter/test/interop/unique_types3.ets.arkts2.json @@ -64,16 +64,6 @@ "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": 97, "column": 17, @@ -84,16 +74,6 @@ "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, @@ -114,16 +94,6 @@ "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, @@ -134,16 +104,6 @@ "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, @@ -164,166 +124,6 @@ "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": 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, @@ -334,16 +134,6 @@ "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, @@ -394,56 +184,6 @@ "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, @@ -454,16 +194,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "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, @@ -474,16 +204,6 @@ "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, @@ -494,36 +214,6 @@ "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, @@ -564,46 +254,6 @@ "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, @@ -624,16 +274,6 @@ "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, @@ -664,26 +304,6 @@ "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, @@ -695,4 +315,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/main/arkts-array-type-immutable.ets b/ets2panda/linter/test/main/arkts-array-type-immutable.ets index 3c018c68ab..08e31c3a9a 100644 --- a/ets2panda/linter/test/main/arkts-array-type-immutable.ets +++ b/ets2panda/linter/test/main/arkts-array-type-immutable.ets @@ -170,3 +170,5 @@ async function Foo_a(): Promise<(string| number)[]> { async function Foo_b(): Promise<(string| number)[]> { return correctArr; } + +AppStorage.SetOrCreate('passwordArray', [] as string[]); diff --git a/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json b/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json index 8ef0297136..938a1e31b8 100644 --- a/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json +++ b/ets2panda/linter/test/main/arkts-array-type-immutable.ets.arkts2.json @@ -443,6 +443,16 @@ "suggest": "", "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", "severity": "ERROR" + }, + { + "line": 174, + "column": 1, + "endLine": 174, + "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/main/interface_import_5.ets b/ets2panda/linter/test/main/interface_import_5.ets index 40a37c6d1f..cc85bae1fe 100644 --- a/ets2panda/linter/test/main/interface_import_5.ets +++ b/ets2panda/linter/test/main/interface_import_5.ets @@ -27,7 +27,6 @@ struct Index { .fontSize(50) .fontWeight(FontWeight.Bold) .onClick(() => { - // 建议使用this.getUIContext().getHostContext() let context: Context = getContext(this) as Context; console.info("CacheDir:" + context.cacheDir); }) diff --git a/ets2panda/linter/test/main/interface_import_5.ets.arkts2.json b/ets2panda/linter/test/main/interface_import_5.ets.arkts2.json index b4edf8e90e..0591c4117c 100644 --- a/ets2panda/linter/test/main/interface_import_5.ets.arkts2.json +++ b/ets2panda/linter/test/main/interface_import_5.ets.arkts2.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 31, + "line": 30, "column": 36, - "endLine": 31, + "endLine": 30, "endColumn": 46, "problem": "NoDeprecatedApi", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 26, - "endLine": 31, + "endLine": 30, "endColumn": 33, "problem": "UIInterfaceImport", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63, "problem": "UIInterfaceImport", "suggest": "", diff --git a/ets2panda/linter/test/main/interface_import_5.ets.autofix.json b/ets2panda/linter/test/main/interface_import_5.ets.autofix.json index 1970edd683..b2cced0da7 100644 --- a/ets2panda/linter/test/main/interface_import_5.ets.autofix.json +++ b/ets2panda/linter/test/main/interface_import_5.ets.autofix.json @@ -15,19 +15,19 @@ ], "result": [ { - "line": 31, + "line": 30, "column": 36, - "endLine": 31, + "endLine": 30, "endColumn": 46, "problem": "NoDeprecatedApi", "autofix": [ { - "start": 967, - "end": 977, - "replacementText": "getUIContext().getHostContext", - "line": 31, + "start": 911, + "end": 927, + "replacementText": "UIContext.getFocusedUIContext()?.getHostContext()", + "line": 30, "column": 36, - "endLine": 31, + "endLine": 30, "endColumn": 46 } ], @@ -45,10 +45,10 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], @@ -66,10 +66,10 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], @@ -87,10 +87,10 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], @@ -108,10 +108,10 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], @@ -129,10 +129,10 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], @@ -150,10 +150,10 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], @@ -171,10 +171,10 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], @@ -183,19 +183,19 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 26, - "endLine": 31, + "endLine": 30, "endColumn": 33, "problem": "UIInterfaceImport", "autofix": [ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], @@ -204,19 +204,19 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63, "problem": "UIInterfaceImport", "autofix": [ { "start": 603, "end": 603, - "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n getUIContext,\n} from '@kit.ArkUI';", - "line": 31, + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Column,\n Text,\n FontWeight,\n Context,\n} from '@kit.ArkUI';", + "line": 30, "column": 56, - "endLine": 31, + "endLine": 30, "endColumn": 63 } ], diff --git a/ets2panda/linter/test/main/interface_import_5.ets.migrate.ets b/ets2panda/linter/test/main/interface_import_5.ets.migrate.ets index 577c9eb653..4228e560a0 100644 --- a/ets2panda/linter/test/main/interface_import_5.ets.migrate.ets +++ b/ets2panda/linter/test/main/interface_import_5.ets.migrate.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +import { UIContext } from '@kit.ArkUI'; + import { Entry, Component, @@ -22,7 +24,6 @@ import { Text, FontWeight, Context, - getUIContext, } from '@kit.ArkUI'; import * from './ui_modules/common'; @@ -39,8 +40,7 @@ struct Index { .fontSize(50) .fontWeight(FontWeight.Bold) .onClick(() => { - // 建议使用this.getUIContext().getHostContext() - let context: Context = getUIContext().getHostContext(this) as Context; + let context: Context = UIContext.getFocusedUIContext()?.getHostContext() as Context; console.info("CacheDir:" + context.cacheDir); }) } diff --git a/ets2panda/linter/test/main/no_ts_like_smart_type.ets b/ets2panda/linter/test/main/no_ts_like_smart_type.ets index d7b51db205..9700a97a80 100644 --- a/ets2panda/linter/test/main/no_ts_like_smart_type.ets +++ b/ets2panda/linter/test/main/no_ts_like_smart_type.ets @@ -365,3 +365,32 @@ class Downloader { } } } + +function isOperator(operator) { + return (operator === '+' || operator === "-") +} +function test(value: string) { + if (isOperator(value)) { //no error + console.log('5') + } +} + +class Temp { + public ret: boolean = true; + + async checkAppItem(elementNameVal: Want) { + logger.info(TAG, 'checkAppItem in bundleName:' + elementNameVal.bundleName + ' | abilityName:' + + elementNameVal.abilityName); + let want: Want = { + 'bundleName': elementNameVal.bundleName, + 'abilityName': elementNameVal.abilityName + }; + let userId: UserId = { localId: 0 }; + let retVal = await accountManager.getAccountUserId(userId); + if (!retVal) { + logger.warn(TAG, 'checkAppItem getAccountUserId fail!'); + this.ret = false; + return this.ret; + } + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/no_ts_like_smart_type.ets.arkts2.json b/ets2panda/linter/test/main/no_ts_like_smart_type.ets.arkts2.json index 14bb6037da..d3e8d22442 100644 --- a/ets2panda/linter/test/main/no_ts_like_smart_type.ets.arkts2.json +++ b/ets2panda/linter/test/main/no_ts_like_smart_type.ets.arkts2.json @@ -1,4 +1,18 @@ { + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], "result": [ { "line": 30, @@ -310,6 +324,56 @@ "rule": "Array and tuple are different type(arkts-no-tuples-arrays)", "severity": "ERROR" }, + { + "line": 369, + "column": 21, + "endLine": 369, + "endColumn": 29, + "problem": "ParameterType", + "suggest": "", + "rule": "Type of parameter must be defined explicitly (arkts-require-func-arg-type)", + "severity": "ERROR" + }, + { + "line": 369, + "column": 21, + "endLine": 369, + "endColumn": 29, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 389, + "column": 9, + "endLine": 389, + "endColumn": 63, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 381, + "column": 38, + "endLine": 381, + "endColumn": 42, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Want\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 384, + "column": 15, + "endLine": 384, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Want\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, { "line": 137, "column": 5, @@ -379,6 +443,16 @@ "suggest": "'obj' is possibly 'undefined'.", "rule": "'obj' is possibly 'undefined'.", "severity": "ERROR" + }, + { + "line": 381, + "column": 9, + "endLine": 381, + "endColumn": 21, + "problem": "StrictDiagnostic", + "suggest": "Not all code paths return a value.", + "rule": "Not all code paths return a value.", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/no_ts_like_smart_type.ets.json b/ets2panda/linter/test/main/no_ts_like_smart_type.ets.json index 1956437aee..434d7ca4b0 100644 --- a/ets2panda/linter/test/main/no_ts_like_smart_type.ets.json +++ b/ets2panda/linter/test/main/no_ts_like_smart_type.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": 339, @@ -90,6 +104,46 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 369, + "column": 21, + "endLine": 369, + "endColumn": 29, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 385, + "column": 7, + "endLine": 385, + "endColumn": 19, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 386, + "column": 7, + "endLine": 386, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 389, + "column": 9, + "endLine": 389, + "endColumn": 63, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, { "line": 137, "column": 5, @@ -159,6 +213,16 @@ "suggest": "'obj' is possibly 'undefined'.", "rule": "'obj' is possibly 'undefined'.", "severity": "ERROR" + }, + { + "line": 381, + "column": 9, + "endLine": 381, + "endColumn": 21, + "problem": "StrictDiagnostic", + "suggest": "Not all code paths return a value.", + "rule": "Not all code paths return a value.", + "severity": "ERROR" } ] } \ No newline at end of file -- Gitee