From f5e42d4e3ddf52ab8e80454e0e29fd269daa7ce7 Mon Sep 17 00:00:00 2001 From: fanglou Date: Mon, 30 Jun 2025 11:28:22 +0800 Subject: [PATCH] sync 0328 to 0603 Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICH8PP Signed-off-by: fanglou --- ets2panda/linter/.gitignore | 1 + .../arkanalyzer/config/arkanalyzer.json | 5 +- .../arkanalyzer/src/core/common/SdkUtils.ts | 13 +- .../checker/migration/CustomBuilderCheck.ts | 50 +- .../checker/migration/InteropAssignCheck.ts | 50 +- .../InteropDeprecatedBuiltInAPICheck.ts | 187 +- .../InteropDynamicObjectLiteralsCheck.ts | 66 +- .../InteropS2DObjectLiteralsCheck.ts | 6 + .../src/checker/migration/NoTSLikeAsCheck.ts | 228 +- .../checker/migration/ObjectLiteralCheck.ts | 21 +- .../migration/ObservedDecoratorCheck.ts | 26 +- .../homecheck/src/utils/common/CheckEntry.ts | 8 +- ets2panda/linter/package-lock.json | 5657 +++++++++++++++++ ets2panda/linter/package.json | 17 +- .../scripts/testRunner/coverage_collect.js | 147 + .../scripts/testRunner/coverage_prepare.js | 64 + .../scripts/testRunner/coverage_report.js | 56 + ets2panda/linter/src/cli/CommandLineParser.ts | 39 +- ets2panda/linter/src/cli/LinterCLI.ts | 182 +- .../linter/src/lib/BaseTypeScriptLinter.ts | 55 +- .../linter/src/lib/CommandLineOptions.ts | 3 +- ets2panda/linter/src/lib/CookBookMsg.ts | 9 +- ets2panda/linter/src/lib/FaultAttrs.ts | 4 +- ets2panda/linter/src/lib/FaultDesc.ts | 4 +- ets2panda/linter/src/lib/LintRunResult.ts | 2 + ets2panda/linter/src/lib/LinterOptions.ts | 4 + ets2panda/linter/src/lib/LinterRunner.ts | 55 +- ets2panda/linter/src/lib/Problems.ts | 4 +- ets2panda/linter/src/lib/TypeScriptLinter.ts | 911 ++- .../linter/src/lib/autofixes/AutofixTitles.ts | 3 +- .../linter/src/lib/autofixes/Autofixer.ts | 149 +- .../src/lib/statistics/scan/CountFile.ts | 216 + .../src/lib/statistics/scan/CountNapiFile.ts | 151 + .../statistics/scan/FloderScanResultInfo.ts | 25 + .../statistics/scan/NapiFileStatisticInfo.ts | 22 + .../lib/statistics/scan/ProblemNumbersInfo.ts | 22 + .../scan/ProblemStatisticsCommonFunction.ts | 232 + .../statistics/scan/ProblemStatisticsInfo.ts | 24 + .../statistics/scan/RuleDetailedErrorInfo.ts | 20 + .../statistics/scan/ScanTaskRelatedInfo.ts | 31 + .../scan/StatisticsReportInPutInfo.ts | 27 + .../src/lib/statistics/scan/TimeRecorder.ts | 54 + .../src/lib/statistics/scan/WorkLoadInfo.ts | 59 + ets2panda/linter/src/lib/utils/TsUtils.ts | 58 +- .../src/lib/utils/consts/ArkTS2Rules.ts | 20 +- .../src/lib/utils/consts/ArkuiConstants.ts | 3 +- .../src/lib/utils/consts/ArkuiImportList.ts | 53 + .../src/lib/utils/consts/AsyncLifecycleSDK.ts | 31 + .../linter/src/lib/utils/consts/ErrorProp.ts | 7 + .../linter/src/lib/utils/consts/InteropAPI.ts | 7 +- .../src/lib/utils/consts/LimitedStdAPI.ts | 3 + .../src/lib/utils/consts/MapKeyConst.ts | 28 + .../lib/utils/consts/WorkloadRelatedConst.ts | 20 + .../utils/functions/ConfiguredRulesProcess.ts | 68 + .../src/lib/utils/functions/CookBookUtils.ts | 35 + .../src/lib/utils/functions/ProcessWrite.ts | 30 + ets2panda/linter/src/testRunner/LintTest.ts | 14 +- ets2panda/linter/src/testRunner/TestRunner.ts | 15 + .../linter/test/builtin/builtin_thisArgs.ets | 10 +- ... no_support_arktsutils_locks_asynclock.ets | 20 + ...arktsutils_locks_asynclock.ets.arkts2.json | 38 + ...rktsutils_locks_asynclock.ets.autofix.json | 38 + ...upport_arktsutils_locks_asynclock.ets.json | 17 + ...arktsutils_locks_asynclock.ets.migrate.ets | 20 + ...rktsutils_locks_asynclock.ets.migrate.json | 38 + .../no_support_isconcurrent.ets.arkts2.json | 20 + .../no_support_isconcurrent2.ets.arkts2.json | 20 - .../binary_operation_js_obj.ets.autofix.json | 38 +- .../binary_operation_js_obj.ets.migrate.ets | 12 +- .../binary_operation_js_obj.ets.migrate.json | 10 +- .../call_object_methods.ets.autofix.json | 2 +- .../call_object_methods.ets.migrate.ets | 2 +- .../call_object_methods.ets.migrate.json | 2 +- .../test/interop/ignore_files/unique_types.ts | 223 +- ...ncreases_decreases_js_obj.ets.autofix.json | 36 +- ...increases_decreases_js_obj.ets.migrate.ets | 34 +- ...ncreases_decreases_js_obj.ets.migrate.json | 10 +- .../instantiated_js_obj.ets.autofix.json | 2 +- .../instantiated_js_obj.ets.migrate.ets | 4 +- .../instantiated_js_obj.ets.migrate.json | 4 +- .../test/interop/interop_convert_import.ets | 26 +- .../interop_convert_import.ets.arkts2.json | 84 +- .../interop_convert_import.ets.autofix.json | 230 +- .../interop/interop_convert_import.ets.json | 4 +- .../interop_convert_import.ets.migrate.ets | 50 +- .../interop_convert_import.ets.migrate.json | 44 +- ...interop_equality_judgment.ets.autofix.json | 2 +- .../interop_equality_judgment.ets.migrate.ets | 4 +- ...interop_equality_judgment.ets.migrate.json | 4 +- .../test/interop/interop_export_js_rules.ets | 4 - .../interop_export_js_rules.ets.arkts2.json | 144 +- .../interop_import_js.ets.autofix.json | 12 +- .../interop/interop_import_js.ets.migrate.ets | 22 +- .../interop_import_js.ets.migrate.json | 22 +- ...interop_import_js_compare.ets.autofix.json | 30 +- .../interop_import_js_compare.ets.migrate.ets | 12 +- ...interop_import_js_compare.ets.migrate.json | 10 +- .../interop_import_js_index.ets.autofix.json | 32 +- .../interop_import_js_index.ets.migrate.ets | 24 +- .../interop_import_js_index.ets.migrate.json | 10 +- .../interop_import_js_rules.ets.autofix.json | 42 +- .../interop_import_typeof_js.ets.autofix.json | 22 +- .../interop_import_typeof_js.ets.migrate.ets | 24 +- .../interop_import_typeof_js.ets.migrate.json | 18 +- ..._not_have_property_arkts2.ets.autofix.json | 32 +- ...p_not_have_property_arkts2.ets.migrate.ets | 28 +- ..._not_have_property_arkts2.ets.migrate.json | 14 +- ..._have_property_num_arkts2.ets.autofix.json | 34 +- ...t_have_property_num_arkts2.ets.migrate.ets | 18 +- ..._have_property_num_arkts2.ets.migrate.json | 14 +- .../no_await_js_promise.ets.autofix.json | 2 +- .../no_await_js_promise.ets.migrate.ets | 10 +- .../no_await_js_promise.ets.migrate.json | 10 +- .../interop/no_js_instanceof.ets.autofix.json | 8 +- .../interop/no_js_instanceof.ets.migrate.ets | 14 +- .../interop/no_js_instanceof.ets.migrate.json | 14 +- .../linter/test/interop/object_built_in.ets | 8 + .../interop/object_built_in.ets.arkts2.json | 14 +- .../test/interop/object_built_in.ets.json | 14 +- .../interop/reflect_built_in.ets.arkts2.json | 62 +- .../test/interop/reflect_built_in.ets.json | 62 +- .../unary_operation_js_obj.ets.autofix.json | 18 +- .../unary_operation_js_obj.ets.migrate.ets | 10 +- .../unary_operation_js_obj.ets.migrate.json | 8 +- .../linter/test/interop/unique_types.ets | 389 +- .../test/interop/unique_types.ets.arkts2.json | 530 +- .../interop/unique_types.ets.autofix.json | 608 +- .../linter/test/interop/unique_types.ets.json | 113 +- .../test/interop/unique_types.ets.migrate.ets | 389 +- .../interop/unique_types.ets.migrate.json | 468 +- ...atable_extend_decorator_1.ets.autofix.json | 16 +- ...matable_extend_decorator_1.ets.migrate.ets | 12 +- ...atable_extend_decorator_1.ets.migrate.json | 16 +- .../test/main/arkts-array-type-immutable.ets | 6 +- ...arkts-array-type-immutable.ets.arkts2.json | 30 + .../main/arkts_promise_need_void_resolve.ets | 17 + ...ts_promise_need_void_resolve.ets.args.json | 19 + ..._promise_need_void_resolve.ets.arkts2.json | 28 + .../arkts_promise_need_void_resolve.ets.json | 17 + .../test/main/avoid_using_union_types.ets | 10 +- .../test/main/custom_layout.ets.arkts2.json | 6 +- .../test/main/custom_layout.ets.autofix.json | 78 +- .../test/main/custom_layout.ets.migrate.ets | 17 +- .../test/main/custom_layout.ets.migrate.json | 12 +- .../main/dollar_binding_1.ets.autofix.json | 16 +- .../main/dollar_binding_1.ets.migrate.ets | 9 +- .../double_dollar_binding_1.ets.autofix.json | 20 +- .../double_dollar_binding_1.ets.migrate.ets | 11 +- .../double_excla_binding_1.ets.autofix.json | 70 +- .../double_excla_binding_1.ets.migrate.ets | 18 +- .../double_excla_binding_1.ets.migrate.json | 4 +- .../double_excla_binding_3.ets.autofix.json | 14 +- .../double_excla_binding_3.ets.migrate.ets | 8 +- .../main/dynamic_ctor_call.ets.arkts2.json | 10 - .../test/main/explicit_function_type.ets | 7 +- .../explicit_function_type.ets.arkts2.json | 10 + .../explicit_function_type.ets.autofix.json | 35 +- .../explicit_function_type.ets.migrate.ets | 7 +- .../main/extend_decorator_1.ets.autofix.json | 8 +- .../main/extend_decorator_1.ets.migrate.ets | 8 +- .../main/extend_decorator_1.ets.migrate.json | 64 +- .../test/main/func_inferred_type_args_2.ets | 4 + .../func_inferred_type_args_2.ets.arkts2.json | 120 +- ...func_inferred_type_args_2.ets.autofix.json | 161 +- .../func_inferred_type_args_2.ets.migrate.ets | 10 +- ...func_inferred_type_args_2.ets.migrate.json | 178 +- ...index_access_static_and_class_instance.ets | 24 + ...ss_static_and_class_instance.ets.args.json | 21 + ..._static_and_class_instance.ets.arkts2.json | 38 + ...static_and_class_instance.ets.autofix.json | 60 + ..._access_static_and_class_instance.ets.json | 28 + ..._static_and_class_instance.ets.migrate.ets | 24 + ...static_and_class_instance.ets.migrate.json | 17 + .../main/interface_import_1.ets.autofix.json | 30 +- .../main/interface_import_1.ets.migrate.ets | 15 +- .../main/interface_import_1.ets.migrate.json | 32 +- .../main/interface_import_3.ets.autofix.json | 4 +- .../main/interface_import_3.ets.migrate.ets | 5 +- .../main/interface_import_3.ets.migrate.json | 8 +- .../main/interface_import_4.ets.autofix.json | 26 +- .../main/interface_import_4.ets.migrate.ets | 15 +- .../main/interface_import_4.ets.migrate.json | 4 +- .../literals_as_prop_names.ets.arkts2.json | 10 - .../literals_as_prop_names.ets.autofix.json | 14 +- .../literals_as_prop_names.ets.migrate.ets | 5 +- .../literals_as_prop_names.ets.migrate.json | 104 +- .../test/main/localBuilder_1.ets.autofix.json | 12 +- .../test/main/localBuilder_1.ets.migrate.ets | 9 +- .../linter/test/main/method_inheritance.ets | 36 + .../linter/test/main/no_sparse_array.ets | 26 +- .../test/main/no_sparse_array.ets.arkts2.json | 150 + .../test/main/no_ts_like_smart_type.ets | 57 + .../no_ts_like_smart_type.ets.arkts2.json | 140 + .../main/numeric_semantics.ets.autofix.json | 18 +- .../main/numeric_semantics.ets.migrate.ets | 9 +- .../main/numeric_semantics.ets.migrate.json | 44 +- .../test/main/object_literals_properties.ets | 20 +- .../object_literals_properties.ets.args.json | 38 +- ...object_literals_properties.ets.arkts2.json | 4 +- ...bject_literals_properties.ets.autofix.json | 20 +- ...object_literals_properties.ets.migrate.ets | 20 +- ...bject_literals_properties.ets.migrate.json | 4 +- .../test/main/oh_modules/@arkts.utils.d.ets | 14 +- .../test/main/oh_modules/@kit.ArkTS.d.ets | 3 +- ...corators_and_interfaces_1.ets.autofix.json | 10 +- ...ecorators_and_interfaces_1.ets.migrate.ets | 13 +- ...corators_and_interfaces_1.ets.migrate.json | 12 +- ...corators_and_interfaces_4.ets.autofix.json | 60 +- ...ecorators_and_interfaces_4.ets.migrate.ets | 10 +- ...corators_and_interfaces_4.ets.migrate.json | 24 +- .../provide_annotation_1.ets.autofix.json | 20 +- .../main/provide_annotation_1.ets.migrate.ets | 6 +- .../provide_annotation_1.ets.migrate.json | 14 +- .../provide_annotation_2.ets.autofix.json | 18 +- .../main/provide_annotation_2.ets.migrate.ets | 6 +- .../provide_annotation_2.ets.migrate.json | 12 +- .../linter/test/main/runtime_array_bound.ets | 5 + .../main/runtime_array_bound.ets.arkts2.json | 30 + .../main/runtime_array_bound.ets.migrate.ets | 5 + .../main/structural_identity.ets.arkts2.json | 80 +- .../styles_decorator_anon_1.ets.arkts2.json | 4 +- .../styles_decorator_anon_1.ets.autofix.json | 16 +- .../styles_decorator_anon_1.ets.migrate.ets | 10 +- ...styles_decorator_global_1.ets.autofix.json | 18 +- .../styles_decorator_global_1.ets.migrate.ets | 13 +- .../test/main/styles_decorator_global_2.ets | 10 +- .../styles_decorator_global_2.ets.arkts2.json | 43 +- ...styles_decorator_global_2.ets.autofix.json | 87 +- .../styles_decorator_global_2.ets.migrate.ets | 2 + .../styles_decorator_mix_1.ets.arkts2.json | 16 +- .../styles_decorator_mix_1.ets.autofix.json | 56 +- .../styles_decorator_mix_1.ets.migrate.ets | 14 +- .../test/main/styles_decorator_mix_2.ets | 4 +- .../styles_decorator_mix_2.ets.migrate.ets | 4 +- ...styles_decorator_struct_1.ets.autofix.json | 46 +- .../styles_decorator_struct_1.ets.migrate.ets | 27 +- ...styles_decorator_struct_1.ets.migrate.json | 8 +- .../test/main/styles_decorator_struct_2.ets | 16 +- .../styles_decorator_struct_2.ets.arkts2.json | 28 +- ...styles_decorator_struct_2.ets.autofix.json | 50 +- .../main/styles_decorator_struct_2.ets.json | 4 +- .../styles_decorator_struct_2.ets.migrate.ets | 12 +- ...styles_decorator_struct_2.ets.migrate.json | 8 +- .../test/main/styles_decorator_struct_3.ets | 38 + .../styles_decorator_struct_3.ets.args.json | 21 + .../styles_decorator_struct_3.ets.arkts2.json | 108 + ...styles_decorator_struct_3.ets.autofix.json | 225 + .../main/styles_decorator_struct_3.ets.json | 17 + .../styles_decorator_struct_3.ets.migrate.ets | 50 + ...styles_decorator_struct_3.ets.migrate.json | 17 + .../test/main/ts_overload.ets.arkts2.json | 20 - .../linter/test/rules/rule37.ets.migrate.json | 13 +- .../sdk_ability_asynchronous_lifecycle.ets | 41 + ...ility_asynchronous_lifecycle.ets.args.json | 19 + ...ity_asynchronous_lifecycle.ets.arkts2.json | 148 + ...dk_ability_asynchronous_lifecycle.ets.json | 17 + .../sdkwhite/decl_with_duplicate_name_sdk.ets | 28 +- ...cl_with_duplicate_name_sdk.ets.arkts2.json | 284 +- .../decl_with_duplicate_name_sdk.ets.json | 32 +- .../return_new_interface.ets.arkts2.json | 20 - ets2panda/linter/webpack.config.js | 4 +- 261 files changed, 14853 insertions(+), 2922 deletions(-) create mode 100755 ets2panda/linter/package-lock.json create mode 100644 ets2panda/linter/scripts/testRunner/coverage_collect.js create mode 100644 ets2panda/linter/scripts/testRunner/coverage_prepare.js create mode 100644 ets2panda/linter/scripts/testRunner/coverage_report.js create mode 100644 ets2panda/linter/src/lib/statistics/scan/CountFile.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/CountNapiFile.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/FloderScanResultInfo.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/NapiFileStatisticInfo.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/ProblemNumbersInfo.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsCommonFunction.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsInfo.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/RuleDetailedErrorInfo.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/ScanTaskRelatedInfo.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/StatisticsReportInPutInfo.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/TimeRecorder.ts create mode 100644 ets2panda/linter/src/lib/statistics/scan/WorkLoadInfo.ts create mode 100644 ets2panda/linter/src/lib/utils/consts/AsyncLifecycleSDK.ts create mode 100644 ets2panda/linter/src/lib/utils/consts/MapKeyConst.ts create mode 100644 ets2panda/linter/src/lib/utils/consts/WorkloadRelatedConst.ts create mode 100644 ets2panda/linter/src/lib/utils/functions/ConfiguredRulesProcess.ts create mode 100644 ets2panda/linter/src/lib/utils/functions/CookBookUtils.ts create mode 100644 ets2panda/linter/src/lib/utils/functions/ProcessWrite.ts create mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets create mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.arkts2.json create mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.autofix.json create mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.json create mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.ets create mode 100644 ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.json create mode 100755 ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets create mode 100755 ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets.args.json create mode 100755 ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets.arkts2.json create mode 100755 ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets.json create mode 100644 ets2panda/linter/test/main/index_access_static_and_class_instance.ets create mode 100755 ets2panda/linter/test/main/index_access_static_and_class_instance.ets.args.json create mode 100644 ets2panda/linter/test/main/index_access_static_and_class_instance.ets.arkts2.json create mode 100644 ets2panda/linter/test/main/index_access_static_and_class_instance.ets.autofix.json create mode 100644 ets2panda/linter/test/main/index_access_static_and_class_instance.ets.json create mode 100644 ets2panda/linter/test/main/index_access_static_and_class_instance.ets.migrate.ets create mode 100644 ets2panda/linter/test/main/index_access_static_and_class_instance.ets.migrate.json create mode 100644 ets2panda/linter/test/main/styles_decorator_struct_3.ets create mode 100644 ets2panda/linter/test/main/styles_decorator_struct_3.ets.args.json create mode 100644 ets2panda/linter/test/main/styles_decorator_struct_3.ets.arkts2.json create mode 100644 ets2panda/linter/test/main/styles_decorator_struct_3.ets.autofix.json create mode 100644 ets2panda/linter/test/main/styles_decorator_struct_3.ets.json create mode 100644 ets2panda/linter/test/main/styles_decorator_struct_3.ets.migrate.ets create mode 100644 ets2panda/linter/test/main/styles_decorator_struct_3.ets.migrate.json create mode 100644 ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets create mode 100644 ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.args.json create mode 100644 ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.arkts2.json create mode 100644 ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.json diff --git a/ets2panda/linter/.gitignore b/ets2panda/linter/.gitignore index 4343cbbd9d..a84c3073e0 100644 --- a/ets2panda/linter/.gitignore +++ b/ets2panda/linter/.gitignore @@ -5,3 +5,4 @@ dist node_modules package-lock.json panda-tslinter-1.0.0.tgz +coverage/ \ No newline at end of file diff --git a/ets2panda/linter/arkanalyzer/config/arkanalyzer.json b/ets2panda/linter/arkanalyzer/config/arkanalyzer.json index 17df9e7480..ad4da7a31d 100644 --- a/ets2panda/linter/arkanalyzer/config/arkanalyzer.json +++ b/ets2panda/linter/arkanalyzer/config/arkanalyzer.json @@ -19,7 +19,8 @@ "sdkGlobalFolders": [ "component", "@internal", - "ohos-typescript" + "ohos-typescript", + "dist" ], "tsconfig": "tsconfig.json" -} \ No newline at end of file +} diff --git a/ets2panda/linter/arkanalyzer/src/core/common/SdkUtils.ts b/ets2panda/linter/arkanalyzer/src/core/common/SdkUtils.ts index aa3b7fd421..4696d9d522 100644 --- a/ets2panda/linter/arkanalyzer/src/core/common/SdkUtils.ts +++ b/ets2panda/linter/arkanalyzer/src/core/common/SdkUtils.ts @@ -67,12 +67,19 @@ export class SdkUtils { } catch { logger.debug(`use builtin sdk file in ${builtInPath}.`); } - const filePath = path.resolve(builtInPath, this.esVersionMap.get(this.esVersion) ?? ''); - this.BUILT_IN_SDK.path = path.resolve(builtInPath); + let filePath = path.resolve(builtInPath, this.esVersionMap.get(this.esVersion) ?? ''); if (!fs.existsSync(filePath)) { logger.error(`built in directory ${filePath} is not exist, please check!`); - return []; + // This is the temporarily solution for linter, will update with using config to set builtin sdk path + builtInPath = 'dist'; + filePath = path.resolve(builtInPath, this.esVersionMap.get(this.esVersion) ?? ''); + logger.debug(`use new builtin sdk file in ${builtInPath}.`); + if (!fs.existsSync(filePath)) { + logger.error(`new built in directory ${filePath} is not exist, please check!`); + return []; + } } + this.BUILT_IN_SDK.path = path.resolve(builtInPath); const result = new Set(); this.dfsFiles(filePath, result); return Array.from(result); diff --git a/ets2panda/linter/homecheck/src/checker/migration/CustomBuilderCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/CustomBuilderCheck.ts index 5243a14f39..e5591c8c30 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/CustomBuilderCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/CustomBuilderCheck.ts @@ -23,19 +23,14 @@ import { AliasType, AbstractInvokeExpr, Value, - ArkFile, AstTreeUtils, ts, - FunctionType, - ArkClass, - ANONYMOUS_METHOD_PREFIX, - ArkInvokeStmt, } from 'arkanalyzer'; import Logger, { LOG_MODULE_TYPE } from 'arkanalyzer/lib/utils/logger'; import { BaseChecker, BaseMetaData } from '../BaseChecker'; import { Rule, Defects, MatcherTypes, MatcherCallback, MethodMatcher } from '../../Index'; import { IssueReport } from '../../model/Defects'; -import { FixInfo, RuleFix } from '../../model/Fix'; +import { RuleFix } from '../../model/Fix'; import { FixPosition, FixUtils } from '../../utils/common/FixUtils'; import { WarnInfo } from '../../utils/common/Utils'; @@ -79,52 +74,9 @@ export class CustomBuilderCheck implements BaseChecker { if (usage) { this.addIssueReport(usage.getDeclaringStmt()!, usage); } - - // 场景2:函数调用包在箭头函数中赋值给CustomBuilder类型的对象 - if (stmt instanceof ArkAssignStmt) { - const arrowMethod = this.findPotentialArrowFunction(stmt, target.getDeclaringArkClass()); - if (arrowMethod !== null && this.isCallToBuilderWrapWithArrow(arrowMethod)) { - this.addIssueReport(stmt, stmt.getRightOp()); - } - } } }; - // 只有当赋值语句leftOp为CustomBuilder类型时,若rightOp是匿名箭头函数,则返回该箭头函数 - private findPotentialArrowFunction(stmt: Stmt, arkClass: ArkClass): ArkMethod | null { - if (!(stmt instanceof ArkAssignStmt) || !this.isCustomBuilderTy(stmt.getLeftOp().getType())) { - return null; - } - - const rightOpType = stmt.getRightOp().getType(); - if (!(rightOpType instanceof FunctionType)) { - return null; - } - - const methodName = rightOpType.getMethodSignature().getMethodSubSignature().getMethodName(); - const method = arkClass.getMethodWithName(methodName); - if (method === null || !method.isAnonymousMethod()) { - return null; - } - return method; - } - - private isCallToBuilderWrapWithArrow(arrowMethod: ArkMethod): boolean { - const scene = arrowMethod.getDeclaringArkFile().getScene(); - const stmts = arrowMethod.getBody()?.getCfg().getStmts() ?? []; - for (const stmt of stmts) { - if (!(stmt instanceof ArkInvokeStmt)) { - continue; - } - const invokeExpr = stmt.getInvokeExpr(); - const method = scene.getMethod(invokeExpr.getMethodSignature()); - if (method && method.hasBuilderDecorator()) { - return true; - } - } - return false; - } - private isCallToBuilder(stmt: Stmt, scene: Scene): Local | undefined { if (!(stmt instanceof ArkAssignStmt)) { return undefined; diff --git a/ets2panda/linter/homecheck/src/checker/migration/InteropAssignCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/InteropAssignCheck.ts index a17b9064ba..4a15f6af6a 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/InteropAssignCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/InteropAssignCheck.ts @@ -95,33 +95,35 @@ export class InteropAssignCheck implements BaseChecker { private checkPassToFunction(target: ArkMethod, scene: Scene) { const callsites = this.cg.getInvokeStmtByMethod(target.getSignature()); - callsites.forEach(cs => { - let hasTargetArg = false; - const invoke = cs.getInvokeExpr()!; - const csMethod = cs.getCfg().getDeclaringMethod(); - invoke.getArgs().forEach(arg => { - const argTy = arg.getType(); - if (argTy instanceof PrimitiveType || this.isBoxedType(argTy)) { + callsites + .filter(cs => cs.getCfg().getDeclaringMethod().getLanguage() === Language.ARKTS1_1) + .forEach(cs => { + let hasTargetArg = false; + const invoke = cs.getInvokeExpr()!; + const csMethod = cs.getCfg().getDeclaringMethod(); + invoke.getArgs().forEach(arg => { + const argTy = arg.getType(); + if (argTy instanceof PrimitiveType || this.isBoxedType(argTy)) { + return; + } + const argTyLang = this.getTypeDefinedLang(argTy, scene) ?? csMethod?.getLanguage() ?? Language.UNKNOWN; + if (argTyLang === Language.ARKTS1_1) { + hasTargetArg = true; + } + }); + if (!hasTargetArg) { return; } - const argTyLang = this.getTypeDefinedLang(argTy, scene) ?? csMethod?.getLanguage() ?? Language.UNKNOWN; - if (argTyLang === Language.ARKTS1_1) { - hasTargetArg = true; - } + let line = cs.getOriginPositionInfo().getLineNo(); + let column = cs.getOriginPositionInfo().getColNo(); + const problem = 'Interop'; + const desc = `${this.metaData.description} (${RULE_ID})`; + const severity = this.metaData.severity; + const ruleId = this.rule.ruleId; + const filePath = csMethod?.getDeclaringArkFile()?.getFilePath() ?? ''; + const defeats = new Defects(line, column, column, problem, desc, severity, ruleId, filePath, '', true, false, false); + this.issues.push(new IssueReport(defeats, undefined)); }); - if (!hasTargetArg) { - return; - } - let line = cs.getOriginPositionInfo().getLineNo(); - let column = cs.getOriginPositionInfo().getColNo(); - const problem = 'Interop'; - const desc = `${this.metaData.description} (${RULE_ID})`; - const severity = this.metaData.severity; - const ruleId = this.rule.ruleId; - const filePath = csMethod?.getDeclaringArkFile()?.getFilePath() ?? ''; - const defeats = new Defects(line, column, column, problem, desc, severity, ruleId, filePath, '', true, false, false); - this.issues.push(new IssueReport(defeats, undefined)); - }); } private isBoxedType(checkType: Type): boolean { diff --git a/ets2panda/linter/homecheck/src/checker/migration/InteropDeprecatedBuiltInAPICheck.ts b/ets2panda/linter/homecheck/src/checker/migration/InteropDeprecatedBuiltInAPICheck.ts index b8af6a32c8..02b2b9170d 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/InteropDeprecatedBuiltInAPICheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/InteropDeprecatedBuiltInAPICheck.ts @@ -27,7 +27,6 @@ import { ArkNamespace, Local, ClassType, - ArkField, ClassSignature, Type, BooleanType, @@ -60,6 +59,7 @@ import { WarnInfo } from '../../utils/common/Utils'; import { ArkClass } from 'arkanalyzer/lib/core/model/ArkClass'; import { Language } from 'arkanalyzer/lib/core/model/ArkFile'; import { MethodParameter } from 'arkanalyzer/lib/core/model/builder/ArkMethodBuilder'; +import { AbstractFieldRef, ArkReturnStmt } from 'arkanalyzer'; const logger = Logger.getLogger(LOG_MODULE_TYPE.HOMECHECK, 'DeprecatedBuiltInAPICheck'); const gMetaData: BaseMetaData = { @@ -226,7 +226,7 @@ class DeprecatedAPIList { this.createMapForEachAPI(), this.createArraySymbolIteratorAPI(), this.createSetSymbolIteratorAPI(), - this.createMapSymbolIteratorAPI() + this.createMapSymbolIteratorAPI(), ]; private static createArrayEveryAPI1(): DeprecatedAPIInfo { @@ -385,9 +385,8 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { }; public processArkClass(arkClass: ArkClass, globalVarMap: Map): void { - for (let field of arkClass.getFields()) { - this.processClassField(field, globalVarMap); - } + this.processArkMethod(arkClass.getInstanceInitMethod(), globalVarMap); + this.processArkMethod(arkClass.getStaticInitMethod(), globalVarMap); for (let mtd of arkClass.getMethods()) { this.processArkMethod(mtd, globalVarMap); } @@ -402,16 +401,6 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { } } - public processClassField(field: ArkField, globalVarMap: Map): void { - const stmts = field.getInitializer(); - for (const stmt of stmts) { - const invokeExpr = this.getInvokeExpr(stmt); - if (invokeExpr === null) { - continue; - } - } - } - public processArkMethod(target: ArkMethod, globalVarMap: Map): void { const stmts = target.getBody()?.getCfg().getStmts() ?? []; for (const stmt of stmts) { @@ -438,7 +427,7 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { let checkAll = { value: true }; let visited: Set = new Set(); if (this.checkFromStmt(checkStmt, globalVarMap, checkAll, visited)) { - this.addIssueReport(stmt, targetLocal); + this.addIssueReport(stmt, targetLocal, checkAll.value); } } } @@ -514,13 +503,14 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { if (this.isInstanceCallMethodInDeprecatedAPIs(base, stmt, invokeExpr.getMethodSignature(), invokeExpr.getArgs())) { return base; } - // instance invoke未匹配到,继续匹配静态调用。Array.from的API调用ArkAnalyzer也表示为ArkInstanceInvokeExpr,因为API定义里没有明确的static标识。 - return this.getTargetValueInStaticInvokeWithDeprecatedAPIs(invokeExpr); + // Array.from的API调用ArkAnalyzer也表示为ArkInstanceInvokeExpr,因为API定义里没有明确的static标识 + return this.getTargetLocalInArrayFrom(invokeExpr); } else if (invokeExpr instanceof ArkPtrInvokeExpr) { // TODO:可能存在ptr invoke的场景吗? return null; } else if (invokeExpr instanceof ArkStaticInvokeExpr) { - return null; + // Symbol.iterator API 检测的Reflect.get场景,是static invoke + return this.getTargetLocalInReflectGet(invokeExpr); } return null; } @@ -553,8 +543,64 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { return true; } - private getTargetValueInStaticInvokeWithDeprecatedAPIs(staticInvokeExpr: ArkStaticInvokeExpr): Local | null { - const callApiMethod = staticInvokeExpr.getMethodSignature(); + // 此函数仅用作Symbol.iterator API 检测的Reflect.get场景 + private getTargetLocalInReflectGet(staticInvokeExpr: ArkStaticInvokeExpr): Local | null { + const method = staticInvokeExpr.getMethodSignature(); + const methodName = method.getMethodSubSignature().getMethodName(); + const namespaceName = method.getDeclaringClassSignature().getDeclaringNamespaceSignature()?.getNamespaceName(); + if (namespaceName !== 'Reflect' || methodName !== 'get') { + return null; + } + + const args = staticInvokeExpr.getArgs(); + if (args.length < 2) { + return null; + } + const targetLocal = args[0]; + const apiCall = args[1]; + if (!(targetLocal instanceof Local) || !(apiCall instanceof Local)) { + return null; + } + + const declaringStmt = apiCall.getDeclaringStmt(); + if (declaringStmt === null || !(declaringStmt instanceof ArkAssignStmt)) { + return null; + } + const rightOp = declaringStmt.getRightOp(); + if (!(rightOp instanceof ArkInstanceFieldRef)) { + return null; + } + const fieldBaseName = rightOp.getBase().getName(); + const fieldName = rightOp.getFieldName(); + if (fieldBaseName !== 'Symbol' || fieldName !== 'iterator') { + return null; + } + + for (const api of DeprecatedAPIList.DeprecatedAPIs) { + if (api.name !== 'Symbol.iterator') { + continue; + } + if (api.base === APIBaseCategory.Array && targetLocal.getType() instanceof ArrayType) { + return targetLocal; + } + if (api.base === APIBaseCategory.Set) { + const localType = targetLocal.getType(); + if (localType instanceof ClassType && localType.getClassSignature().getClassName() === 'Set') { + return targetLocal; + } + } + if (api.base === APIBaseCategory.Map) { + const localType = targetLocal.getType(); + if (localType instanceof ClassType && localType.getClassSignature().getClassName() === 'Map') { + return targetLocal; + } + } + } + return null; + } + + private getTargetLocalInArrayFrom(invokeExpr: ArkInstanceInvokeExpr): Local | null { + const callApiMethod = invokeExpr.getMethodSignature(); const callApiClass = callApiMethod.getDeclaringClassSignature(); for (const api of DeprecatedAPIList.DeprecatedAPIs) { if (!api.isStatic) { @@ -572,7 +618,7 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { continue; } if (this.compareParamTypes(api.params, callApiMethod.getMethodSubSignature().getParameters())) { - const args = staticInvokeExpr.getArgs(); + const args = invokeExpr.getArgs(); // 形参匹配的情况下,进一步比较传入的实参,因为当前废弃接口大多数为去掉any类型的第二个可选参数 // TODO:这里需要考虑如何做的更通用 if (args.length !== api.params.length) { @@ -600,24 +646,6 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { return null; } - private isMatchSymbolIterator(apiName: string, callApiName: string, stmt: Stmt): boolean { - // 对于map[Symbol.iterator]这样的API,这里会存在%0 = Symbol.iterator的操作 - if (apiName !== 'Symbol.iterator' || !callApiName.startsWith('%')) { - return false; - } - const tempLocalDeclaring = stmt.getCfg().getDeclaringMethod().getBody()?.getLocals().get(callApiName)?.getDeclaringStmt(); - if (tempLocalDeclaring && tempLocalDeclaring instanceof ArkAssignStmt) { - const rightOp = tempLocalDeclaring.getRightOp(); - if (!(rightOp instanceof ArkInstanceFieldRef)) { - return false; - } - if (rightOp.getFieldName() === 'iterator' && rightOp.getBase().getName() === 'Symbol') { - return true; - } - } - return false; - } - private isInstanceCallMethodInDeprecatedAPIs(callBase: Local, stmt: Stmt, callMethod: MethodSignature, args: Value[]): boolean { const callApiName = callMethod.getMethodSubSignature().getMethodName(); const callApiParams = callMethod.getMethodSubSignature().getParameters(); @@ -626,6 +654,10 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { if (api.name !== callApiName) { continue; } + // 对于for...of的语句,ArkAnalyzer会为其生成Symbol.iterator的调用语句,此处从源码中查找关键字以区分是源码中有还是自动生成的 + if (api.name === 'Symbol.iterator' && !stmt.getOriginalText()?.includes('Symbol.iterator')) { + continue; + } if (api.isStatic) { continue; } @@ -634,7 +666,7 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { } // Array concat API ArkAnalyzer当前无法很好处理...items形式的入参,此处作为特例处理 - if (api.name === 'concat') { + if (api.name === 'concat' && api.base === APIBaseCategory.Array) { return this.isMatchArrayConcatAPI(args); } @@ -642,18 +674,7 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { if (apiParams === undefined) { return true; } - let allParamTypeMatch = true; - if (apiParams.length !== callApiParams.length) { - allParamTypeMatch = false; - } else { - for (let i = 0; i < apiParams.length; i++) { - if (!this.isTypeMatch(apiParams[i], callApiParams[i].getType())) { - allParamTypeMatch = false; - break; - } - } - } - + let allParamTypeMatch = this.compareParamTypes(apiParams, callApiParams); if (allParamTypeMatch) { // 形参匹配的情况下,进一步比较传入的实参,因为当前废弃接口大多数为去掉any类型的第二个可选参数 // TODO:这里需要考虑如何做的更通用 @@ -705,7 +726,10 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { if (apiMatch === null || callApiMatch === null) { return false; } - return apiMatch[0] === callApiMatch[0]; + // 移除字符串中的类型的文件签名、类签名、泛型等信息后进行比较 + let apiParamsStr = apiMatch[0].replace(/@[^:]+:/, '').replace(/<[^>]+>/, ''); + let callApiParamsStr = callApiMatch[0].replace(/@[^:]+:/, '').replace(/<[^>]+>/, ''); + return apiParamsStr === callApiParamsStr; } else if (callApiType instanceof ClassType && apiType instanceof ClassType) { // 若类型为FunctionType,仅需匹配class name,因为apiTypeStr类型推导后有可能为@%unk/%unk: ArrayLike,而callApiTypeStr有明确的declaring file return callApiType.getClassSignature().getClassName() === apiType.getClassSignature().getClassName(); @@ -735,7 +759,7 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { private checkFromStmt(stmt: Stmt, globalVarMap: Map, checkAll: { value: boolean }, visited: Set, depth: number = 0): boolean { if (depth > CALL_DEPTH_LIMIT) { checkAll.value = false; - return false; + return true; } const node = this.dvfg.getOrNewDVFGNode(stmt); let worklist: DVFGNode[] = [node]; @@ -747,10 +771,11 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { } visited.add(currentStmt); - if (this.isLeftOpDefinedInStaticArkTS(currentStmt)) { + if (this.isLeftOpOrReturnOpDefinedInStaticArkTS(currentStmt)) { return true; } + // 当前语句的右值是全局变量,查找全局变量的定义语句 const gv = this.isRightOpGlobalVar(currentStmt); if (gv) { const globalDefs = globalVarMap.get(gv.getName()); @@ -766,6 +791,7 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { continue; } + // 当前语句的右值是函数返回值,查找调用函数的所有return语句 const callsite = this.cg.getCallSiteByStmt(currentStmt); for (const cs of callsite) { const declaringMtd = this.cg.getArkMethodByFuncID(cs.calleeFuncID); @@ -784,6 +810,8 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { } } } + + // 当前语句的右值是函数参数赋值语句,查找所有调用处的入参情况 const paramRef = this.isFromParameter(currentStmt); if (paramRef) { const paramIdx = paramRef.getIndex(); @@ -797,6 +825,31 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { } } } + + // 当前语句的右值是属性赋值语句,查找该属性的初始化语句 + if (currentStmt instanceof ArkAssignStmt && currentStmt.getRightOp() instanceof AbstractFieldRef) { + const fieldSignature = (currentStmt.getRightOp() as AbstractFieldRef).getFieldSignature(); + const classSignature = fieldSignature.getDeclaringSignature(); + if (classSignature instanceof ClassSignature) { + const field = this.scene.getClass(classSignature)?.getField(fieldSignature); + if (field) { + field.getInitializer().forEach(s => worklist.push(this.dvfg.getOrNewDVFGNode(s))); + } + } + } + + // 当前语句是return语句,查找return操作数的相关语句 + if (currentStmt instanceof ArkReturnStmt) { + const returnOp = currentStmt.getOp(); + if (returnOp instanceof Local) { + let checkStmt = + this.getLastAssignStmt(returnOp, stmt) ?? + this.checkTargetLocalAsGlobal(currentStmt.getCfg().getDeclaringMethod(), stmt, returnOp, globalVarMap); + if (checkStmt !== null) { + worklist.push(this.dvfg.getOrNewDVFGNode(checkStmt)); + } + } + } current.getIncomingEdge().forEach(e => worklist.push(e.getSrcNode() as DVFGNode)); } return false; @@ -843,15 +896,20 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { } // 判断语句是否为赋值语句,且左值的定义来自于ArkTS1.2 - private isLeftOpDefinedInStaticArkTS(stmt: Stmt): boolean { - if (!(stmt instanceof ArkAssignStmt)) { + private isLeftOpOrReturnOpDefinedInStaticArkTS(stmt: Stmt): boolean { + if (!(stmt instanceof ArkAssignStmt) && !(stmt instanceof ArkReturnStmt)) { return false; } - const leftOp = stmt.getLeftOp(); - if (!(leftOp instanceof Local)) { + let operand: Value; + if (stmt instanceof ArkAssignStmt) { + operand = stmt.getLeftOp(); + } else { + operand = stmt.getOp(); + } + if (!(operand instanceof Local)) { return false; } - return this.isLocalDefinedInStaticArkTS(leftOp); + return this.isLocalDefinedInStaticArkTS(operand); } private isFromParameter(stmt: Stmt): ArkParameterRef | undefined { @@ -888,11 +946,14 @@ export class InteropDeprecatedBuiltInAPICheck implements BaseChecker { }); } - private addIssueReport(stmt: Stmt, operand: Value): void { + private addIssueReport(stmt: Stmt, operand: Value, checkAll: boolean = true): void { const severity = this.rule.alert ?? this.metaData.severity; const warnInfo = this.getLineAndColumn(stmt, operand); const problem = 'builtin-api'; - const desc = `Builtin API is not support in ArkTS1.2 (${this.rule.ruleId.replace('@migration/', '')})`; + let desc = `Builtin API is not support in ArkTS1.2 (${this.rule.ruleId.replace('@migration/', '')})`; + if (!checkAll) { + desc = `Can not check when function call chain depth exceeds ${CALL_DEPTH_LIMIT}, please check it manually (${this.rule.ruleId.replace('@migration/', '')})`; + } let defects = new Defects( warnInfo.line, diff --git a/ets2panda/linter/homecheck/src/checker/migration/InteropDynamicObjectLiteralsCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/InteropDynamicObjectLiteralsCheck.ts index 3b59046d94..9d93f7f9c6 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/InteropDynamicObjectLiteralsCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/InteropDynamicObjectLiteralsCheck.ts @@ -110,12 +110,11 @@ export class InteropObjectLiteralCheck implements BaseChecker { this.visited.add(target); } - let result: Stmt[] = []; let checkAll = { value: true }; let visited: Set = new Set(); - this.checkFromStmt(stmt, scene, result, checkAll, visited); + // 对于待检查的instanceof语句,其检查对象存在用字面量赋值的情况,需要判断对象声明时的类型注解的来源,满足interop场景时需在此处告警 - if (result.length > 0) { + if (this.checkFromStmt(stmt, scene, checkAll, visited)) { const opType = rightOp.getOp().getType(); if (!(opType instanceof ClassType)) { continue; @@ -124,27 +123,17 @@ export class InteropObjectLiteralCheck implements BaseChecker { if (opTypeClass === null || opTypeClass.getCategory() === ClassCategory.OBJECT) { continue; } - if ( - opTypeClass.getLanguage() === Language.TYPESCRIPT || - opTypeClass.getLanguage() === Language.ARKTS1_1 - ) { - this.addIssueReport(stmt, rightOp, result, opTypeClass.getLanguage()); + if (opTypeClass.getLanguage() === Language.TYPESCRIPT || opTypeClass.getLanguage() === Language.ARKTS1_1) { + this.addIssueReport(stmt, rightOp, opTypeClass.getLanguage(), checkAll.value); } } } } - private checkFromStmt( - stmt: Stmt, - scene: Scene, - res: Stmt[], - checkAll: { value: boolean }, - visited: Set, - depth: number = 0 - ): void { + private checkFromStmt(stmt: Stmt, scene: Scene, checkAll: { value: boolean }, visited: Set, depth: number = 0): boolean { if (depth > CALL_DEPTH_LIMIT) { checkAll.value = false; - return; + return true; } const node = this.dvfg.getOrNewDVFGNode(stmt); let worklist: DVFGNode[] = [node]; @@ -156,36 +145,42 @@ export class InteropObjectLiteralCheck implements BaseChecker { } visited.add(currentStmt); if (this.isObjectLiteral(currentStmt, scene)) { - res.push(currentStmt); - continue; + return true; } const callsite = this.cg.getCallSiteByStmt(currentStmt); - callsite.forEach(cs => { + for (const cs of callsite) { const declaringMtd = this.cg.getArkMethodByFuncID(cs.calleeFuncID); if (!declaringMtd || !declaringMtd.getCfg()) { - return; + return false; } if (!this.visited.has(declaringMtd)) { this.dvfgBuilder.buildForSingleMethod(declaringMtd); this.visited.add(declaringMtd); } - declaringMtd - .getReturnStmt() - .forEach(r => this.checkFromStmt(r, scene, res, checkAll, visited, depth + 1)); - }); + const returnStmts = declaringMtd.getReturnStmt(); + for (const stmt of returnStmts) { + const res = this.checkFromStmt(stmt, scene, checkAll, visited, depth + 1); + if (res) { + return true; + } + } + } const paramRef = this.isFromParameter(currentStmt); if (paramRef) { const paramIdx = paramRef.getIndex(); - const callsites = this.cg.getInvokeStmtByMethod( - currentStmt.getCfg().getDeclaringMethod().getSignature() - ); + const callsites = this.cg.getInvokeStmtByMethod(currentStmt.getCfg().getDeclaringMethod().getSignature()); this.processCallsites(callsites); - this.collectArgDefs(paramIdx, callsites).forEach(d => - this.checkFromStmt(d, scene, res, checkAll, visited, depth + 1) - ); + const argDefs = this.collectArgDefs(paramIdx, callsites); + for (const def of argDefs) { + const res = this.checkFromStmt(def, scene, checkAll, visited, depth + 1); + if (res) { + return true; + } + } } current.getIncomingEdge().forEach(e => worklist.push(e.getSrcNode() as DVFGNode)); } + return false; } private processCallsites(callsites: Stmt[]): void { @@ -235,7 +230,7 @@ export class InteropObjectLiteralCheck implements BaseChecker { }); } - private addIssueReport(stmt: Stmt, operand: Value, result: Stmt[], targetLanguage: Language): void { + private addIssueReport(stmt: Stmt, operand: Value, targetLanguage: Language, checkAll: boolean = true): void { const interopRuleId = this.getInteropRule(targetLanguage); if (interopRuleId === null) { return; @@ -244,10 +239,11 @@ export class InteropObjectLiteralCheck implements BaseChecker { const warnInfo = getLineAndColumn(stmt, operand); let targetLan = getLanguageStr(targetLanguage); - const resPos: number[] = []; - result.forEach(stmt => resPos.push(stmt.getOriginPositionInfo().getLineNo())); const problem = 'Interop'; - const desc = `instanceof including object literal with class type from ${targetLan} (${interopRuleId})`; + let desc = `instanceof including object literal with class type from ${targetLan} (${interopRuleId})`; + if (!checkAll) { + desc = `Can not check when function call chain depth exceeds ${CALL_DEPTH_LIMIT}, please check it manually (${interopRuleId})`; + } let defects = new Defects( warnInfo.line, warnInfo.startCol, diff --git a/ets2panda/linter/homecheck/src/checker/migration/InteropS2DObjectLiteralsCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/InteropS2DObjectLiteralsCheck.ts index 79c14788bd..9e316294f2 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/InteropS2DObjectLiteralsCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/InteropS2DObjectLiteralsCheck.ts @@ -33,6 +33,7 @@ import { IssueReport } from '../../model/Defects'; import { ArkClass, ClassCategory } from 'arkanalyzer/lib/core/model/ArkClass'; import { Language } from 'arkanalyzer/lib/core/model/ArkFile'; import { getLanguageStr, getLineAndColumn } from './Utils'; +import { ArkThisRef } from 'arkanalyzer'; const logger = Logger.getLogger(LOG_MODULE_TYPE.HOMECHECK, 'InteropS2DObjectLiteralCheck'); const gMetaData: BaseMetaData = { @@ -105,6 +106,11 @@ export class InteropS2DObjectLiteralCheck implements BaseChecker { } private checkAssignWithObjectLiteral(stmt: ArkAssignStmt, target: ArkMethod): void { + // this = thisRef 赋值语句需要跳过,否则该class一定会被扫描一遍,此次扫描多余,且可能会产生行号为-1的错误issue + // 若此class有问题,会在真正使用到此class的源码处进行告警,无需查找this ref语句 + if (stmt.getRightOp() instanceof ArkThisRef) { + return; + } const leftOpType = stmt.getLeftOp().getType(); if (!(leftOpType instanceof ClassType)) { return; diff --git a/ets2panda/linter/homecheck/src/checker/migration/NoTSLikeAsCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/NoTSLikeAsCheck.ts index 3e6f594aa1..3c7fb7450a 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/NoTSLikeAsCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/NoTSLikeAsCheck.ts @@ -15,46 +15,46 @@ import path from 'path'; import { - ArkMethod, + AbstractFieldRef, ArkAssignStmt, - FieldSignature, - Stmt, - Scene, - Value, - DVFGBuilder, - ArkInstanceOfExpr, - CallGraph, - ArkParameterRef, - ArkInstanceFieldRef, - ArkNamespace, - Local, ArkCastExpr, - ClassType, - classSignatureCompare, ArkField, - fileSignatureCompare, - Cfg, - BasicBlock, ArkIfStmt, + ArkInstanceFieldRef, + ArkInstanceOfExpr, + ArkMethod, + ArkNamespace, + ArkNormalBinopExpr, + ArkParameterRef, ArkUnopExpr, - RelationalBinaryOperator, + BasicBlock, + CallGraph, + Cfg, + ClassSignature, + classSignatureCompare, + ClassType, + DVFGBuilder, + FieldSignature, + fileSignatureCompare, LineColPosition, - UnaryOperator, - ArkNormalBinopExpr, + Local, NormalBinaryOperator, - AbstractFieldRef, - ClassSignature, + RelationalBinaryOperator, + Scene, + Stmt, + UnaryOperator, + Value, } from 'arkanalyzer/lib'; import Logger, { LOG_MODULE_TYPE } from 'arkanalyzer/lib/utils/logger'; import { BaseChecker, BaseMetaData } from '../BaseChecker'; -import { Rule, Defects, MatcherCallback } from '../../Index'; +import { Defects, MatcherCallback, Rule } from '../../Index'; import { IssueReport } from '../../model/Defects'; import { DVFG, DVFGNode } from 'arkanalyzer/lib/VFG/DVFG'; -import { CALL_DEPTH_LIMIT, getGlobalsDefineInDefaultMethod, GlobalCallGraphHelper } from './Utils'; -import { WarnInfo } from '../../utils/common/Utils'; +import { CALL_DEPTH_LIMIT, getGlobalsDefineInDefaultMethod, getLineAndColumn, GlobalCallGraphHelper } from './Utils'; import { ClassCategory } from 'arkanalyzer/lib/core/model/ArkClass'; import { Language } from 'arkanalyzer/lib/core/model/ArkFile'; -import { BooleanConstant } from 'arkanalyzer/lib/core/base/Constant'; +import { BooleanConstant, NumberConstant } from 'arkanalyzer/lib/core/base/Constant'; +import { ArkClass, NumberType } from 'arkanalyzer'; const logger = Logger.getLogger(LOG_MODULE_TYPE.HOMECHECK, 'NoTSLikeAsCheck'); const gMetaData: BaseMetaData = { @@ -74,6 +74,7 @@ export class NoTSLikeAsCheck implements BaseChecker { public rule: Rule; public defects: Defects[] = []; public issues: IssueReport[] = []; + private scene: Scene; private cg: CallGraph; private dvfg: DVFG; private dvfgBuilder: DVFGBuilder; @@ -88,6 +89,7 @@ export class NoTSLikeAsCheck implements BaseChecker { } public check = (scene: Scene): void => { + this.scene = scene; this.cg = GlobalCallGraphHelper.getCGInstance(scene); this.dvfg = new DVFG(this.cg); @@ -105,58 +107,38 @@ export class NoTSLikeAsCheck implements BaseChecker { globalVarMap = getGlobalsDefineInDefaultMethod(defaultMethod); } for (let clazz of arkFile.getClasses()) { - for (let field of clazz.getFields()) { - this.processClassField(field, globalVarMap, scene); - } - for (let mtd of clazz.getMethods()) { - this.processArkMethod(mtd, globalVarMap, scene); - } + this.processClass(clazz, globalVarMap); } for (let namespace of arkFile.getAllNamespacesUnderThisFile()) { - this.processNameSpace(namespace, globalVarMap, scene); + this.processNameSpace(namespace, globalVarMap); } } }; - public processNameSpace(namespace: ArkNamespace, globalVarMap: Map, scene: Scene): void { + public processClass(arkClass: ArkClass, globalVarMap: Map): void { + for (let field of arkClass.getFields()) { + this.processClassField(field, globalVarMap); + } + for (let mtd of arkClass.getMethods()) { + this.processArkMethod(mtd, globalVarMap); + } + } + + public processNameSpace(namespace: ArkNamespace, globalVarMap: Map): void { for (let ns of namespace.getNamespaces()) { - this.processNameSpace(ns, globalVarMap, scene); + this.processNameSpace(ns, globalVarMap); } for (let clazz of namespace.getClasses()) { - for (let field of clazz.getFields()) { - this.processClassField(field, globalVarMap, scene); - } - for (let mtd of clazz.getMethods()) { - this.processArkMethod(mtd, globalVarMap, scene); - } + this.processClass(clazz, globalVarMap); } } - public processClassField(field: ArkField, globalVarMap: Map, scene: Scene): void { - const stmts = field.getInitializer(); - for (const stmt of stmts) { - const castExpr = this.getCastExpr(stmt); - if (castExpr === null) { - continue; - } - // 判断cast类型断言的类型是否是class,非class的场景不在本规则检查范围内 - if (!(castExpr.getType() instanceof ClassType)) { - continue; - } - let checkAll = { value: true }; - let visited: Set = new Set(); - const result = this.checkFromStmt(stmt, scene, globalVarMap, checkAll, visited); - if (result !== null) { - this.addIssueReport(stmt, castExpr, result); - } else { - if (!checkAll.value) { - this.addIssueReport(stmt, castExpr); - } - } - } + public processClassField(field: ArkField, globalVarMap: Map): void { + const instInit = field.getDeclaringArkClass().getInstanceInitMethod(); + this.processArkMethod(instInit, globalVarMap); } - public processArkMethod(target: ArkMethod, globalVarMap: Map, scene: Scene): void { + public processArkMethod(target: ArkMethod, globalVarMap: Map): void { const stmts = target.getBody()?.getCfg().getStmts() ?? []; for (const stmt of stmts) { // cast表达式所在语句为sink点,从该点开始进行逆向数据流分析 @@ -164,6 +146,13 @@ export class NoTSLikeAsCheck implements BaseChecker { if (castExpr === null) { continue; } + + // 判断是否为cast表达式的自增自减运算,属于告警场景之一 + if (this.isCastExprWithIncrementDecrement(stmt)) { + this.addIssueReport(stmt, castExpr, undefined, true); + continue; + } + // 判断cast类型断言的类型是否是class,非class的场景不在本规则检查范围内 if (!(castExpr.getType() instanceof ClassType)) { continue; @@ -178,7 +167,7 @@ export class NoTSLikeAsCheck implements BaseChecker { let checkAll = { value: true }; let visited: Set = new Set(); - const result = this.checkFromStmt(stmt, scene, globalVarMap, checkAll, visited); + const result = this.checkFromStmt(stmt, globalVarMap, checkAll, visited); if (result !== null) { this.addIssueReport(stmt, castExpr, result); } else { @@ -189,6 +178,62 @@ export class NoTSLikeAsCheck implements BaseChecker { } } + private isCastExprWithIncrementDecrement(stmt: Stmt): boolean { + if (!(stmt instanceof ArkAssignStmt) || !(stmt.getRightOp() instanceof ArkCastExpr)) { + return false; + } + const castLocal = stmt.getLeftOp(); + if (!(castLocal instanceof Local)) { + return false; + } + // 判断是否为自增或自减语句,需要判断used stmt是否至少包含%0 = %0 + 1 和 castExpr = %0两条语句,不新增临时变量 + // 非自增或自减语句,used stmt中仅包含%1 = %0 + 1 + const usedStmts = castLocal.getUsedStmts(); + if (usedStmts.length !== 2) { + return false; + } + let selfAssignFlag = false; + let assignBackFlag = false; + for (const usedStmt of usedStmts) { + if (!(usedStmt instanceof ArkAssignStmt)) { + return false; + } + const leftOp = usedStmt.getLeftOp(); + const rightOp = usedStmt.getRightOp(); + if (leftOp instanceof Local) { + if (leftOp !== castLocal) { + return false; + } + if (!(rightOp instanceof ArkNormalBinopExpr)) { + return false; + } + const op1 = rightOp.getOp1(); + const op2 = rightOp.getOp2(); + const operator = rightOp.getOperator(); + if (op1 !== castLocal) { + return false; + } + if (operator !== NormalBinaryOperator.Addition && operator !== NormalBinaryOperator.Subtraction) { + return false; + } + if (!(op2 instanceof NumberConstant) || !(op2.getType() instanceof NumberType) || op2.getValue() !== '1') { + return false; + } + selfAssignFlag = true; + } + if (leftOp instanceof ArkCastExpr) { + if (leftOp !== stmt.getRightOp()) { + return false; + } + if (rightOp !== castLocal) { + return false; + } + assignBackFlag = true; + } + } + return selfAssignFlag && assignBackFlag; + } + private hasCheckedWithInstanceof(cfg: Cfg, stmt: Stmt): boolean { const castExpr = this.getCastExpr(stmt); if (castExpr === null) { @@ -346,14 +391,7 @@ export class NoTSLikeAsCheck implements BaseChecker { return null; } - private checkFromStmt( - stmt: Stmt, - scene: Scene, - globalVarMap: Map, - checkAll: { value: boolean }, - visited: Set, - depth: number = 0 - ): Stmt | null { + private checkFromStmt(stmt: Stmt, globalVarMap: Map, checkAll: { value: boolean }, visited: Set, depth: number = 0): Stmt | null { if (depth > CALL_DEPTH_LIMIT) { checkAll.value = false; return null; @@ -367,11 +405,11 @@ export class NoTSLikeAsCheck implements BaseChecker { continue; } visited.add(currentStmt); - if (this.isWithInterfaceAnnotation(currentStmt, scene)) { + if (this.isWithInterfaceAnnotation(currentStmt)) { return currentStmt; } - const fieldDeclareStmt = this.isCastOpFieldWithInterfaceType(currentStmt, scene); + const fieldDeclareStmt = this.isCastOpFieldWithInterfaceType(currentStmt); if (fieldDeclareStmt) { return fieldDeclareStmt; } @@ -401,7 +439,7 @@ export class NoTSLikeAsCheck implements BaseChecker { } const returnStmts = declaringMtd.getReturnStmt(); for (const stmt of returnStmts) { - const res = this.checkFromStmt(stmt, scene, globalVarMap, checkAll, visited, depth + 1); + const res = this.checkFromStmt(stmt, globalVarMap, checkAll, visited, depth + 1); if (res !== null) { return res; } @@ -414,7 +452,7 @@ export class NoTSLikeAsCheck implements BaseChecker { this.processCallsites(callsites); const argDefs = this.collectArgDefs(paramIdx, callsites); for (const stmt of argDefs) { - const res = this.checkFromStmt(stmt, scene, globalVarMap, checkAll, visited, depth + 1); + const res = this.checkFromStmt(stmt, globalVarMap, checkAll, visited, depth + 1); if (res !== null) { return res; } @@ -425,7 +463,7 @@ export class NoTSLikeAsCheck implements BaseChecker { return null; } - private isCastOpFieldWithInterfaceType(stmt: Stmt, scene: Scene): Stmt | undefined { + private isCastOpFieldWithInterfaceType(stmt: Stmt): Stmt | undefined { const obj = this.getCastOp(stmt); if (obj === null || !(obj instanceof Local)) { return undefined; @@ -440,13 +478,13 @@ export class NoTSLikeAsCheck implements BaseChecker { } const fieldDeclaring = rightOp.getFieldSignature().getDeclaringSignature(); if (fieldDeclaring instanceof ClassSignature) { - const field = scene.getClass(fieldDeclaring)?.getField(rightOp.getFieldSignature()); + const field = this.scene.getClass(fieldDeclaring)?.getField(rightOp.getFieldSignature()); if (!field) { return undefined; } const fieldInitializer = field.getInitializer(); const lastStmt = fieldInitializer[fieldInitializer.length - 1]; - if (this.isWithInterfaceAnnotation(lastStmt, scene)) { + if (this.isWithInterfaceAnnotation(lastStmt)) { return lastStmt; } } @@ -497,7 +535,7 @@ export class NoTSLikeAsCheck implements BaseChecker { } // 判断语句是否为赋值语句,且左值的类型注解为Interface,右值的类型与左值不一样 - private isWithInterfaceAnnotation(stmt: Stmt, scene: Scene): boolean { + private isWithInterfaceAnnotation(stmt: Stmt): boolean { if (!(stmt instanceof ArkAssignStmt)) { return false; } @@ -505,7 +543,7 @@ export class NoTSLikeAsCheck implements BaseChecker { if (!(leftOpType instanceof ClassType)) { return false; } - const leftOpTypeclass = scene.getClass(leftOpType.getClassSignature()); + const leftOpTypeclass = this.scene.getClass(leftOpType.getClassSignature()); if (leftOpTypeclass === null) { return false; } @@ -567,15 +605,17 @@ export class NoTSLikeAsCheck implements BaseChecker { }); } - private addIssueReport(stmt: Stmt, operand: ArkCastExpr, relatedStmt?: Stmt): void { + private addIssueReport(stmt: Stmt, operand: ArkCastExpr, relatedStmt?: Stmt, incrementCase: boolean = false): void { const severity = this.rule.alert ?? this.metaData.severity; - const warnInfo = this.getLineAndColumn(stmt, operand); + const warnInfo = getLineAndColumn(stmt, operand); const problem = 'As'; const descPrefix = 'The value in type assertion is assigned by value with interface annotation'; let desc = `(${this.rule.ruleId.replace('@migration/', '')})`; - if (relatedStmt === undefined) { - desc = `Can not find all assignments of the value in type assertion, please check it manually ` + desc; + if (incrementCase) { + desc = 'Can not use neither increment nor decrement with cast expression ' + desc; + } else if (relatedStmt === undefined) { + desc = `Can not check when function call chain depth exceeds ${CALL_DEPTH_LIMIT}, please check it manually ` + desc; } else { const sinkFile = stmt.getCfg().getDeclaringMethod().getDeclaringArkFile(); const relatedFile = relatedStmt.getCfg().getDeclaringMethod().getDeclaringArkFile(); @@ -585,6 +625,7 @@ export class NoTSLikeAsCheck implements BaseChecker { desc = `${descPrefix} in file ${path.normalize(relatedFile.getName())}: ${relatedStmt.getOriginPositionInfo().getLineNo()} ` + desc; } } + let defects = new Defects( warnInfo.line, warnInfo.startCol, @@ -601,19 +642,4 @@ export class NoTSLikeAsCheck implements BaseChecker { ); this.issues.push(new IssueReport(defects, undefined)); } - - private getLineAndColumn(stmt: Stmt, operand: Value): WarnInfo { - const arkFile = stmt.getCfg().getDeclaringMethod().getDeclaringArkFile(); - const originPosition = stmt.getOperandOriginalPosition(operand); - if (arkFile && originPosition) { - const originPath = arkFile.getFilePath(); - const line = originPosition.getFirstLine(); - const startCol = originPosition.getFirstCol(); - const endCol = startCol; - return { line, startCol, endCol, filePath: originPath }; - } else { - logger.debug('ArkFile is null.'); - } - return { line: -1, startCol: -1, endCol: -1, filePath: '' }; - } } diff --git a/ets2panda/linter/homecheck/src/checker/migration/ObjectLiteralCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/ObjectLiteralCheck.ts index b582c90aaf..f0c756eeed 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/ObjectLiteralCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/ObjectLiteralCheck.ts @@ -101,7 +101,7 @@ export class ObjectLiteralCheck implements BaseChecker { this.checkFromStmt(stmt, scene, result, topLevelVarMap, checkAll, visited); result.forEach(s => this.addIssueReport(s, (s as ArkAssignStmt).getRightOp())); if (!checkAll.value) { - this.addIssueReport(stmt, rightOp); + this.addIssueReport(stmt, rightOp, checkAll.value); } } } @@ -202,20 +202,14 @@ export class ObjectLiteralCheck implements BaseChecker { DVFGHelper.buildSingleDVFG(declaringMtd, scene); this.visited.add(declaringMtd); } - declaringMtd - .getReturnStmt() - .forEach(r => this.checkFromStmt(r, scene, res, topLevelVarMap, checkAll, visited, depth + 1)); + declaringMtd.getReturnStmt().forEach(r => this.checkFromStmt(r, scene, res, topLevelVarMap, checkAll, visited, depth + 1)); }); const paramRef = this.isFromParameter(currentStmt); if (paramRef) { const paramIdx = paramRef.getIndex(); - const callsites = this.cg.getInvokeStmtByMethod( - currentStmt.getCfg().getDeclaringMethod().getSignature() - ); + const callsites = this.cg.getInvokeStmtByMethod(currentStmt.getCfg().getDeclaringMethod().getSignature()); this.processCallsites(callsites, scene); - this.collectArgDefs(paramIdx, callsites, scene).forEach(d => - this.checkFromStmt(d, scene, res, topLevelVarMap, checkAll, visited, depth + 1) - ); + this.collectArgDefs(paramIdx, callsites, scene).forEach(d => this.checkFromStmt(d, scene, res, topLevelVarMap, checkAll, visited, depth + 1)); } current.getIncomingEdge().forEach(e => worklist.push(e.getSrcNode() as DVFGNode)); } @@ -360,11 +354,14 @@ export class ObjectLiteralCheck implements BaseChecker { }); } - private addIssueReport(stmt: Stmt, operand: Value): void { + private addIssueReport(stmt: Stmt, operand: Value, checkAll: boolean = true): void { const severity = this.rule.alert ?? this.metaData.severity; const warnInfo = this.getLineAndColumn(stmt, operand); const problem = 'ObjectLiteral'; - const desc = `${this.metaData.description} (${this.rule.ruleId.replace('@migration/', '')})`; + let desc = `${this.metaData.description} (${this.rule.ruleId.replace('@migration/', '')})`; + if (!checkAll) { + desc = `Can not check when function call chain depth exceeds ${CALL_DEPTH_LIMIT}, please check it manually (${this.rule.ruleId.replace('@migration/', '')})`; + } let defects = new Defects( warnInfo.line, warnInfo.startCol, diff --git a/ets2panda/linter/homecheck/src/checker/migration/ObservedDecoratorCheck.ts b/ets2panda/linter/homecheck/src/checker/migration/ObservedDecoratorCheck.ts index 8f9c5cdb03..59c04a84d8 100644 --- a/ets2panda/linter/homecheck/src/checker/migration/ObservedDecoratorCheck.ts +++ b/ets2panda/linter/homecheck/src/checker/migration/ObservedDecoratorCheck.ts @@ -78,6 +78,7 @@ export class ObservedDecoratorCheck implements BaseChecker { public check = (arkClass: ArkClass): void => { const scene = arkClass.getDeclaringArkFile().getScene(); + const projectName = arkClass.getDeclaringArkFile().getProjectName(); for (const field of arkClass.getFields()) { if (!field.getDecorators().some(d => DECORATOR_SET.has(d.getKind()))) { continue; @@ -88,6 +89,10 @@ export class ObservedDecoratorCheck implements BaseChecker { let issueClasses: Set = new Set(); // ArkAnalyzer此处有问题,若field的类型注解为unclear type,会用右边的替换左边的。 const fieldType = field.getType(); + // 此处仅对field为class类型进行检查,包含class和interface,非class类型不在本规则检查范围之内 + if (!(fieldType instanceof ClassType)) { + continue; + } const initializers = field.getInitializer(); let canFindAllTargets = true; @@ -121,10 +126,10 @@ export class ObservedDecoratorCheck implements BaseChecker { locals.add(rightOp); } else if (rightOp instanceof ArkNewExpr) { // 此处需要区分field = new cls()和field = {}两种场景,查找完毕需继续遍历stmts以解析条件表达式造成的多赋值场景 - canFindAllTargets = canFindAllTargets && this.handleNewExpr(scene, fieldType, rightOp, usedClasses); + canFindAllTargets = canFindAllTargets && this.handleNewExpr(scene, fieldType, rightOp, usedClasses, projectName); } else if (rightOp instanceof AbstractInvokeExpr) { canFindAllTargets = - canFindAllTargets && this.handleInvokeExpr(scene, fieldType, rightOp, usedClasses); + canFindAllTargets && this.handleInvokeExpr(scene, fieldType, rightOp, usedClasses, projectName); } else { // 对应场景为使用条件表达式cond ? 123 : 456赋值时 continue; @@ -160,11 +165,15 @@ export class ObservedDecoratorCheck implements BaseChecker { // 此处需要区分field = new cls()和field = {}两种场景 // 对于field = new cls()场景,需要查找此右边class的所有父class // 对于field = {}场景,需要查找左边field类型为class时的所有父class - private handleNewExpr(scene: Scene, fieldType: Type, rightOp: ArkNewExpr, targets: Set): boolean { + private handleNewExpr(scene: Scene, fieldType: Type, rightOp: ArkNewExpr, targets: Set, projectName: string): boolean { const target = scene.getClass(rightOp.getClassType().getClassSignature()); if (target === null) { return false; } + // class为非本项目的内容时,表示调用到三方库、SDK等内容,不再继续进行查找 + if (target.getDeclaringArkFile().getProjectName() !== projectName) { + return true; + } if (!target.isAnonymousClass()) { // 理论上来说ArkNewExpr中的class一定ClassCategory.CLASS,此处仍然显式的检查一次 @@ -186,6 +195,10 @@ export class ObservedDecoratorCheck implements BaseChecker { if (fieldClass === null) { return false; } + // fieldClass为非本项目的内容时,表示调用到三方库、SDK等内容,不再继续进行查找 + if (fieldClass.getDeclaringArkFile().getProjectName() !== projectName) { + return true; + } if (fieldClass.getCategory() !== ClassCategory.CLASS) { return true; } @@ -201,13 +214,18 @@ export class ObservedDecoratorCheck implements BaseChecker { scene: Scene, fieldType: Type, invokeExpr: AbstractInvokeExpr, - targets: Set + targets: Set, + projectName: string ): boolean { let canFindAllTargets = true; const callMethod = scene.getMethod(invokeExpr.getMethodSignature()); if (callMethod === null) { return false; } + // callMethod为非本项目的内容时,表示调用到三方库、SDK等内容,不再继续进行查找 + if (callMethod.getDeclaringArkFile().getProjectName() !== projectName) { + return true; + } const stmts = callMethod.getBody()?.getCfg().getStmts(); if (stmts === undefined) { return false; diff --git a/ets2panda/linter/homecheck/src/utils/common/CheckEntry.ts b/ets2panda/linter/homecheck/src/utils/common/CheckEntry.ts index e08dbb90f7..b8a14fa1bd 100644 --- a/ets2panda/linter/homecheck/src/utils/common/CheckEntry.ts +++ b/ets2panda/linter/homecheck/src/utils/common/CheckEntry.ts @@ -98,7 +98,7 @@ export class CheckEntry { /** * 按规则维度统计并输出告警信息,按文件维度汇总并返回告警信息。 - * + * * @returns FileReport[] 文件报告数组,每个元素包含文件名、缺陷列表和输出信息 */ public sortIssues(): FileIssues[] { @@ -235,7 +235,7 @@ export async function checkEntryBuilder(checkEntry: CheckEntry): Promise=10.0.0" + } + }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.46.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@es-joy/jsdoccomment/-/jsdoccomment-0.46.0.tgz", + "integrity": "sha512-C3Axuq1xd/9VqFZpW4YAzOx5O9q/LP46uIQy/iNDpHG3fmPa6TBtvfglMCs3RBiBxAIi0Go97r8+jvTt55XMyQ==", + "dev": true, + "dependencies": { + "comment-parser": "1.4.1", + "esquery": "^1.6.0", + "jsdoc-type-pratt-parser": "~4.0.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.7.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/compat": { + "version": "1.2.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint/compat/-/compat-1.2.9.tgz", + "integrity": "sha512-gCdSY54n7k+driCadyMNv8JSPzYLeDVM/ikZRtvtROBpRdFSkS8W9A82MqsaY7lZuwL0wiapgD0NT1xT0hyJsA==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": "^9.10.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/config-array": { + "version": "0.20.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint/config-array/-/config-array-0.20.0.tgz", + "integrity": "sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ==", + "dev": true, + "dependencies": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint/config-helpers/-/config-helpers-0.2.2.tgz", + "integrity": "sha512-+GPzk8PlG0sPpzdU5ZvIRMPidzAnZDl/s9L+y13iodqvb8leL53bTannOrQ/Im7UkpsmFU5Ily5U60LWixnmLg==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.14.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint/core/-/core-0.14.0.tgz", + "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "9.28.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint/js/-/js-9.28.0.tgz", + "integrity": "sha512-fnqSjGWd/CoIp4EXIxWVK/sHA6DOHN4+8Ix2cX5ycOY7LG0UY8nHCU5pIp2eaE1Mc7Qd8kHspYNzYXT2ojPLzg==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@eslint/plugin-kit/-/plugin-kit-0.3.1.tgz", + "integrity": "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==", + "dev": true, + "dependencies": { + "@eslint/core": "^0.14.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://repo.huaweicloud.com/repository/npm/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@pkgr/core": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@pkgr/core/-/core-0.1.2.tgz", + "integrity": "sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true + }, + "node_modules/@stylistic/eslint-plugin": { + "version": "4.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@stylistic/eslint-plugin/-/eslint-plugin-4.4.1.tgz", + "integrity": "sha512-CEigAk7eOLyHvdgmpZsKFwtiqS2wFwI1fn4j09IU9GmD4euFM4jEBAViWeCqaNLlbX2k2+A/Fq9cje4HQBXuJQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "^8.32.1", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "estraverse": "^5.3.0", + "picomatch": "^4.0.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=9.0.0" + } + }, + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", + "dev": true, + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://repo.huaweicloud.com/repository/npm/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://repo.huaweicloud.com/repository/npm/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "18.11.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/@types/node/-/node-18.11.7.tgz", + "integrity": "sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.33.1.tgz", + "integrity": "sha512-TDCXj+YxLgtvxvFlAvpoRv9MAncDLBV2oT9Bd7YBGC/b/sEURoOYuIwLI99rjWOfY3QtDzO+mk0n4AmdFExW8A==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.33.1", + "@typescript-eslint/type-utils": "8.33.1", + "@typescript-eslint/utils": "8.33.1", + "@typescript-eslint/visitor-keys": "8.33.1", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.33.1", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/parser/-/parser-8.33.1.tgz", + "integrity": "sha512-qwxv6dq682yVvgKKp2qWwLgRbscDAYktPptK4JPojCwwi3R9cwrvIxS4lvBpzmcqzR4bdn54Z0IG1uHFskW4dA==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.33.1", + "@typescript-eslint/types": "8.33.1", + "@typescript-eslint/typescript-estree": "8.33.1", + "@typescript-eslint/visitor-keys": "8.33.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/project-service/-/project-service-8.33.1.tgz", + "integrity": "sha512-DZR0efeNklDIHHGRpMpR5gJITQpu6tLr9lDJnKdONTC7vvzOlLAG/wcfxcdxEWrbiZApcoBCzXqU/Z458Za5Iw==", + "dev": true, + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.33.1", + "@typescript-eslint/types": "^8.33.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/scope-manager/-/scope-manager-8.33.1.tgz", + "integrity": "sha512-dM4UBtgmzHR9bS0Rv09JST0RcHYearoEoo3pG5B6GoTR9XcyeqX87FEhPo+5kTvVfKCvfHaHrcgeJQc6mrDKrA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.33.1", + "@typescript-eslint/visitor-keys": "8.33.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.33.1.tgz", + "integrity": "sha512-STAQsGYbHCF0/e+ShUQ4EatXQ7ceh3fBCXkNU7/MZVKulrlq1usH7t2FhxvCpuCi5O5oi1vmVaAjrGeL71OK1g==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/type-utils/-/type-utils-8.33.1.tgz", + "integrity": "sha512-1cG37d9xOkhlykom55WVwG2QRNC7YXlxMaMzqw2uPeJixBFfKWZgaP/hjAObqMN/u3fr5BrTwTnc31/L9jQ2ww==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "8.33.1", + "@typescript-eslint/utils": "8.33.1", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/types/-/types-8.33.1.tgz", + "integrity": "sha512-xid1WfizGhy/TKMTwhtVOgalHwPtV8T32MS9MaH50Cwvz6x6YqRIPdD2WvW0XaqOzTV9p5xdLY0h/ZusU5Lokg==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/typescript-estree/-/typescript-estree-8.33.1.tgz", + "integrity": "sha512-+s9LYcT8LWjdYWu7IWs7FvUxpQ/DGkdjZeE/GGulHvv8rvYwQvVaUZ6DE+j5x/prADUgSbbCWZ2nPI3usuVeOA==", + "dev": true, + "dependencies": { + "@typescript-eslint/project-service": "8.33.1", + "@typescript-eslint/tsconfig-utils": "8.33.1", + "@typescript-eslint/types": "8.33.1", + "@typescript-eslint/visitor-keys": "8.33.1", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/utils/-/utils-8.33.1.tgz", + "integrity": "sha512-52HaBiEQUaRYqAXpfzWSR2U3gxk92Kw006+xZpElaPMg3C4PgM+A5LqwoQI1f9E5aZ/qlxAZxzm42WX+vn92SQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.33.1", + "@typescript-eslint/types": "8.33.1", + "@typescript-eslint/typescript-estree": "8.33.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@typescript-eslint/visitor-keys/-/visitor-keys-8.33.1.tgz", + "integrity": "sha512-3i8NrFcZeeDHJ+7ZUuDkGT+UHq+XoFGsymNK2jZCOHcfEzRQ0BdpRtdpSx/Iyf3MHLWIcLS0COuOPibKQboIiQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.33.1", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.14.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/ast/-/ast-1.14.1.tgz", + "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", + "dev": true, + "dependencies": { + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.13.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", + "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.13.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", + "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.14.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", + "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.13.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", + "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", + "dev": true, + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.13.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", + "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.14.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", + "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.13.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", + "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", + "dev": true, + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.13.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", + "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", + "dev": true, + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.13.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", + "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", + "dev": true + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.14.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", + "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.14.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", + "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.14.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", + "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.14.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", + "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.14.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", + "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webpack-cli/configtest/-/configtest-2.1.1.tgz", + "integrity": "sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==", + "dev": true, + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webpack-cli/info/-/info-2.0.2.tgz", + "integrity": "sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==", + "dev": true, + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "2.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/@webpack-cli/serve/-/serve-2.0.5.tgz", + "integrity": "sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==", + "dev": true, + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/are-docs-informative": { + "version": "0.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/are-docs-informative/-/are-docs-informative-0.0.2.tgz", + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/arkanalyzer": { + "resolved": "arkanalyzer", + "link": true + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/array-includes/-/array-includes-3.1.9.tgz", + "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.0", + "es-object-atoms": "^1.1.1", + "get-intrinsic": "^1.3.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz", + "integrity": "sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-shim-unscopables": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.25.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/browserslist/-/browserslist-4.25.0.tgz", + "integrity": "sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001718", + "electron-to-chromium": "^1.5.160", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001721", + "resolved": "https://repo.huaweicloud.com/repository/npm/caniuse-lite/-/caniuse-lite-1.0.30001721.tgz", + "integrity": "sha512-cOuvmUVtKrtEaoKiO0rSc29jcjwMwX5tOHDy4MgVFEWiUXj4uBMJkwI8MDySkgXidpMiHUcviogAvFi4pA2hDQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", + "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", + "dev": true, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://repo.huaweicloud.com/repository/npm/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/commander": { + "version": "9.5.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "inBundle": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/comment-parser": { + "version": "1.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/comment-parser/-/comment-parser-1.4.1.tgz", + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/date-format": { + "version": "4.0.14", + "resolved": "https://repo.huaweicloud.com/repository/npm/date-format/-/date-format-4.0.14.tgz", + "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==", + "inBundle": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "inBundle": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/electron-to-chromium": { + "version": "1.5.165", + "resolved": "https://repo.huaweicloud.com/repository/npm/electron-to-chromium/-/electron-to-chromium-1.5.165.tgz", + "integrity": "sha512-naiMx1Z6Nb2TxPU6fiFrUrDTjyPMLdTtaOd2oLmG8zVSg2hCWGkhPyxwk+qRmZ1ytwVqUv0u7ZcDA5+ALhaUtw==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/enhanced-resolve": { + "version": "5.18.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz", + "integrity": "sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/envinfo": { + "version": "7.14.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/envinfo/-/envinfo-7.14.0.tgz", + "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", + "dev": true, + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/es-abstract": { + "version": "1.24.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/es-abstract/-/es-abstract-1.24.0.tgz", + "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "dependencies": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.28.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint/-/eslint-9.28.0.tgz", + "integrity": "sha512-ocgh41VhRlf9+fVpe7QKzwLj9c92fDiqOj8Y3Sd4/ZmVA4Btx4PlUYPq4pp9JDyupkf1upbEXecxL2mwNV7jPQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.20.0", + "@eslint/config-helpers": "^0.2.1", + "@eslint/core": "^0.14.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.28.0", + "@eslint/plugin-kit": "^0.3.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.3.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-compat-utils": { + "version": "0.5.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-compat-utils/-/eslint-compat-utils-0.5.1.tgz", + "integrity": "sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==", + "dev": true, + "dependencies": { + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.12.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz", + "integrity": "sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-es-x": { + "version": "7.8.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-plugin-es-x/-/eslint-plugin-es-x-7.8.0.tgz", + "integrity": "sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==", + "dev": true, + "funding": [ + "https://github.com/sponsors/ota-meshi", + "https://opencollective.com/eslint" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.1.2", + "@eslint-community/regexpp": "^4.11.0", + "eslint-compat-utils": "^0.5.1" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": ">=8" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.31.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz", + "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", + "dev": true, + "dependencies": { + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.8", + "array.prototype.findlastindex": "^1.2.5", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.0", + "hasown": "^2.0.2", + "is-core-module": "^2.15.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.0", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.8", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" + } + }, + "node_modules/eslint-plugin-import/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-jsdoc": { + "version": "48.11.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.11.0.tgz", + "integrity": "sha512-d12JHJDPNo7IFwTOAItCeJY1hcqoIxE0lHA8infQByLilQ9xkqrRa6laWCnsuCrf+8rUnvxXY1XuTbibRBNylA==", + "dev": true, + "dependencies": { + "@es-joy/jsdoccomment": "~0.46.0", + "are-docs-informative": "^0.0.2", + "comment-parser": "1.4.1", + "debug": "^4.3.5", + "escape-string-regexp": "^4.0.0", + "espree": "^10.1.0", + "esquery": "^1.6.0", + "parse-imports": "^2.1.1", + "semver": "^7.6.3", + "spdx-expression-parse": "^4.0.0", + "synckit": "^0.9.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-n": { + "version": "17.19.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-plugin-n/-/eslint-plugin-n-17.19.0.tgz", + "integrity": "sha512-qxn1NaDHtizbhVAPpbMT8wWFaLtPnwhfN/e+chdu2i6Vgzmo/tGM62tcJ1Hf7J5Ie4dhse3DOPMmDxduzfifzw==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.5.0", + "@typescript-eslint/utils": "^8.26.1", + "enhanced-resolve": "^5.17.1", + "eslint-plugin-es-x": "^7.8.0", + "get-tsconfig": "^4.8.1", + "globals": "^15.11.0", + "ignore": "^5.3.2", + "minimatch": "^9.0.5", + "semver": "^7.6.3", + "ts-declaration-location": "^1.0.6" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": ">=8.23.0" + } + }, + "node_modules/eslint-plugin-n/node_modules/globals": { + "version": "15.15.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-plugin-no-null": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-plugin-no-null/-/eslint-plugin-no-null-1.0.2.tgz", + "integrity": "sha512-uRDiz88zCO/2rzGfgG15DBjNsgwWtWiSo4Ezy7zzajUgpnFIqd1TjepKeRmJZHEfBGu58o2a8S0D7vglvvhkVA==", + "dev": true, + "engines": { + "node": ">=5.0.0" + }, + "peerDependencies": { + "eslint": ">=3.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "8.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-scope/-/eslint-scope-8.3.0.tgz", + "integrity": "sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "10.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fast-uri": { + "version": "3.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/fast-uri/-/fast-uri-3.0.6.tgz", + "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ] + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://repo.huaweicloud.com/repository/npm/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "inBundle": true + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-tsconfig": { + "version": "4.10.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-tsconfig/-/get-tsconfig-4.10.1.tgz", + "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob": { + "version": "11.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/glob/-/glob-11.0.2.tgz", + "integrity": "sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "node_modules/glob/node_modules/minimatch": { + "version": "10.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "14.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "inBundle": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/homecheck": { + "resolved": "homecheck", + "link": true + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-generator-function/-/is-generator-function-1.1.0.tgz", + "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jackspeak": { + "version": "4.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/jackspeak/-/jackspeak-4.1.1.tgz", + "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", + "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true, + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/log4js": { + "version": "6.9.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/log4js/-/log4js-6.9.1.tgz", + "integrity": "sha512-1somDdy9sChrr9/f4UlzhdaGfDR2c/SaD2a4T7qEkG4jTS57/B3qmnjLYePwQ8cqWnUHZI0iAKxMBpCZICiZ2g==", + "inBundle": true, + "dependencies": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "flatted": "^3.2.7", + "rfdc": "^1.3.0", + "streamroller": "^3.1.5" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/lru-cache": { + "version": "11.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/lru-cache/-/lru-cache-11.1.0.tgz", + "integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==", + "dev": true, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://repo.huaweicloud.com/repository/npm/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "inBundle": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://repo.huaweicloud.com/repository/npm/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-imports": { + "version": "2.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-imports/-/parse-imports-2.2.1.tgz", + "integrity": "sha512-OL/zLggRp8mFhKL0rNORUTR4yBYujK/uU+xZL+/0Rgm2QE4nLO9v8PzEweSJEbMGKmDRjJE4R3IMJlL2di4JeQ==", + "dev": true, + "dependencies": { + "es-module-lexer": "^1.5.3", + "slashes": "^3.0.12" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.5.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/prettier/-/prettier-3.5.3.tgz", + "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/property-expr": { + "version": "2.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/property-expr/-/property-expr-2.0.6.tgz", + "integrity": "sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://repo.huaweicloud.com/repository/npm/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-cwd/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "inBundle": true + }, + "node_modules/rimraf": { + "version": "5.0.10", + "resolved": "https://repo.huaweicloud.com/repository/npm/rimraf/-/rimraf-5.0.10.tgz", + "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", + "dev": true, + "dependencies": { + "glob": "^10.3.7" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/rimraf/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, + "node_modules/rimraf/node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/schema-utils": { + "version": "4.3.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/schema-utils/-/schema-utils-4.3.2.tgz", + "integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/schema-utils/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/schema-utils/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/schema-utils/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shelljs/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/shelljs/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/shelljs/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/slashes": { + "version": "3.0.12", + "resolved": "https://repo.huaweicloud.com/repository/npm/slashes/-/slashes-3.0.12.tgz", + "integrity": "sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==", + "dev": true + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://repo.huaweicloud.com/repository/npm/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.21", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz", + "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==", + "dev": true + }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/streamroller": { + "version": "3.1.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/streamroller/-/streamroller-3.1.5.tgz", + "integrity": "sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw==", + "inBundle": true, + "dependencies": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/streamroller/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "inBundle": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/streamroller/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "inBundle": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/streamroller/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "inBundle": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://repo.huaweicloud.com/repository/npm/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/synckit": { + "version": "0.9.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/synckit/-/synckit-0.9.3.tgz", + "integrity": "sha512-JJoOEKTfL1urb1mDoEblhD9NhEbWmq9jHEMEnxoC4ujUaZ4itA8vKgwkFAyNClgxplLi9tsUKX+EduK0p/l7sg==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/tapable": { + "version": "2.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/tapable/-/tapable-2.2.2.tgz", + "integrity": "sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.42.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/terser/-/terser-5.42.0.tgz", + "integrity": "sha512-UYCvU9YQW2f/Vwl+P0GfhxJxbUGLwd+5QrrGgLajzWAtC/23AX0vcise32kkP7Eu0Wu9VlzzHAXkLObgjQfFlQ==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.14.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.14", + "resolved": "https://repo.huaweicloud.com/repository/npm/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz", + "integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.0", + "serialize-javascript": "^6.0.2", + "terser": "^5.31.1" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/tiny-case": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/tiny-case/-/tiny-case-1.0.3.tgz", + "integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toposort": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/toposort/-/toposort-2.0.2.tgz", + "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==" + }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/ts-declaration-location": { + "version": "1.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/ts-declaration-location/-/ts-declaration-location-1.0.7.tgz", + "integrity": "sha512-EDyGAwH1gO0Ausm9gV6T2nUvBgXT5kGoCMJPllOaooZ+4VvJiKBdZE7wK18N1deEowhcUptS+5GXZK8U/fvpwA==", + "dev": true, + "funding": [ + { + "type": "ko-fi", + "url": "https://ko-fi.com/rebeccastevens" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/ts-declaration-location" + } + ], + "dependencies": { + "picomatch": "^4.0.2" + }, + "peerDependencies": { + "typescript": ">=4.0.0" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.33.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/typescript-eslint/-/typescript-eslint-8.33.1.tgz", + "integrity": "sha512-AgRnV4sKkWOiZ0Kjbnf5ytTJXMUZQ0qhSVdQtDNYLPLnjsATEYhaO94GlRQwi4t4gO8FfjM6NnikHeKjUm8D7A==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.33.1", + "@typescript-eslint/parser": "8.33.1", + "@typescript-eslint/utils": "8.33.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/watchpack": { + "version": "2.4.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/watchpack/-/watchpack-2.4.4.tgz", + "integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==", + "dev": true, + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack": { + "version": "5.99.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/webpack/-/webpack-5.99.9.tgz", + "integrity": "sha512-brOPwM3JnmOa+7kd3NsmOUOwbDAj8FT9xDsG3IW0MgbN9yZV7Oi/s/+MNQ/EcSMqw7qfoRyXPoeEWT8zLVdVGg==", + "dev": true, + "dependencies": { + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.14.0", + "browserslist": "^4.24.0", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.1", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^4.3.2", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.11", + "watchpack": "^2.4.1", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "5.1.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/webpack-cli/-/webpack-cli-5.1.4.tgz", + "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", + "dev": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^2.1.1", + "@webpack-cli/info": "^2.0.2", + "@webpack-cli/serve": "^2.0.5", + "colorette": "^2.0.14", + "commander": "^10.0.1", + "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/webpack-cli/node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack-cli/node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "dev": true, + "dependencies": { + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.3.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/webpack-sources/-/webpack-sources-3.3.2.tgz", + "integrity": "sha512-ykKKus8lqlgXX/1WjudpIEjqsafjOTcOJqxnAbMLAu/KCsDCJ6GBtvscewvTkrn24HsnvFwrSCbenFrhtcCsAA==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/webpack/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://repo.huaweicloud.com/repository/npm/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "dev": true + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yup": { + "version": "1.6.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/yup/-/yup-1.6.1.tgz", + "integrity": "sha512-JED8pB50qbA4FOkDol0bYF/p60qSEDQqBD0/qeIrUCG1KbPBIQ776fCUNb9ldbPcSTxA69g/47XTo4TqWiuXOA==", + "dependencies": { + "property-expr": "^2.0.5", + "tiny-case": "^1.0.3", + "toposort": "^2.0.2", + "type-fest": "^2.19.0" + } + } + } +} diff --git a/ets2panda/linter/package.json b/ets2panda/linter/package.json index 7b374c9944..9a8bd6eb74 100644 --- a/ets2panda/linter/package.json +++ b/ets2panda/linter/package.json @@ -40,15 +40,22 @@ "eslint-check": "npx eslint .", "eslint-fix": "npm run eslint-check -- --fix", "prettier-fix": "npx prettier --write .", - "fix": "npm run prettier-fix && npm run eslint-fix" + "fix": "npm run prettier-fix && npm run eslint-fix", + "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-collect": "node scripts/testRunner/coverage_collect.js", + "coverage-report": "node scripts/testRunner/coverage_report.js" }, "dependencies": { "commander": "^9.4.0", + "fs-extra": "11.2.0", "homecheck": "file:./homecheck", + "json5": "2.2.3", "log4js": "^6.4.0", - "yup": "^1.4.0", - "fs-extra": "11.2.0", - "json5": "2.2.3" + "readline-sync": "^1.4.10", + "yup": "^1.4.0" }, "devDependencies": { "@eslint/compat": "latest", @@ -61,10 +68,12 @@ "eslint-plugin-n": "^17.9.0", "eslint-plugin-no-null": "^1.0.2", "glob": "^11.0.0", + "nyc": "^15.1.0", "path-scurry": "^2.0.0", "prettier": "latest", "rimraf": "^5.0.10", "shelljs": "^0.8.5", + "source-map": "^0.7.4", "typescript-eslint": "latest", "webpack": "^5.75.0", "webpack-cli": "^5.0.1" diff --git a/ets2panda/linter/scripts/testRunner/coverage_collect.js b/ets2panda/linter/scripts/testRunner/coverage_collect.js new file mode 100644 index 0000000000..c5a918cb5c --- /dev/null +++ b/ets2panda/linter/scripts/testRunner/coverage_collect.js @@ -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. + */ + +const fs = require('fs'); +const sourceMap = require('source-map'); +const path = require('path'); + +const PROJECT_ROOT = path.join(__dirname, '..', '..'); +const COVERAGE_DIR = path.join(PROJECT_ROOT, 'coverage'); +const COVERAGE_FILE = path.join(COVERAGE_DIR, 'coverage.json'); +const NEW_COVERAGE_FILE = path.join(COVERAGE_DIR, 'newCoverage.json'); + +/** + * Processes statement map data using source map consumer + * @param {Object} statementMap - Statement map data + * @param {Object} consumer - Source map consumer + */ +function processStatementMap(statementMap, consumer) { + for (const id in statementMap) { + const statement = statementMap[id]; + const startPos = consumer.originalPositionFor(statement.start); + const endPos = consumer.originalPositionFor(statement.end); + + statement.start = { line: startPos.line, column: startPos.column }; + statement.end = { line: endPos.line, column: endPos.column }; + } +} + +/** + * Processes function map data using source map consumer + * @param {Object} functionMap - Function map data + * @param {Object} consumer - Source map consumer + */ +function processFunctionMap(functionMap, consumer) { + for (const id in functionMap) { + const func = functionMap[id]; + + const declStart = consumer.originalPositionFor(func.decl.start); + const declEnd = consumer.originalPositionFor(func.decl.end); + const locStart = consumer.originalPositionFor(func.loc.start); + const locEnd = consumer.originalPositionFor(func.loc.end); + + func.decl = { + start: { line: declStart.line, column: declStart.column }, + end: { line: declEnd.line, column: declEnd.column } + }; + + func.loc = { + start: { line: locStart.line, column: locStart.column }, + end: { line: locEnd.line, column: locEnd.column } + }; + + func.line = declStart.line; + } +} + +/** + * Processes branch map data using source map consumer + * @param {Object} branchMap - Branch map data + * @param {Object} consumer - Source map consumer + */ +function processBranchMap(branchMap, consumer) { + for (const id in branchMap) { + const branch = branchMap[id]; + + // Process locations + branch.locations.forEach(location => { + const startPos = consumer.originalPositionFor(location.start); + const endPos = consumer.originalPositionFor(location.end); + + location.start = { line: startPos.line, column: startPos.column }; + location.end = { line: endPos.line, column: endPos.column }; + }); + + // Process loc + const locStart = consumer.originalPositionFor(branch.loc.start); + const locEnd = consumer.originalPositionFor(branch.loc.end); + + branch.loc = { + start: { line: locStart.line, column: locStart.column }, + end: { line: locEnd.line, column: locEnd.column } + }; + + branch.line = locStart.line; + } +} + +/** + * Collects and processes coverage data using source maps + */ +async function collectCoverage() { + if (!fs.existsSync(COVERAGE_FILE)) { + throw new Error(`Coverage file not found: ${COVERAGE_FILE}`); + } + + const coverageData = JSON.parse(fs.readFileSync(COVERAGE_FILE, 'utf8')); + const newCoverageData = {}; + + for (const file in coverageData) { + const mapFile = `${file}.map`; + + if (!fs.existsSync(mapFile)) { + console.warn(`Source map not found for: ${file}`); + continue; + } + + const sourceMapData = JSON.parse(fs.readFileSync(mapFile, 'utf8')); + const sources = sourceMapData.sources; + const newFile = path.join(path.dirname(mapFile), sources[0]); + + await sourceMap.SourceMapConsumer.with(sourceMapData, null, (consumer) => { + const fileCoverage = { ...coverageData[file] }; + fileCoverage.path = newFile; + + processStatementMap(fileCoverage.statementMap, consumer); + processFunctionMap(fileCoverage.functionMap, consumer); + processBranchMap(fileCoverage.branchMap, consumer); + + newCoverageData[newFile] = fileCoverage; + }); + } + + fs.writeFileSync( + NEW_COVERAGE_FILE, + JSON.stringify(newCoverageData, null, 4) + ); +} + +// Execute and handle errors +collectCoverage() + .then(() => console.log('Coverage collection completed successfully')) + .catch(error => { + console.error('Error collecting coverage:', error); + process.exit(1); + }); \ No newline at end of file diff --git a/ets2panda/linter/scripts/testRunner/coverage_prepare.js b/ets2panda/linter/scripts/testRunner/coverage_prepare.js new file mode 100644 index 0000000000..2a746b4b09 --- /dev/null +++ b/ets2panda/linter/scripts/testRunner/coverage_prepare.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const fs = require('fs'); +const path = require('path'); + +const projectRoot = path.join(__dirname, '..', '..'); +const buildDir = path.join(projectRoot, 'build'); +const coverageDir = path.join(projectRoot, 'coverage'); +const buildInstrumentDir = path.join(coverageDir, 'build_instrument'); + +function copyDirectory(src, dest) { + fs.mkdirSync(dest, { recursive: true }); + + const entries = fs.readdirSync(src, { withFileTypes: true }); + + for (const entry of entries) { + const srcPath = path.join(src, entry.name); + const destPath = path.join(dest, entry.name); + + if (entry.isDirectory()) { + copyDirectory(srcPath, destPath); + } else { + fs.copyFileSync(srcPath, destPath); + } + } +} + +function prepareCoverage() { + try { + if (fs.existsSync(coverageDir)) { + fs.rmSync(coverageDir, { recursive: true, force: true }); + } + + fs.mkdirSync(coverageDir, { recursive: true }); + fs.mkdirSync(buildInstrumentDir, { recursive: true }); + + copyDirectory(buildDir, buildInstrumentDir); + + const dataDir = path.join(projectRoot, 'src', 'data'); + const instrumentDataDir = path.join(buildInstrumentDir, 'data'); + + if (fs.existsSync(dataDir)) { + copyDirectory(dataDir, instrumentDataDir); + } + } catch (error) { + console.error('Error during coverage preparation:', error); + process.exit(1); + } +} + +prepareCoverage(); \ No newline at end of file diff --git a/ets2panda/linter/scripts/testRunner/coverage_report.js b/ets2panda/linter/scripts/testRunner/coverage_report.js new file mode 100644 index 0000000000..84fa3219d0 --- /dev/null +++ b/ets2panda/linter/scripts/testRunner/coverage_report.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const fs = require('fs'); +const path = require('path'); +const libCoverage = require('istanbul-lib-coverage'); +const libReport = require('istanbul-lib-report'); +const reports = require('istanbul-reports'); + +const projectRoot = path.join(__dirname, '..', '..'); +const coverageDir = path.join(projectRoot, 'coverage'); + +const coverageFile = fs.readFileSync(path.join(coverageDir, 'newCoverage.json'), 'utf8'); +const coverageData = JSON.parse(coverageFile); +const coverageMap = libCoverage.createCoverageMap(coverageData); + +// create summary report +const summary = libCoverage.createCoverageSummary(); +coverageMap.files().forEach(file => { + const fc = coverageMap.fileCoverageFor(file); + const s = fc.toSummary(); + summary.merge(s); +}); +console.log(summary); + +// Watermarks for the report +const configWatermarks = { + statements: [50, 80], + branches: [50, 80], + functions: [50, 80], + lines: [50, 80], +}; +const context = libReport.createContext({ + dir: path.join(coverageDir, 'report-html'), + defaultSummarizer: 'nested', + watermarks: configWatermarks, + coverageMap, +}); + +const report = reports.create('html', {}); +report.execute(context); + +const report_text = reports.create('text', {}); +report_text.execute(context); \ No newline at end of file diff --git a/ets2panda/linter/src/cli/CommandLineParser.ts b/ets2panda/linter/src/cli/CommandLineParser.ts index 9849eedf17..d3b948c5e7 100644 --- a/ets2panda/linter/src/cli/CommandLineParser.ts +++ b/ets2panda/linter/src/cli/CommandLineParser.ts @@ -13,15 +13,18 @@ * limitations under the License. */ -import { Logger } from '../lib/Logger'; -import { logTscDiagnostic } from '../lib/utils/functions/LogTscDiagnostic'; -import type { CommandLineOptions } from '../lib/CommandLineOptions'; -import { ARKTS_IGNORE_DIRS_OH_MODULES } from '../lib/utils/consts/ArktsIgnorePaths'; import type { OptionValues } from 'commander'; import { Command, Option } from 'commander'; -import * as ts from 'typescript'; import * as fs from 'node:fs'; import * as path from 'node:path'; +import * as ts from 'typescript'; +import type { CommandLineOptions } from '../lib/CommandLineOptions'; +import { cookBookTag } from '../lib/CookBookMsg'; +import { Logger } from '../lib/Logger'; +import { ARKTS_IGNORE_DIRS_OH_MODULES } from '../lib/utils/consts/ArktsIgnorePaths'; +import { getConfiguredRuleTags, getRulesFromConfig } from '../lib/utils/functions/ConfiguredRulesProcess'; +import { extractRuleTags } from '../lib/utils/functions/CookBookUtils'; +import { logTscDiagnostic } from '../lib/utils/functions/LogTscDiagnostic'; const TS_EXT = '.ts'; const TSX_EXT = '.tsx'; @@ -132,7 +135,10 @@ function formIdeInteractive(cmdOptions: CommandLineOptions, commanderOpts: Optio cmdOptions.linterOptions.checkTsAndJs = true; } if (commanderOpts.onlyArkts2SyntaxRules) { - cmdOptions.onlySyntax = true; + cmdOptions.linterOptions.onlySyntax = true; + } + if (commanderOpts.autofixCheck) { + cmdOptions.linterOptions.autofixCheck = true; } } @@ -159,7 +165,9 @@ function formArkts2Options(cmdOptions: CommandLineOptions, commanderOpts: Option function formCommandLineOptions(parsedCmd: ParsedCommand): CommandLineOptions { const opts: CommandLineOptions = { - inputFiles: parsedCmd.args.inputFiles, + inputFiles: parsedCmd.args.inputFiles.map((file) => { + return path.normalize(file); + }), linterOptions: { useRtLogic: true, interopCheckMode: false @@ -177,6 +185,7 @@ function formCommandLineOptions(parsedCmd: ParsedCommand): CommandLineOptions { } if (options.projectFolder) { doProjectFolderArg(options.projectFolder, opts); + opts.linterOptions.projectFolderList = options.projectFolder; } if (options.project) { doProjectArg(options.project, opts); @@ -190,6 +199,7 @@ function formCommandLineOptions(parsedCmd: ParsedCommand): CommandLineOptions { if (options.useRtLogic !== undefined) { opts.linterOptions.useRtLogic = options.useRtLogic; } + processRuleConfig(opts, options); formIdeInteractive(opts, options); formSdkOptions(opts, options); formMigrateOptions(opts, options); @@ -197,6 +207,19 @@ function formCommandLineOptions(parsedCmd: ParsedCommand): CommandLineOptions { return opts; } +function processRuleConfig(commandLineOptions: CommandLineOptions, options: OptionValues): void { + if (options.ruleConfig !== undefined) { + const stats = fs.statSync(path.normalize(options.ruleConfig)); + if (!stats.isFile()) { + console.error(`The file at ${options.ruleConfigPath} path does not exist!`); + } else { + const configuredRulesMap = getRulesFromConfig(options.ruleConfig); + const arkTSRulesMap = extractRuleTags(cookBookTag); + commandLineOptions.linterOptions.ruleConfigTags = getConfiguredRuleTags(arkTSRulesMap, configuredRulesMap); + } + } +} + function createCommand(): Command { const program = new Command(); program. @@ -233,6 +256,8 @@ function createCommand(): Command { option('-o, --output-file-path ', 'path to store all log and result files'). option('--verbose', 'set log level to see debug messages'). option('--enable-interop', 'scan whole project to report 1.1 import 1.2'). + option('--rule-config ', 'Path to the rule configuration file'). + option('--autofix-check', 'confirm whether the user needs automatic repair'). addOption(new Option('--warnings-as-errors', 'treat warnings as errors').hideHelp(true)). addOption(new Option('--no-check-ts-as-source', 'check TS files as third-party libary').hideHelp(true)). addOption(new Option('--no-use-rt-logic', 'run linter with SDK logic').hideHelp(true)). diff --git a/ets2panda/linter/src/cli/LinterCLI.ts b/ets2panda/linter/src/cli/LinterCLI.ts index 5af05d0e31..447a2358d1 100644 --- a/ets2panda/linter/src/cli/LinterCLI.ts +++ b/ets2panda/linter/src/cli/LinterCLI.ts @@ -13,20 +13,25 @@ * limitations under the License. */ +import { MigrationTool } from 'homecheck'; import * as fs from 'node:fs'; import * as os from 'node:os'; import * as path from 'node:path'; +import * as readlineSync from 'readline-sync'; import * as readline from 'node:readline'; import type { CommandLineOptions } from '../lib/CommandLineOptions'; +import { getHomeCheckConfigInfo, transferIssues2ProblemInfo } from '../lib/HomeCheck'; import { lint } from '../lib/LinterRunner'; import { Logger } from '../lib/Logger'; import type { ProblemInfo } from '../lib/ProblemInfo'; -import { parseCommandLine } from './CommandLineParser'; -import { compileLintOptions, getEtsLoaderPath } from '../lib/ts-compiler/Compiler'; +import * as statistic from '../lib/statistics/scan/ProblemStatisticsCommonFunction'; +import type { ScanTaskRelatedInfo } from '../lib/statistics/scan/ScanTaskRelatedInfo'; +import { StatisticsReportInPutInfo } from '../lib/statistics/scan/StatisticsReportInPutInfo'; +import { TimeRecorder } from '../lib/statistics/scan/TimeRecorder'; import { logStatistics } from '../lib/statistics/StatisticsLogger'; -import { arkts2Rules, onlyArkts2SyntaxRules } from '../lib/utils/consts/ArkTS2Rules'; -import { MigrationTool } from 'homecheck'; -import { getHomeCheckConfigInfo, transferIssues2ProblemInfo } from '../lib/HomeCheck'; +import { compileLintOptions, getEtsLoaderPath } from '../lib/ts-compiler/Compiler'; +import { processSyncErr, processSyncOut } from '../lib/utils/functions/ProcessWrite'; +import { parseCommandLine } from './CommandLineParser'; export function run(): void { const commandLineArgs = process.argv.slice(2); @@ -36,6 +41,13 @@ export function run(): void { } const cmdOptions = parseCommandLine(commandLineArgs); + if (cmdOptions.linterOptions.migratorMode && cmdOptions.linterOptions.autofixCheck) { + const shouldRun = readlineSync.question('Do you want to run the linter and apply migration? (y/n): ').toLowerCase(); + if (shouldRun !== 'y') { + console.log('Linting canceled by user.'); + process.exit(0); + } + } if (cmdOptions.devecoPluginModeDeprecated) { runIdeModeDeprecated(cmdOptions); @@ -43,7 +55,7 @@ export function run(): void { runIdeInteractiveMode(cmdOptions); } else { const compileOptions = compileLintOptions(cmdOptions); - const result = lint(compileOptions); + const result = lint(compileOptions, new TimeRecorder()); logStatistics(result.projectStats); process.exit(result.hasErrors ? 1 : 0); } @@ -52,36 +64,28 @@ export function run(): void { async function runIdeInteractiveMode(cmdOptions: CommandLineOptions): Promise { cmdOptions.followSdkSettings = true; cmdOptions.disableStrictDiagnostics = true; + const timeRecorder = new TimeRecorder(); + const scanTaskRelatedInfo = {} as ScanTaskRelatedInfo; const compileOptions = compileLintOptions(cmdOptions); - let homeCheckResult = new Map(); - const mergedProblems = new Map(); - - if (cmdOptions.linterOptions.arkts2 && cmdOptions.homecheck) { - const { ruleConfigInfo, projectConfigInfo } = getHomeCheckConfigInfo(cmdOptions); - let migrationTool: MigrationTool | null = new MigrationTool(ruleConfigInfo, projectConfigInfo); - await migrationTool.buildCheckEntry(); - const result = await migrationTool.start(); - migrationTool = null; - - homeCheckResult = transferIssues2ProblemInfo(result); - for (const [filePath, problems] of homeCheckResult) { - if (!mergedProblems.has(filePath)) { - mergedProblems.set(filePath, []); - } - mergedProblems.get(filePath)!.push(...problems); - } - } - - if (!cmdOptions.skipLinter) { - const result = lint(compileOptions, getEtsLoaderPath(compileOptions), homeCheckResult); - for (const [filePath, problems] of result.problemsInfos) { - mergeLintProblems(filePath, problems, mergedProblems, cmdOptions); - } + scanTaskRelatedInfo.cmdOptions = cmdOptions; + scanTaskRelatedInfo.timeRecorder = timeRecorder; + scanTaskRelatedInfo.compileOptions = compileOptions; + await executeScanTask(scanTaskRelatedInfo); + + const statisticsReportInPutInfo = scanTaskRelatedInfo.statisticsReportInPutInfo; + statisticsReportInPutInfo.statisticsReportName = 'scan-problems-statistics.json'; + statisticsReportInPutInfo.totalProblemNumbers = getTotalProblemNumbers(scanTaskRelatedInfo.mergedProblems); + statisticsReportInPutInfo.cmdOptions = cmdOptions; + statisticsReportInPutInfo.timeRecorder = timeRecorder; + + if (!cmdOptions.linterOptions.migratorMode && statisticsReportInPutInfo.cmdOptions.linterOptions.projectFolderList) { + await statistic.generateScanProbelemStatisticsReport(statisticsReportInPutInfo); } + const mergedProblems = scanTaskRelatedInfo.mergedProblems; const reportData = Object.fromEntries(mergedProblems); - await generateReportFile(reportData, cmdOptions.outputFilePath); - + const reportName: string = 'scan-report.json'; + await statistic.generateReportFile(reportName, reportData, cmdOptions.outputFilePath); for (const [filePath, problems] of mergedProblems) { const reportLine = JSON.stringify({ filePath, problems }) + '\n'; await processSyncOut(reportLine); @@ -90,6 +94,79 @@ async function runIdeInteractiveMode(cmdOptions: CommandLineOptions): Promise): number { + let totalProblemNumbers: number = 0; + for (const problems of mergedProblems.values()) { + totalProblemNumbers += problems.length; + } + return totalProblemNumbers; +} + +async function executeScanTask(scanTaskRelatedInfo: ScanTaskRelatedInfo): Promise { + const cmdOptions = scanTaskRelatedInfo.cmdOptions; + scanTaskRelatedInfo.statisticsReportInPutInfo = new StatisticsReportInPutInfo(); + scanTaskRelatedInfo.statisticsReportInPutInfo.ruleToNumbersMap = new Map(); + scanTaskRelatedInfo.statisticsReportInPutInfo.ruleToAutoFixedNumbersMap = new Map(); + scanTaskRelatedInfo.mergedProblems = new Map(); + if (cmdOptions.linterOptions.arkts2 && cmdOptions.homecheck) { + await executeHomeCheckTask(scanTaskRelatedInfo); + } + + if (!cmdOptions.skipLinter) { + executeLintTask(scanTaskRelatedInfo); + } +} + +async function executeHomeCheckTask(scanTaskRelatedInfo: ScanTaskRelatedInfo): Promise { + const cmdOptions = scanTaskRelatedInfo.cmdOptions; + const { ruleConfigInfo, projectConfigInfo } = getHomeCheckConfigInfo(cmdOptions); + let migrationTool: MigrationTool | null = new MigrationTool(ruleConfigInfo, projectConfigInfo); + await migrationTool.buildCheckEntry(); + scanTaskRelatedInfo.timeRecorder.startScan(); + scanTaskRelatedInfo.timeRecorder.setHomeCheckCountStatus(true); + const result = await migrationTool.start(); + migrationTool = null; + scanTaskRelatedInfo.homeCheckResult = transferIssues2ProblemInfo(result); + for (const [filePath, problems] of scanTaskRelatedInfo.homeCheckResult) { + if (!scanTaskRelatedInfo.mergedProblems.has(filePath)) { + scanTaskRelatedInfo.mergedProblems.set(filePath, []); + } + statistic.accumulateRuleNumbers( + problems, + scanTaskRelatedInfo.statisticsReportInPutInfo.ruleToNumbersMap, + scanTaskRelatedInfo.statisticsReportInPutInfo.ruleToAutoFixedNumbersMap + ); + scanTaskRelatedInfo.statisticsReportInPutInfo.arkOnePointOneProblemNumbers += + statistic.getArktsOnePointOneProlemNumbers(problems); + scanTaskRelatedInfo.mergedProblems.get(filePath)!.push(...problems); + } +} + +function executeLintTask(scanTaskRelatedInfo: ScanTaskRelatedInfo): void { + const cmdOptions = scanTaskRelatedInfo.cmdOptions; + const compileOptions = scanTaskRelatedInfo.compileOptions; + const homeCheckResult = scanTaskRelatedInfo.homeCheckResult; + if (!scanTaskRelatedInfo.timeRecorder.getHomeCheckCountStatus()) { + scanTaskRelatedInfo.timeRecorder.startScan(); + } + const result = lint( + compileOptions, + scanTaskRelatedInfo.timeRecorder, + getEtsLoaderPath(compileOptions), + homeCheckResult + ); + for (const [filePath, problems] of result.problemsInfos) { + statistic.accumulateRuleNumbers( + problems, + scanTaskRelatedInfo.statisticsReportInPutInfo.ruleToNumbersMap, + scanTaskRelatedInfo.statisticsReportInPutInfo.ruleToAutoFixedNumbersMap + ); + scanTaskRelatedInfo.statisticsReportInPutInfo.arkOnePointOneProblemNumbers += + statistic.getArktsOnePointOneProlemNumbers(problems); + mergeLintProblems(filePath, problems, scanTaskRelatedInfo.mergedProblems, cmdOptions); + } +} + function mergeLintProblems( filePath: string, problems: ProblemInfo[], @@ -100,16 +177,6 @@ function mergeLintProblems( mergedProblems.set(filePath, []); } let filteredProblems = problems; - if (cmdOptions.linterOptions.arkts2) { - filteredProblems = problems.filter((problem) => { - return arkts2Rules.includes(problem.ruleTag); - }); - } - if (cmdOptions.onlySyntax) { - filteredProblems = problems.filter((problem) => { - return onlyArkts2SyntaxRules.has(problem.ruleTag); - }); - } mergedProblems.get(filePath)!.push(...filteredProblems); if (cmdOptions.scanWholeProjectInHomecheck) { @@ -133,35 +200,6 @@ function mergeLintProblems( } } -async function generateReportFile(reportData, reportPath?: string): Promise { - let reportFilePath = path.join('scan-report.json'); - if (reportPath !== undefined) { - reportFilePath = path.join(path.normalize(reportPath), 'scan-report.json'); - } - try { - await fs.promises.mkdir(path.dirname(reportFilePath), { recursive: true }); - await fs.promises.writeFile(reportFilePath, JSON.stringify(reportData, null, 2)); - } catch (error) { - console.error('Error generating report file:', error); - } -} - -async function processSyncOut(message: string): Promise { - await new Promise((resolve) => { - process.stdout.write(message, () => { - resolve('success'); - }); - }); -} - -async function processSyncErr(message: string): Promise { - await new Promise((resolve) => { - process.stderr.write(message, () => { - resolve('success'); - }); - }); -} - function getTempFileName(): string { return path.join(os.tmpdir(), Math.floor(Math.random() * 10000000).toString() + '_linter_tmp_file.ts'); } @@ -204,7 +242,7 @@ function runIdeModeDeprecated(cmdOptions: CommandLineOptions): void { cmdOptions.parsedConfigFile.fileNames.push(tmpFileName); } const compileOptions = compileLintOptions(cmdOptions); - const result = lint(compileOptions); + const result = lint(compileOptions, new TimeRecorder()); const problems = Array.from(result.problemsInfos.values()); if (problems.length === 1) { showJSONMessage(problems); diff --git a/ets2panda/linter/src/lib/BaseTypeScriptLinter.ts b/ets2panda/linter/src/lib/BaseTypeScriptLinter.ts index e1e433013c..cb711335e4 100644 --- a/ets2panda/linter/src/lib/BaseTypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/BaseTypeScriptLinter.ts @@ -26,6 +26,7 @@ import { faultsAttrs } from './FaultAttrs'; import { cookBookTag } from './CookBookMsg'; import { FaultID } from './Problems'; import { ProblemSeverity } from './ProblemSeverity'; +import { arkts2Rules, onlyArkts2SyntaxRules } from './utils/consts/ArkTS2Rules'; export abstract class BaseTypeScriptLinter { problemsInfos: ProblemInfo[] = []; @@ -75,18 +76,36 @@ export abstract class BaseTypeScriptLinter { autofix?: Autofix[], errorMsg?: string ): void { + const badNodeInfo = this.getbadNodeInfo(node, faultId, autofix, errorMsg); + + if (this.shouldSkipRule(badNodeInfo)) { + return; + } + + this.problemsInfos.push(badNodeInfo); + this.updateFileStats(faultId, badNodeInfo.line); + // problems with autofixes might be collected separately + if (this.options.reportAutofixCb && badNodeInfo.autofix) { + this.options.reportAutofixCb(badNodeInfo); + } + } + + private getbadNodeInfo( + node: ts.Node | ts.CommentRange, + faultId: number, + autofix?: Autofix[], + errorMsg?: string + ): ProblemInfo { const [startOffset, endOffset] = TsUtils.getHighlightRange(node, faultId); const startPos = this.sourceFile.getLineAndCharacterOfPosition(startOffset); const endPos = this.sourceFile.getLineAndCharacterOfPosition(endOffset); - const faultDescr = faultDesc[faultId]; const faultType = TypeScriptLinterConfig.tsSyntaxKindNames[node.kind]; - const cookBookMsgNum = faultsAttrs[faultId] ? faultsAttrs[faultId].cookBookRef : 0; const cookBookTg = errorMsg ? errorMsg : cookBookTag[cookBookMsgNum]; const severity = faultsAttrs[faultId]?.severity ?? ProblemSeverity.ERROR; const isMsgNumValid = cookBookMsgNum > 0; - autofix = autofix ? BaseTypeScriptLinter.addLineColumnInfoInAutofix(autofix, startPos, endPos) : autofix; + autofix = BaseTypeScriptLinter.processAutofix(autofix, startPos, endPos); const badNodeInfo: ProblemInfo = { line: startPos.line + 1, column: startPos.character + 1, @@ -106,12 +125,32 @@ export abstract class BaseTypeScriptLinter { autofix: autofix, autofixTitle: isMsgNumValid && autofix !== undefined ? cookBookRefToFixTitle.get(cookBookMsgNum) : undefined }; - this.problemsInfos.push(badNodeInfo); - this.updateFileStats(faultId, badNodeInfo.line); + return badNodeInfo; + } - // problems with autofixes might be collected separately - if (this.options.reportAutofixCb && badNodeInfo.autofix) { - this.options.reportAutofixCb(badNodeInfo); + private static processAutofix( + autofix: Autofix[] | undefined, + startPos: ts.LineAndCharacter, + endPos: ts.LineAndCharacter + ): Autofix[] | undefined { + return autofix ? BaseTypeScriptLinter.addLineColumnInfoInAutofix(autofix, startPos, endPos) : autofix; + } + + private shouldSkipRule(badNodeInfo: ProblemInfo): boolean { + const ruleConfigTags = this.options.ruleConfigTags; + if (ruleConfigTags && !ruleConfigTags.has(badNodeInfo.ruleTag)) { + return true; + } + if (this.options?.ideInteractive) { + if (this.options.onlySyntax) { + if (onlyArkts2SyntaxRules.has(badNodeInfo.ruleTag)) { + return false; + } + } else if (this.options.arkts2 && arkts2Rules.includes(badNodeInfo.ruleTag)) { + return false; + } + return true; } + return false; } } diff --git a/ets2panda/linter/src/lib/CommandLineOptions.ts b/ets2panda/linter/src/lib/CommandLineOptions.ts index 1bdde46fae..21ab3de973 100644 --- a/ets2panda/linter/src/lib/CommandLineOptions.ts +++ b/ets2panda/linter/src/lib/CommandLineOptions.ts @@ -27,11 +27,12 @@ export interface CommandLineOptions { arktsWholeProjectPath?: string; skipLinter?: boolean; homecheck?: boolean; - onlySyntax?: boolean; followSdkSettings?: boolean; devecoPluginModeDeprecated?: boolean; disableStrictDiagnostics?: boolean; outputFilePath?: string; verbose?: boolean; scanWholeProjectInHomecheck?: boolean; + ruleConfig?: string; + autofixCheck?: boolean; } diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index 17c0d8899b..512bc0b739 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -280,7 +280,7 @@ cookBookTag[270] = 'ArkTS1.2 cannot catch a non Error instance thrown from JS co cookBookTag[274] = 'The subclass constructor must call the parent class\'s parametered constructor (arkts-subclass-must-call-super-constructor-with-args)'; cookBookTag[275] = - 'Custom components with custom layout capability need to add the "@CustomLayout" decorator (arkui-custom-layout-need-add-decorator)'; + 'The Custom component with custom layout capability needs to add the "@CustomLayout" decorator (arkui-custom-layout-need-add-decorator)'; cookBookTag[281] = '"@Prop" decorator is not supported (arkui-no-prop-decorator)'; cookBookTag[282] = '"@StorageProp" decorator is not supported (arkui-no-storageprop-decorator)'; cookBookTag[283] = '"@LocalStorageProp" decorator is not supported (arkui-no-localstorageprop-decorator)'; @@ -315,7 +315,6 @@ cookBookTag[319] = cookBookTag[321] = 'Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)'; cookBookTag[322] = 'isConcurrent is not supported (arkts-limited-stdlib-no-support-isConcurrent)'; cookBookTag[323] = 'Direct export of interop JS objects is not supported (arkts-interop-js2s-export-js)'; -cookBookTag[324] = 'Direct export of interop ArkTS1.0 objects is not supported (arkts-interop-d2s-export-entity)'; cookBookTag[325] = 'Default parameters must be placed after mandatory parameters (arkts-default-args-behind-required-args)'; cookBookTag[326] = 'It is not allowed to create object literal in interop calls (arkts-interop-s2d-object-literal)'; @@ -352,6 +351,8 @@ cookBookTag[350] = 'The taskpool setCloneList interface is deleted from ArkTS1.2 (arkts-limited-stdlib-no-setCloneList)'; cookBookTag[351] = 'The taskpool setTransferList interface is deleted from ArkTS1.2 (arkts-limited-stdlib-no-setTransferList)'; +cookBookTag[352] = + '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)'; cookBookTag[355] = 'Usage of standard library is restricted(arkts-limited-stdlib-no-sendable-decorator)'; cookBookTag[356] = 'Usage of standard library is restricted(arkts-limited-stdlib-no-concurrent-decorator)'; cookBookTag[357] = 'Worker are not supported(arkts-no-need-stdlib-worker)'; @@ -368,6 +369,10 @@ cookBookTag[376] = 'Not supporting comparison between number type and bigint typ cookBookTag[377] = 'Non-decimal BigInt literals (0x/0o/0b) are not supported. Use decimal format instead (arkts-only-support-decimal-bigint-literal)'; cookBookTag[378] = 'Operator is not support (arkts-unsupport-operator)'; +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)'; 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 07f5587812..9a0e13b638 100644 --- a/ets2panda/linter/src/lib/FaultAttrs.ts +++ b/ets2panda/linter/src/lib/FaultAttrs.ts @@ -222,7 +222,6 @@ faultsAttrs[FaultID.MethodInheritRule] = new FaultAttributes(319); faultsAttrs[FaultID.LimitedStdLibNoImportConcurrency] = new FaultAttributes(321); faultsAttrs[FaultID.IsConcurrentDeprecated] = new FaultAttributes(322); faultsAttrs[FaultID.InteropJsObjectExport] = new FaultAttributes(323); -faultsAttrs[FaultID.InteropArkTs1ObjectExport] = new FaultAttributes(324); faultsAttrs[FaultID.DefaultArgsBehindRequiredArgs] = new FaultAttributes(325); faultsAttrs[FaultID.InteropStaticObjectLiterals] = new FaultAttributes(326); faultsAttrs[FaultID.InteropObjectLiteralAmbiguity] = new FaultAttributes(327); @@ -250,6 +249,7 @@ faultsAttrs[FaultID.BuiltinNoCtorFunc] = new FaultAttributes(348); faultsAttrs[FaultID.SharedArrayBufferDeprecated] = new FaultAttributes(349); faultsAttrs[FaultID.SetCloneListDeprecated] = new FaultAttributes(350); faultsAttrs[FaultID.SetTransferListDeprecated] = new FaultAttributes(351); +faultsAttrs[FaultID.SdkAbilityAsynchronousLifecycle] = new FaultAttributes(352); faultsAttrs[FaultID.LimitedStdLibNoSendableDecorator] = new FaultAttributes(355); faultsAttrs[FaultID.LimitedStdLibNoDoncurrentDecorator] = new FaultAttributes(356); faultsAttrs[FaultID.NoNeedStdlibWorker] = new FaultAttributes(357); @@ -264,3 +264,5 @@ faultsAttrs[FaultID.TsLikeCatchType] = new FaultAttributes(375); faultsAttrs[FaultID.NumericBigintCompare] = new FaultAttributes(376); faultsAttrs[FaultID.NondecimalBigint] = new FaultAttributes(377); faultsAttrs[FaultID.UnsupportOperator] = new FaultAttributes(378); +faultsAttrs[FaultID.StateStylesBlockNeedArrowFunc] = new FaultAttributes(381); +faultsAttrs[FaultID.PromiseVoidNeedResolveArg] = new FaultAttributes(382); \ No newline at end of file diff --git a/ets2panda/linter/src/lib/FaultDesc.ts b/ets2panda/linter/src/lib/FaultDesc.ts index 49646a1965..f1c2603b4f 100644 --- a/ets2panda/linter/src/lib/FaultDesc.ts +++ b/ets2panda/linter/src/lib/FaultDesc.ts @@ -173,7 +173,6 @@ faultDesc[FaultID.ExtendsExpression] = 'Extends Expression'; faultDesc[FaultID.NumericSemantics] = 'Numeric semantics'; faultDesc[FaultID.AnimatableExtendDecoratorTransform] = '"@AnimatableExtend" decorator'; faultDesc[FaultID.InteropJsObjectExport] = 'Interop JS object export'; -faultDesc[FaultID.InteropArkTs1ObjectExport] = 'Interop ArkTS1.0 object export'; faultDesc[FaultID.DefaultArgsBehindRequiredArgs] = 'Default parameters before mandatory'; faultDesc[FaultID.NoDuplicateFunctionName] = 'No duplicate function name'; faultDesc[FaultID.OhmUrlFullPath] = 'Require full path file name'; @@ -229,6 +228,7 @@ faultDesc[FaultID.BuiltinNoCtorFunc] = 'Api is not support ctor-signature and ca faultDesc[FaultID.SharedArrayBufferDeprecated] = 'SharedArrayBuffer is not supported'; faultDesc[FaultID.SetCloneListDeprecated] = 'setCloneList is not supported'; faultDesc[FaultID.SetTransferListDeprecated] = 'setTransferList is not supported'; +faultDesc[FaultID.SdkAbilityAsynchronousLifecycle] = '1.2 Void cannot be combined'; faultDesc[FaultID.LimitedStdLibNoSendableDecorator] = 'Limited stdlib no sendable decorator'; faultDesc[FaultID.LimitedStdLibNoDoncurrentDecorator] = 'Limited stdlib no concurrent decorator'; faultDesc[FaultID.NoNeedStdlibWorker] = 'No need stdlib worker'; @@ -252,3 +252,5 @@ faultDesc[FaultID.LocalStoragePropDecoratorNotSupported] = '"@LocalStorageProp" faultDesc[FaultID.PropFunctionNotSupported] = '"prop" function is not supported'; faultDesc[FaultID.SetAndPropFunctionNotSupported] = '"setAndProp" function is not supported'; faultDesc[FaultID.PropNeedCallMethodForDeepCopy] = 'Deep copy needs to call the specific method'; +faultDesc[FaultID.StateStylesBlockNeedArrowFunc] = 'StateStyles needs arrow function block'; +faultDesc[FaultID.PromiseVoidNeedResolveArg] = 'Promiseconstructor only supports using resolve (undefined)'; diff --git a/ets2panda/linter/src/lib/LintRunResult.ts b/ets2panda/linter/src/lib/LintRunResult.ts index 3397a3941a..9c1519d077 100644 --- a/ets2panda/linter/src/lib/LintRunResult.ts +++ b/ets2panda/linter/src/lib/LintRunResult.ts @@ -15,9 +15,11 @@ import type { ProblemInfo } from './ProblemInfo'; import type { ProjectStatistics } from './statistics/ProjectStatistics'; +import type { TimeRecorder } from './statistics/scan/TimeRecorder'; export interface LintRunResult { hasErrors: boolean; problemsInfos: Map; projectStats: ProjectStatistics; + timeRecorder?: TimeRecorder; } diff --git a/ets2panda/linter/src/lib/LinterOptions.ts b/ets2panda/linter/src/lib/LinterOptions.ts index 72613a4cd1..1d0743b5fb 100644 --- a/ets2panda/linter/src/lib/LinterOptions.ts +++ b/ets2panda/linter/src/lib/LinterOptions.ts @@ -44,6 +44,10 @@ export interface LinterOptions { noMigrationBackupFile?: boolean; migrationReport?: boolean; wholeProjectPath?: string; + projectFolderList?: string[]; checkTsAndJs?: boolean; inputFiles?: string[]; + onlySyntax?: boolean; + ruleConfigTags?: Set; + autofixCheck?: boolean; } diff --git a/ets2panda/linter/src/lib/LinterRunner.ts b/ets2panda/linter/src/lib/LinterRunner.ts index 453731f7bc..863687d554 100644 --- a/ets2panda/linter/src/lib/LinterRunner.ts +++ b/ets2panda/linter/src/lib/LinterRunner.ts @@ -16,6 +16,9 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import * as ts from 'typescript'; +import { processSyncErr } from '../lib/utils/functions/ProcessWrite'; +import * as qEd from './autofixes/QuasiEditor'; +import type { BaseTypeScriptLinter } from './BaseTypeScriptLinter'; import type { CommandLineOptions } from './CommandLineOptions'; import { InteropTypescriptLinter } from './InteropTypescriptLinter'; import type { LinterConfig } from './LinterConfig'; @@ -23,24 +26,24 @@ import type { LinterOptions } from './LinterOptions'; import type { LintRunResult } from './LintRunResult'; import { Logger } from './Logger'; import type { ProblemInfo } from './ProblemInfo'; -import { TypeScriptLinter } from './TypeScriptLinter'; +import { ProjectStatistics } from './statistics/ProjectStatistics'; +import { generateMigrationStatisicsReport } from './statistics/scan/ProblemStatisticsCommonFunction'; +import type { TimeRecorder } from './statistics/scan/TimeRecorder'; +import type { createProgramCallback } from './ts-compiler/Compiler'; +import { compileLintOptions } from './ts-compiler/Compiler'; import { getTscDiagnostics } from './ts-diagnostics/GetTscDiagnostics'; import { transformTscDiagnostics } from './ts-diagnostics/TransformTscDiagnostics'; +import { TypeScriptLinter } from './TypeScriptLinter'; import { ARKTS_IGNORE_DIRS_NO_OH_MODULES, ARKTS_IGNORE_DIRS_OH_MODULES, ARKTS_IGNORE_FILES } from './utils/consts/ArktsIgnorePaths'; +import { EXTNAME_JS, EXTNAME_TS } from './utils/consts/ExtensionName'; import { USE_STATIC } from './utils/consts/InteropAPI'; -import { EXTNAME_TS, EXTNAME_JS } from './utils/consts/ExtensionName'; +import { LibraryTypeCallDiagnosticChecker } from './utils/functions/LibraryTypeCallDiagnosticChecker'; import { mergeArrayMaps } from './utils/functions/MergeArrayMaps'; import { clearPathHelperCache, pathContainsDirectory } from './utils/functions/PathHelper'; -import { LibraryTypeCallDiagnosticChecker } from './utils/functions/LibraryTypeCallDiagnosticChecker'; -import type { createProgramCallback } from './ts-compiler/Compiler'; -import { compileLintOptions } from './ts-compiler/Compiler'; -import * as qEd from './autofixes/QuasiEditor'; -import { ProjectStatistics } from './statistics/ProjectStatistics'; -import type { BaseTypeScriptLinter } from './BaseTypeScriptLinter'; function prepareInputFilesList(cmdOptions: CommandLineOptions): string[] { let inputFiles = cmdOptions.inputFiles.map((x) => { @@ -76,6 +79,7 @@ function prepareInputFilesList(cmdOptions: CommandLineOptions): string[] { export function lint( config: LinterConfig, + timeRecorder: TimeRecorder, etsLoaderPath?: string, hcResults?: Map ): LintRunResult { @@ -83,7 +87,10 @@ export function lint( config.cmdOptions.linterOptions.etsLoaderPath = etsLoaderPath; } const lintResult = lintImpl(config); - return config.cmdOptions.linterOptions.migratorMode ? migrate(config, lintResult, hcResults) : lintResult; + timeRecorder.endScan(); + return config.cmdOptions.linterOptions.migratorMode ? + migrate(config, lintResult, timeRecorder, hcResults) : + lintResult; } function lintImpl(config: LinterConfig): LintRunResult { @@ -129,6 +136,7 @@ function lintFiles( TypeScriptLinter.initGlobals(); InteropTypescriptLinter.initGlobals(); + let fileCount: number = 0; for (const srcFile of srcFiles) { const linter: BaseTypeScriptLinter = !options.interopCheckMode ? @@ -138,6 +146,10 @@ function lintFiles( const problems = linter.problemsInfos; problemsInfos.set(path.normalize(srcFile.fileName), [...problems]); projectStats.fileStats.push(linter.fileStats); + fileCount = fileCount + 1; + if (options.ideInteractive) { + processSyncErr(`{"content":"${srcFile.fileName}","messageType":1,"indicator":${fileCount / srcFiles.length}}\n`); + } } return { @@ -150,8 +162,10 @@ function lintFiles( function migrate( initialConfig: LinterConfig, initialLintResult: LintRunResult, + timeRecorder: TimeRecorder, hcResults?: Map ): LintRunResult { + timeRecorder.startMigration(); let linterConfig = initialConfig; const { cmdOptions } = initialConfig; const updatedSourceTexts: Map = new Map(); @@ -182,6 +196,9 @@ function migrate( fs.writeFileSync(writeFileName, newText); }); + timeRecorder.endMigration(); + generateMigrationStatisicsReport(lintResult, timeRecorder, cmdOptions.outputFilePath); + if (cmdOptions.linterOptions.ideInteractive) { lintResult.problemsInfos = problemsInfosBeforeMigrate; } @@ -209,16 +226,9 @@ function fix( ): boolean { const program = linterConfig.tscCompiledProgram.getProgram(); let appliedFix = false; - const mergedProblems = lintResult.problemsInfos; - if (hcResults !== undefined) { - for (const [filePath, problems] of hcResults) { - if (mergedProblems.has(filePath)) { - mergedProblems.get(filePath)!.push(...problems); - } else { - mergedProblems.set(filePath, problems); - } - } - } + // Apply homecheck fixes first to avoid them being skipped due to conflict with linter autofixes + let mergedProblems: Map = hcResults ?? new Map(); + mergedProblems = mergeArrayMaps(mergedProblems, lintResult.problemsInfos); mergedProblems.forEach((problemInfos, fileName) => { const srcFile = program.getSourceFile(fileName); if (!srcFile) { @@ -231,7 +241,8 @@ function fix( linterConfig.cmdOptions.linterOptions.arkts2 && linterConfig.cmdOptions.inputFiles.includes(fileName) && !hasUseStaticDirective(srcFile) && - linterConfig.cmdOptions.linterOptions.ideInteractive; + linterConfig.cmdOptions.linterOptions.ideInteractive && + !qEd.QuasiEditor.hasAnyAutofixes(problemInfos); // If nothing to fix or don't need to add 'use static', then skip file if (!qEd.QuasiEditor.hasAnyAutofixes(problemInfos) && !needToAddUseStatic) { return; @@ -244,7 +255,9 @@ function fix( linterConfig.cmdOptions.outputFilePath ); updatedSourceTexts.set(fileName, qe.fix(problemInfos, needToAddUseStatic)); - appliedFix = true; + if (!needToAddUseStatic) { + appliedFix = true; + } }); return appliedFix; diff --git a/ets2panda/linter/src/lib/Problems.ts b/ets2panda/linter/src/lib/Problems.ts index e9dd80975f..e00674dce2 100644 --- a/ets2panda/linter/src/lib/Problems.ts +++ b/ets2panda/linter/src/lib/Problems.ts @@ -202,7 +202,6 @@ export enum FaultID { InteropJsObjectTraverseJsInstance, InteropJsObjectCallStaticFunc, InteropJsObjectExport, - InteropArkTs1ObjectExport, DefaultArgsBehindRequiredArgs, LimitedStdLibNoImportConcurrency, MissingSuperCall, @@ -230,6 +229,7 @@ export enum FaultID { SharedArrayBufferDeprecated, SetCloneListDeprecated, SetTransferListDeprecated, + SdkAbilityAsynchronousLifecycle, LimitedStdLibNoSendableDecorator, LimitedStdLibNoDoncurrentDecorator, NoNeedStdlibWorker, @@ -253,6 +253,8 @@ export enum FaultID { PropFunctionNotSupported, SetAndPropFunctionNotSupported, PropNeedCallMethodForDeepCopy, + StateStylesBlockNeedArrowFunc, + PromiseVoidNeedResolveArg, // 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 7a6dd23d96..2ba0b44631 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -19,7 +19,7 @@ import { FaultID } from './Problems'; import { TypeScriptLinterConfig } from './TypeScriptLinterConfig'; import type { Autofix } from './autofixes/Autofixer'; import { Autofixer } from './autofixes/Autofixer'; -import { SYMBOL, SYMBOL_CONSTRUCTOR, TsUtils } from './utils/TsUtils'; +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 { LIKE_FUNCTION } from './utils/consts/LikeFunction'; @@ -50,7 +50,8 @@ import { SENDABLE_DECORATOR, SENDABLE_DECORATOR_NODES, SENDABLE_FUNCTION_UNSUPPORTED_STAGES_IN_API12, - SENDBALE_FUNCTION_START_VERSION + SENDBALE_FUNCTION_START_VERSION, + TASKPOOL } from './utils/consts/SendableAPI'; import { DEFAULT_COMPATIBLE_SDK_VERSION, DEFAULT_COMPATIBLE_SDK_VERSION_STAGE } from './utils/consts/VersionInfo'; import { forEachNodeInSubtree } from './utils/functions/ForEachNodeInSubtree'; @@ -68,7 +69,9 @@ import { LIMITED_STD_OBJECT_API, LIMITED_STD_PROXYHANDLER_API, LIMITED_STD_REFLECT_API, - MODULE_IMPORTS + MODULE_IMPORTS, + ARKTSUTILS_MODULES, + ARKTSUTILS_LOCKS_MEMBER } from './utils/consts/LimitedStdAPI'; import { SupportedStdCallApiChecker } from './utils/functions/SupportedStdCallAPI'; import { identiferUseInValueContext } from './utils/functions/identiferUseInValueContext'; @@ -140,7 +143,19 @@ import type { ArrayAccess, UncheckedIdentifier } from './utils/consts/RuntimeChe import { NUMBER_LITERAL } from './utils/consts/RuntimeCheckAPI'; import { globalApiAssociatedInfo } from './utils/consts/AssociatedInfo'; import { ARRAY_API_LIST } from './utils/consts/ArraysAPI'; +import { + ABILITY_KIT, + ASYNC_LIFECYCLE_SDK_LIST, + ON_DESTROY, + ON_DISCONNECT, + PROMISE, + SERVICE_EXTENSION_ABILITY, + VOID +} from './utils/consts/AsyncLifecycleSDK'; import { ERROR_PROP_LIST } from './utils/consts/ErrorProp'; +import { D_ETS, D_TS } from './utils/consts/TsSuffix'; +import { arkTsBuiltInTypeName } from './utils/consts/ArkuiImportList'; +import { ERROR_TASKPOOL_PROP_LIST } from './utils/consts/ErrorProp'; interface InterfaceSymbolTypeResult { propNames: string[]; @@ -175,6 +190,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { static literalAsPropertyNameTypeSet: Set; private localApiListItem: ApiListItem | undefined = undefined; static constructorFuncsSet: Set; + static ConstructorIfaceSet: Set; static initGlobals(): void { TypeScriptLinter.sharedModulesCache = new Map(); @@ -268,11 +284,18 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } + private static addSdkConstructorIfaceSetData(item: ApiListItem): void { + if (item.api_info.problem === SdkProblem.ConstructorIface) { + TypeScriptLinter.ConstructorIfaceSet.add(item); + } + } + private static initSdkWhitelist(): void { TypeScriptLinter.indexedTypeSet = new Set(); TypeScriptLinter.literalAsPropertyNameTypeSet = new Set(); TypeScriptLinter.constructorFuncsSet = new Set(); const list: ApiList = new ApiList(apiWhiteList); + TypeScriptLinter.ConstructorIfaceSet = new Set(); if (list?.api_list?.length > 0) { for (const item of list.api_list) { if (item.file_path !== '') { @@ -285,6 +308,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { TypeScriptLinter.addSdkliteralAsPropertyNameTypeSetData(item); TypeScriptLinter.addSdkConstructorFuncsSetData(item); TypeScriptLinter.addGlobalApiInfosCollocetionData(item); + TypeScriptLinter.addSdkConstructorIfaceSetData(item); } } } @@ -600,13 +624,24 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } + static ifValidObjectLiteralProperty( + prop: ts.ObjectLiteralElementLike, + objLitExpr: ts.ObjectLiteralExpression + ): boolean { + return ( + ts.isPropertyAssignment(prop) || + ts.isShorthandPropertyAssignment(prop) && + (ts.isCallExpression(objLitExpr.parent) || ts.isNewExpression(objLitExpr.parent)) + ); + } + private handleObjectLiteralProperties( objectLiteralType: ts.Type | undefined, objectLiteralExpr: ts.ObjectLiteralExpression ): void { let objLiteralAutofix: Autofix[] | undefined; const invalidProps = objectLiteralExpr.properties.filter((prop) => { - return !ts.isPropertyAssignment(prop); + return !TypeScriptLinter.ifValidObjectLiteralProperty(prop, objectLiteralExpr); }); if ( @@ -635,22 +670,39 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } const arrayLitNode = node as ts.ArrayLiteralExpression; - let emptyContextTypeForArrayLiteral = false; - const arrayLitType = this.tsTypeChecker.getContextualType(arrayLitNode); if (arrayLitType && this.tsUtils.typeContainsSendableClassOrInterface(arrayLitType)) { this.incrementCounters(node, FaultID.SendableObjectInitialization); return; } + this.checkArrayElementsAndReportErrors(node, arrayLitNode, arrayLitType); + + this.handleObjectLiteralAssignmentToClass(arrayLitNode); + } + + private checkArrayElementsAndReportErrors( + node: ts.Node, + arrayLitNode: ts.ArrayLiteralExpression, + arrayLitType: undefined | ts.Type + ): void { + const parent = arrayLitNode.parent; + const arrayLitElements = arrayLitNode.elements; + const arrayElementIsEmpty = arrayLitElements.length === 0; + let emptyContextTypeForArrayLiteral = false; + /* * check that array literal consists of inferrable types * e.g. there is no element which is untyped object literals */ - const arrayLitElements = arrayLitNode.elements; - if (this.options.arkts2 && !arrayLitType && arrayLitElements.length === 0) { + const isPromiseEmptyArray = this.checkPromiseEmptyArray(parent, arrayElementIsEmpty); + const isEmptyArray = this.options.arkts2 && !arrayLitType && arrayElementIsEmpty; + if (isPromiseEmptyArray) { + this.incrementCounters(arrayLitNode, FaultID.NosparseArray); + } else if (isEmptyArray) { this.incrementCounters(node, FaultID.NosparseArray); } + for (const element of arrayLitElements) { const elementContextType = this.tsTypeChecker.getContextualType(element); if (ts.isObjectLiteralExpression(element)) { @@ -672,7 +724,25 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (emptyContextTypeForArrayLiteral) { this.incrementCounters(node, FaultID.ArrayLiteralNoContextType); } - this.handleObjectLiteralAssignmentToClass(arrayLitNode); + } + + private checkPromiseEmptyArray(parent: ts.Node, arrayElementIsEmpty: boolean): boolean { + if (this.options.arkts2 && ts.isCallExpression(parent) && arrayElementIsEmpty) { + const callExpr = parent; + const methodName = TypeScriptLinter.getPromiseMethodName(callExpr.expression); + if (methodName && PROMISE_METHODS.has(methodName)) { + return true; + } + return false; + } + return false; + } + + private static getPromiseMethodName(node: ts.Expression): string | undefined { + if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'Promise') { + return node.name.text; + } + return undefined; } private handleStructDeclaration(node: ts.StructDeclaration): void { @@ -1186,7 +1256,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const baseExprSym = this.tsUtils.trueSymbolAtLocation(propertyAccessNode.expression); const baseExprType = this.tsTypeChecker.getTypeAtLocation(propertyAccessNode.expression); this.handleTsInterop(propertyAccessNode, () => { - this.checkInteropForPropertyAccess(propertyAccessNode); + const type = this.tsTypeChecker.getTypeAtLocation(propertyAccessNode.expression); + this.checkUsageOfTsTypes(type, propertyAccessNode.expression); }); this.propertyAccessExpressionForInterop(propertyAccessNode); if (this.isPrototypePropertyAccess(propertyAccessNode, exprSym, baseExprSym, baseExprType)) { @@ -1203,7 +1274,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (this.options.advancedClassChecks && this.tsUtils.isClassObjectExpression(propertyAccessNode.expression)) { this.incrementCounters(propertyAccessNode.expression, FaultID.ClassAsObject); } - if (!!baseExprSym && TsUtils.symbolHasEsObjectType(baseExprSym)) { const faultId = this.options.arkts2 ? FaultID.EsValueTypeError : FaultID.EsValueType; this.incrementCounters(propertyAccessNode, faultId); @@ -1303,26 +1373,28 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (methodName !== ISCONCURRENT) { return; } - const moduleSpecifier = this.findModuleSpecifierforDepricatedIsConcurrent(node); - if (!moduleSpecifier || !ts.isStringLiteral(moduleSpecifier)) { + const symbol = this.tsUtils.trueSymbolAtLocation(node.expression); + if (!symbol) { return; } - if ( - TASKPOOL_MODULES.some((moduleName) => { - return TsUtils.removeOrReplaceQuotes(moduleSpecifier.getText(), false) === moduleName; - }) - ) { - this.incrementCounters(node.name, FaultID.IsConcurrentDeprecated); - } - } + if (symbol.name === TASKPOOL) { + const decl = TsUtils.getDeclaration(symbol); - findModuleSpecifierforDepricatedIsConcurrent(node: ts.PropertyAccessExpression): ts.Expression | undefined { - let symbol = this.tsUtils.trueSymbolAtLocation(node.expression); - if (symbol && 'unknown' === symbol.name) { - symbol = this.tsTypeChecker.getSymbolAtLocation(node.expression); + if (!decl) { + return; + } + + const sourceFile = decl.getSourceFile(); + const fileName = path.basename(sourceFile.fileName); + + if ( + TASKPOOL_MODULES.some((moduleName) => { + return fileName.startsWith(moduleName) && (fileName.endsWith(D_TS) || fileName.endsWith(D_ETS)); + }) + ) { + this.incrementCounters(node.name, FaultID.IsConcurrentDeprecated); + } } - const importDecl = ts.findAncestor(TsUtils.getDeclaration(symbol), ts.isImportDeclaration); - return importDecl?.moduleSpecifier; } checkFunctionProperty( @@ -1343,44 +1415,16 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } - private checkInteropForPropertyAccess(pan: ts.PropertyAccessExpression): void { - if (ts.isBinaryExpression(pan.parent)) { - this.checkAssignmentOfPan(pan.parent, pan); - } else { - const type = this.tsTypeChecker.getTypeAtLocation(pan.expression); - this.checkUsageOfTsTypes(type, pan.expression); - } - } - - private checkAssignmentOfPan(binaryExpr: ts.BinaryExpression, pan: ts.PropertyAccessExpression): void { - if (binaryExpr.left !== pan) { - return; - } - - if (binaryExpr.operatorToken.kind !== ts.SyntaxKind.EqualsToken) { - this.incrementCounters(pan, FaultID.InteropDirectAccessToTSTypes); - return; - } - - const rhs = binaryExpr.right; - const lhs = binaryExpr.left as ts.PropertyAccessExpression; - - const autofix = this.autofixer?.fixInteropTsType(binaryExpr, lhs, rhs); - this.incrementCounters(pan, FaultID.InteropDirectAccessToTSTypes, autofix); - } - private checkUsageOfTsTypes(baseType: ts.Type, node: ts.Node): void { - if (this.tsUtils.isStringType(baseType)) { - return; - } - if (this.tsUtils.isStdNumberType(baseType)) { - return; - } - if (this.tsUtils.isStdBooleanType(baseType)) { - return; + const typeString = this.tsTypeChecker.typeToString(baseType); + if ( + TsUtils.isAnyType(baseType) || + TsUtils.isUnknownType(baseType) || + this.tsUtils.isStdFunctionType(baseType) || + typeString === 'symbol' + ) { + this.incrementCounters(node, FaultID.InteropDirectAccessToTSTypes); } - - this.incrementCounters(node, FaultID.InteropDirectAccessToTSTypes); } checkUnionTypes(propertyAccessNode: ts.PropertyAccessExpression): void { @@ -1398,14 +1442,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const typeMap = new Map(); if (commonPropertyType.length === allType.length) { allType.forEach((type) => { - const propertySymbol = this.tsUtils.findProperty(type, propertyAccessNode.name.getText()); - if (propertySymbol?.declarations) { - const propertyType = this.tsTypeChecker.getTypeOfSymbolAtLocation( - propertySymbol, - propertySymbol.declarations[0] - ); - typeMap.set(propertyType, propertyAccessNode.name.getText()); - } + this.handleTypeMember(type, propertyAccessNode.name.getText(), typeMap); }); if (typeMap.size > 1) { this.incrementCounters(propertyAccessNode, FaultID.AvoidUnionTypes); @@ -1413,6 +1450,42 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } + private handleTypeMember( + type: ts.Type, + memberName: string, + typeMap: Map + ): void { + const propertySymbol = this.tsUtils.findProperty(type, memberName); + if (!propertySymbol?.declarations) { + return; + } + const propertyType = this.tsTypeChecker.getTypeOfSymbolAtLocation(propertySymbol, propertySymbol.declarations[0]); + const symbol = propertySymbol.valueDeclaration; + if (!symbol) { + return; + } + if (ts.isMethodDeclaration(symbol)) { + const returnType = this.getMethodReturnType(propertySymbol); + typeMap.set(returnType, memberName); + } else { + typeMap.set(propertyType, memberName); + } + } + + private getMethodReturnType(symbol: ts.Symbol): string | undefined { + const declaration = symbol.valueDeclaration ?? (symbol.declarations?.[0] as ts.Node | undefined); + if (!declaration) { + return undefined; + } + const methodType = this.tsTypeChecker.getTypeOfSymbolAtLocation(symbol, declaration); + const signatures = methodType.getCallSignatures(); + if (signatures.length === 0) { + return 'void'; + } + const returnType = signatures[0].getReturnType(); + return this.tsTypeChecker.typeToString(returnType); + } + private handleLiteralAsPropertyName(node: ts.PropertyDeclaration | ts.PropertySignature): void { const propName = node.name; if (!!propName && (ts.isNumericLiteral(propName) || this.options.arkts2 && ts.isStringLiteral(propName))) { @@ -1997,6 +2070,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleNumericBigintCompare(tsBinaryExpr); this.handleArkTSPropertyAccess(tsBinaryExpr); this.handleObjectLiteralAssignmentToClass(tsBinaryExpr); + this.handleAssignmentNotsLikeSmartType(tsBinaryExpr); } private checkInterOpImportJsDataCompare(expr: ts.BinaryExpression): void { @@ -3326,6 +3400,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleMethodInherit(tsMethodDecl); this.handleSdkGlobalApi(tsMethodDecl); this.handleLimitedVoidFunction(tsMethodDecl); + this.checkVoidLifecycleReturn(tsMethodDecl); } private handleLimitedVoidFunction(node: ts.FunctionLikeDeclaration): void { @@ -3390,9 +3465,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { continue; } - const baseMethodDecl = baseMethod.declarations?.find((d) => { - return ts.isMethodDeclaration(d) || ts.isMethodSignature(d); - }) as ts.MethodDeclaration | ts.MethodSignature | undefined; + const baseMethodDecl = baseMethod.declarations?.find( + (d) => { + return (ts.isMethodDeclaration(d) || ts.isMethodSignature(d)) && + this.tsTypeChecker.getTypeAtLocation(d.parent) === baseType; + } + ) as ts.MethodDeclaration | ts.MethodSignature; if (!baseMethodDecl) { continue; @@ -3480,6 +3558,10 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const baseReturnType = this.tsTypeChecker.getTypeAtLocation(baseMethod.type); const derivedReturnType = this.tsTypeChecker.getTypeAtLocation(derivedMethod.type); + if (this.isDerivedTypeAssignable(derivedReturnType, baseReturnType)) { + return; + } + if (!this.isTypeAssignable(derivedReturnType, baseReturnType)) { this.incrementCounters(derivedMethod.type, FaultID.MethodInheritRule); } @@ -3518,6 +3600,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { // Checks structural assignability between two types. private isTypeAssignable(fromType: ts.Type, toType: ts.Type): boolean { + if (this.isDerivedTypeAssignable(fromType, toType)) { + return true; + } const fromTypes = this.flattenUnionTypes(fromType); const toTypes = new Set(this.flattenUnionTypes(toType)); @@ -3527,6 +3612,35 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { }); } + private isDerivedTypeAssignable(derivedType: ts.Type, baseType: ts.Type): boolean { + const baseSymbol = baseType.getSymbol(); + const derivedSymbol = derivedType.getSymbol(); + + if (!baseSymbol || !derivedSymbol) { + return false; + } + const baseDeclarations = baseSymbol.getDeclarations(); + const derivedDeclarations = derivedSymbol.getDeclarations(); + + if (!baseDeclarations || !derivedDeclarations) { + return false; + } + const baseTypeNode = baseDeclarations[0]; + const derivedTypeNode = derivedDeclarations[0]; + + if (ts.isClassDeclaration(baseTypeNode) && ts.isClassDeclaration(derivedTypeNode)) { + const baseTypes = this.tsTypeChecker.getTypeAtLocation(derivedTypeNode).getBaseTypes(); + const baseTypesExtends = baseTypes?.some((t) => { + return t === baseType; + }); + if (baseTypesExtends) { + return true; + } + } + + return false; + } + // Converts union types into an array of type strings for easy comparison. private flattenUnionTypes(type: ts.Type): string[] { if (type.isUnion()) { @@ -3670,6 +3784,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (isArkTs2) { this.checkWorkerSymbol(tsIdentSym, node); this.checkCollectionsSymbol(tsIdentSym, node); + this.checkConcurrencySymbol(tsIdentSym, node); } } @@ -3866,15 +3981,34 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private handleIllegalSymbolUsage(tsIdentifier: ts.Identifier, tsIdentSym: ts.Symbol): void { if (tsIdentSym.flags & ts.SymbolFlags.ValueModule) { this.incrementCounters(tsIdentifier, FaultID.NamespaceAsObject); - } else { - const typeName = tsIdentifier.getText(); - const isWrapperObject = typeName === 'Number' || typeName === 'String' || typeName === 'Boolean'; + return; + } - if (!isWrapperObject) { - const faultId = this.options.arkts2 ? FaultID.ClassAsObjectError : FaultID.ClassAsObject; - this.incrementCounters(tsIdentifier, faultId); + const typeName = tsIdentifier.getText(); + const isWrapperObject = typeName === 'Number' || typeName === 'String' || typeName === 'Boolean'; + if (isWrapperObject) { + return; + } + + // Special-case element-access cast for autofix: (X as object)["prop"] + const asExpr = tsIdentifier.parent; + let elemAccess: ts.ElementAccessExpression | undefined; + + if ( + ts.isAsExpression(asExpr) && + ts.isParenthesizedExpression(asExpr.parent) && + ts.isElementAccessExpression(asExpr.parent.parent) && + ts.isStringLiteral(asExpr.parent.parent.argumentExpression) + ) { + // only care if it’s literally “as object” && static-class casts + if (asExpr.type.getText() === 'object' && tsIdentSym.flags & ts.SymbolFlags.Class) { + elemAccess = asExpr.parent.parent; } } + + const autofix = elemAccess ? this.autofixer?.fixPropertyAccessByIndex(elemAccess) : undefined; + const faultId = this.options.arkts2 ? FaultID.ClassAsObjectError : FaultID.ClassAsObject; + this.incrementCounters(tsIdentifier, faultId, autofix); } private isElementAcessAllowed(type: ts.Type, argType: ts.Type): boolean { @@ -3910,12 +4044,33 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private handleElementAccessExpression(node: ts.Node): void { const tsElementAccessExpr = node as ts.ElementAccessExpression; - const tsElementAccessExprSymbol = this.tsUtils.trueSymbolAtLocation(tsElementAccessExpr.expression); const tsElemAccessBaseExprType = this.tsUtils.getNonNullableType( this.tsUtils.getTypeOrTypeConstraintAtLocation(tsElementAccessExpr.expression) ); const tsElemAccessArgType = this.tsTypeChecker.getTypeAtLocation(tsElementAccessExpr.argumentExpression); + if (this.tsUtils.hasEsObjectType(tsElementAccessExpr.expression)) { + const faultId = this.options.arkts2 ? FaultID.EsValueTypeError : FaultID.EsValueType; + this.incrementCounters(node, faultId); + } + if (this.tsUtils.isOrDerivedFrom(tsElemAccessBaseExprType, this.tsUtils.isIndexableArray)) { + this.handleIndexNegative(node); + } + this.checkPropertyAccessByIndex(tsElementAccessExpr, tsElemAccessBaseExprType, tsElemAccessArgType); + this.checkArrayUsageWithoutBound(tsElementAccessExpr); + this.checkArrayIndexType(tsElemAccessBaseExprType, tsElemAccessArgType, tsElementAccessExpr); + this.fixJsImportElementAccessExpression(tsElementAccessExpr); + this.checkInterOpImportJsIndex(tsElementAccessExpr); + this.checkEnumGetMemberValue(tsElementAccessExpr); + } + + private checkPropertyAccessByIndex( + tsElementAccessExpr: ts.ElementAccessExpression, + tsElemAccessBaseExprType: ts.Type, + tsElemAccessArgType: ts.Type + ): void { + const tsElementAccessExprSymbol = this.tsUtils.trueSymbolAtLocation(tsElementAccessExpr.expression); + const isSet = TsUtils.isSetExpression(tsElementAccessExpr); const isSetIndexable = isSet && @@ -3930,28 +4085,37 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if ( // unnamed types do not have symbol, so need to check that explicitly - !this.tsUtils.isLibrarySymbol(tsElementAccessExprSymbol) && - !ts.isArrayLiteralExpression(tsElementAccessExpr.expression) && - !this.isElementAcessAllowed(tsElemAccessBaseExprType, tsElemAccessArgType) && - !(this.options.arkts2 && isGetIndexable) && - !(this.options.arkts2 && isSetIndexable) + this.tsUtils.isLibrarySymbol(tsElementAccessExprSymbol) || + ts.isArrayLiteralExpression(tsElementAccessExpr.expression) || + this.isElementAcessAllowed(tsElemAccessBaseExprType, tsElemAccessArgType) || + this.options.arkts2 && isGetIndexable || + this.options.arkts2 && isSetIndexable ) { - const autofix = this.autofixer?.fixPropertyAccessByIndex(tsElementAccessExpr); - this.incrementCounters(node, FaultID.PropertyAccessByIndex, autofix); + return; } - if (this.tsUtils.hasEsObjectType(tsElementAccessExpr.expression)) { - const faultId = this.options.arkts2 ? FaultID.EsValueTypeError : FaultID.EsValueType; - this.incrementCounters(node, faultId); + if (this.isStaticClassAccess(tsElementAccessExpr)) { + return; } - if (this.tsUtils.isOrDerivedFrom(tsElemAccessBaseExprType, this.tsUtils.isIndexableArray)) { - this.handleIndexNegative(node); + + const autofix = this.autofixer?.fixPropertyAccessByIndex(tsElementAccessExpr); + this.incrementCounters(tsElementAccessExpr, FaultID.PropertyAccessByIndex, autofix); + } + + /** + * Returns true if this element-access is a static-class cast (e.g., (A as object)["foo"]). + */ + private isStaticClassAccess(expr: ts.ElementAccessExpression): boolean { + const inner = expr.expression; + if ( + ts.isParenthesizedExpression(inner) && + ts.isAsExpression(inner.expression) && + ts.isIdentifier(inner.expression.expression) + ) { + const sym = this.tsTypeChecker.getSymbolAtLocation(inner.expression.expression); + return !!(sym && sym.flags & ts.SymbolFlags.Class); } - this.checkArrayUsageWithoutBound(tsElementAccessExpr); - this.checkArrayIndexType(tsElemAccessBaseExprType, tsElemAccessArgType, tsElementAccessExpr); - this.fixJsImportElementAccessExpression(tsElementAccessExpr); - this.checkInterOpImportJsIndex(tsElementAccessExpr); - this.checkEnumGetMemberValue(tsElementAccessExpr); + return false; } private checkInterOpImportJsIndex(expr: ts.ElementAccessExpression): void { @@ -4337,7 +4501,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const tsCallExpr = node as ts.CallExpression; this.handleStateStyles(tsCallExpr); this.handleBuiltinCtorCallSignature(tsCallExpr); - + this.handleSdkConstructorIfaceForCallExpression(tsCallExpr); if (this.options.arkts2 && tsCallExpr.typeArguments !== undefined) { this.handleSdkPropertyAccessByIndex(tsCallExpr); } @@ -4355,6 +4519,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } else if (this.options.arkts2) { this.handleGenericCallWithNoTypeArgs(tsCallExpr, callSignature); } + this.handleNotsLikeSmartTypeOnCallExpression(tsCallExpr, callSignature); } this.handleInteropForCallExpression(tsCallExpr); this.handleLibraryTypeCall(tsCallExpr); @@ -4392,7 +4557,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const type = this.tsTypeChecker.getTypeAtLocation(expression); const typeText = this.tsTypeChecker.typeToString(type); if (typeText === LIKE_FUNCTION) { - const autofix = this.autofixer?.fixNoTsLikeFunctionCall(expression); + const autofix = this.autofixer?.fixNoTsLikeFunctionCall(callExpr); this.incrementCounters(expression, FaultID.ExplicitFunctionType, autofix); } } @@ -4519,32 +4684,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return false; } - private isExportedEntityDeclaredInArkTs1(exportDecl: ts.ExportDeclaration): boolean | undefined { - if (!this.options.arkts2 || !this.useStatic) { - return false; - } - - // For named exports with braces { ... } - if (exportDecl.exportClause && ts.isNamedExports(exportDecl.exportClause)) { - for (const exportSpecifier of exportDecl.exportClause.elements) { - const identifier = exportSpecifier.name; - if (this.tsUtils.isExportImportedFromArkTs1(identifier, exportDecl)) { - return true; - } - } - } - - // For namespace exports (export * as namespace from ...) - if (exportDecl.exportClause && ts.isNamespaceExport(exportDecl.exportClause)) { - const namespaceIdentifier = exportDecl.exportClause.name; - if (this.tsUtils.isExportImportedFromArkTs1(namespaceIdentifier, exportDecl)) { - return true; - } - } - - return false; - } - private isDeclaredInArkTs2(callSignature: ts.Signature): boolean | undefined { const declarationSourceFile = callSignature?.declaration?.getSourceFile(); if (!declarationSourceFile) { @@ -4560,17 +4699,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return false; } - private checkRestrictedAPICall(node: ts.Node): void { - if (ts.isCallExpression(node)) { - if (TypeScriptLinter.isReflectAPICall(node)) { - this.incrementCounters(node.parent, FaultID.InteropCallReflect); - return; - } - - const signature = this.tsTypeChecker.getResolvedSignature(node); - if (signature) { - this.checkForForbiddenAPIs(signature, node); - } + private checkRestrictedAPICall(node: ts.CallExpression): void { + if (TypeScriptLinter.isReflectAPICall(node)) { + this.incrementCounters(node.parent, FaultID.InteropCallReflect); } } @@ -4591,11 +4722,31 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return false; } + private shouldCheckForForbiddenAPI(declaration: ts.SignatureDeclaration | ts.JSDocSignature): boolean { + for (const parameter of declaration.parameters) { + if (ts.isJSDocParameterTag(parameter)) { + continue; + } + const parameterType = this.tsTypeChecker.getTypeAtLocation(parameter); + const parameterTypeString = this.tsTypeChecker.typeToString(parameterType); + + if (parameterTypeString === OBJECT_LITERAL) { + return true; + } + } + + return false; + } + private checkForForbiddenAPIs(callSignature: ts.Signature, tsCallExpr: ts.CallExpression): void { if (!callSignature.declaration) { return; } + if (!this.shouldCheckForForbiddenAPI(callSignature.declaration)) { + return; + } + const functionSymbol = this.getFunctionSymbol(callSignature.declaration); const functionDeclaration = functionSymbol?.valueDeclaration; if (!functionDeclaration) { @@ -5013,30 +5164,32 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!this.options.arkts2 || !this.useStatic) { return; } - - if (!ts.isReturnStatement(newExpression.parent)) { - return; - } - const calleeExpr = newExpression.expression; if (!ts.isIdentifier(calleeExpr)) { return; } const type = this.tsTypeChecker.getTypeAtLocation(calleeExpr); - if (!type.symbol) { - return; - } - const typeDeclarations = type.symbol.declarations; - if (!typeDeclarations || typeDeclarations.length === 0) { - return; - } - - if (!ts.isInterfaceDeclaration(typeDeclarations[0])) { - return; + const typeDeclaration = TsUtils.getDeclaration(type.symbol); + if (typeDeclaration && ts.isInterfaceDeclaration(typeDeclaration) && type.symbol) { + const filePath = typeDeclaration.getSourceFile().fileName; + this.checkIsConstructorIface(calleeExpr, type.symbol.name, path.basename(filePath)); } + } - this.incrementCounters(calleeExpr, FaultID.ConstructorIfaceFromSdk); + private checkIsConstructorIface(node: ts.Node, symbol: string, filePath: string): void { + const constructorIfaceSetInfos = Array.from(TypeScriptLinter.ConstructorIfaceSet); + constructorIfaceSetInfos.some((constructorFuncsInfo) => { + const api_name = constructorFuncsInfo.api_info.parent_api[0].api_name; + if ( + symbol === api_name && + (constructorFuncsInfo.file_path.includes(filePath) || constructorFuncsInfo.import_path.includes(filePath)) + ) { + this.incrementCounters(node, FaultID.ConstructorIfaceFromSdk); + return true; + } + return false; + }); } private handleNewExpression(node: ts.Node): void { @@ -5073,6 +5226,50 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } this.handleSendableGenericTypes(tsNewExpr); this.handleInstantiatedJsObject(tsNewExpr, sym); + this.handlePromiseNeedVoidResolve(tsNewExpr); + } + + handlePromiseNeedVoidResolve(newExpr: ts.NewExpression): void { + if (!this.options.arkts2) { + return; + } + + if (!ts.isIdentifier(newExpr.expression) || newExpr.expression.text !== 'Promise') { + return; + } + + const typeArg = newExpr.typeArguments?.[0]; + if (!typeArg) { + return; + } + + const type = this.tsTypeChecker.getTypeAtLocation(typeArg); + if (!(type.getFlags() & ts.TypeFlags.Void)) { + return; + } + + const executor = newExpr.arguments?.[0]; + if (!executor || !ts.isFunctionLike(executor)) { + return; + } + + const resolveParam = executor.parameters[0]; + if (resolveParam?.type) { + if (ts.isFunctionTypeNode(resolveParam.type) && + resolveParam.type.parameters.length === 0) { + this.incrementCounters(resolveParam.type,FaultID.PromiseVoidNeedResolveArg); + } + } + if (executor.body) { + ts.forEachChild(executor.body, node => { + if (ts.isCallExpression(node) && + ts.isIdentifier(node.expression) && + node.expression.text === 'resolve' && + node.arguments.length === 0) { + this.incrementCounters(node,FaultID.PromiseVoidNeedResolveArg); + } + }); + } } private checkCreatingPrimitiveTypes(tsNewExpr: ts.NewExpression): void { @@ -5154,6 +5351,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleNoTuplesArrays(node, targetType, exprType); this.handleObjectLiteralAssignmentToClass(tsAsExpr); this.handleArrayTypeImmutable(tsAsExpr, exprType, targetType); + this.handleNotsLikeSmartTypeOnAsExpression(tsAsExpr); } private isExemptedAsExpression(node: ts.AsExpression): boolean { @@ -5266,6 +5464,52 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } + private handleSdkConstructorIfaceForCallExpression(callExpr: ts.CallExpression): void { + if (!this.options.arkts2) { + return; + } + let type: ts.Type | undefined; + if (!callExpr.arguments || callExpr.arguments.length === 0) { + if (ts.isPropertyAccessExpression(callExpr.expression)) { + type = this.tsTypeChecker.getTypeAtLocation(callExpr.expression.expression); + } + } + callExpr.arguments.some((args) => { + if (ts.isIdentifier(args)) { + type = this.tsTypeChecker.getTypeAtLocation(args); + } + }); + if (!type) { + return; + } + const decl = TsUtils.getDeclaration(type?.symbol); + if (!decl) { + return; + } + const filePath = TypeScriptLinter.getFileName(decl); + this.checkIsConstructorIface(callExpr, type.symbol.name, filePath); + } + + private static getFileName(decl: ts.Declaration): string { + let filePath = ''; + if ( + ts.isImportSpecifier(decl) && + ts.isImportDeclaration(decl.parent.parent.parent) && + ts.isStringLiteral(decl.parent.parent.parent.moduleSpecifier) + ) { + filePath = decl.parent.parent.parent.moduleSpecifier.text; + } else if ( + ts.isImportClause(decl) && + ts.isImportDeclaration(decl.parent) && + ts.isStringLiteral(decl.parent.moduleSpecifier) + ) { + filePath = decl.parent.moduleSpecifier.text; + } else { + filePath = decl.getSourceFile().fileName; + } + return path.basename(filePath); + } + private handleSharedArrayBuffer( node: ts.TypeReferenceNode | ts.NewExpression | ts.ExpressionWithTypeArguments ): void { @@ -5934,11 +6178,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } - if (this.isExportedEntityDeclaredInArkTs1(exportDecl)) { - this.incrementCounters(node, FaultID.InteropArkTs1ObjectExport); - return; - } - if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(node.parent)) { return; } @@ -6573,13 +6812,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!this.options.arkts2) { return; } - if ( - !( - this.tsUtils.isOrDerivedFrom(lhsType, this.tsUtils.isArray) && - this.tsUtils.isOrDerivedFrom(rhsType, this.tsUtils.isArray) && - lhsType !== rhsType - ) - ) { + const isArray = + this.tsUtils.isOrDerivedFrom(lhsType, this.tsUtils.isArray) && + this.tsUtils.isOrDerivedFrom(rhsType, this.tsUtils.isArray); + const isTuple = + this.tsUtils.isOrDerivedFrom(lhsType, TsUtils.isTuple) && this.tsUtils.isOrDerivedFrom(rhsType, TsUtils.isTuple); + if (!((isArray || isTuple) && lhsType !== rhsType)) { return; } @@ -7025,6 +7263,20 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.checkSymbolAndExecute(symbol, WORKER_TEXT, WORKER_MODULES, cb); } + private checkConcurrencySymbol(symbol: ts.Symbol, node: ts.Node): void { + const cb = (): void => { + const parent = node.parent; + if (!ts.isPropertyAccessExpression(parent)) { + return; + } + if (parent.name.text === ARKTSUTILS_LOCKS_MEMBER) { + this.incrementCounters(node, FaultID.LimitedStdLibNoImportConcurrency); + } + }; + + this.checkSymbolAndExecute(symbol, ARKTSUTILS_LOCKS_MEMBER, ARKTSUTILS_MODULES, cb); + } + private checkSymbolAndExecute(symbol: ts.Symbol, symbolName: string, modules: string[], cb: () => void): void { void this; if (symbol.name === symbolName) { @@ -7244,7 +7496,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const autofix = this.autofixer?.fixStateStyles(object, startNode, this.interfacesNeedToImport); - this.incrementCounters(object, FaultID.StylesDecoratorNotSupported, autofix); + this.incrementCounters(object, FaultID.StateStylesBlockNeedArrowFunc, autofix); } private static hasAnonBlock(properties: ts.NodeArray): boolean { @@ -7826,20 +8078,58 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!hasSameApiName) { return; } - if (ts.isTypeReferenceNode(errorNode)) { errorNode = errorNode.typeName; } - const matchedApi = apiNamesArr.some((sdkInfo) => { const isSameName = sdkInfo.api_info.api_name === apiName; const isGlobal = sdkInfo.is_global; return isSameName && isGlobal; }); + const checkSymbol = this.isIdentifierFromSDK(errorNode); + const type = this.tsTypeChecker.getTypeAtLocation(errorNode); + const typeName = this.tsTypeChecker.typeToString(type); - if (matchedApi) { - this.incrementCounters(errorNode, faultId); + if (checkSymbol) { + if (arkTsBuiltInTypeName.has(typeName)) { + return; + } + if (matchedApi) { + this.incrementCounters(errorNode, faultId); + } + } + } + + private isIdentifierFromSDK(node: ts.Node): boolean { + const symbol = this.tsTypeChecker.getSymbolAtLocation(node); + if (!symbol) { + return true; + } + + // Check if the symbol is from an SDK import + const declarations = symbol.getDeclarations(); + if (!declarations || declarations.length === 0) { + return true; + } + + let isLocal = false; + for (const declaration of declarations) { + if (ts.isVariableDeclaration(declaration) || + ts.isTypeAliasDeclaration(declaration) || + ts.isClassDeclaration(declaration) || + ts.isInterfaceDeclaration(declaration) || + ts.isFunctionDeclaration(declaration) || + ts.isEnumDeclaration(declaration)) { + isLocal = true; + break + } + } + + if(isLocal) { + return false; } + + return true; } private handleSdkGlobalApi( @@ -7918,6 +8208,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private checkCallExpressionForSdkGlobalApi(node: ts.CallExpression): void { if (ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.expression)) { const expression = node.expression.expression; + this.processApiNodeSdkGlobalApi(expression.text, expression); } } @@ -8083,6 +8374,152 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } + /** + * Returns true if the method’s declared return type or body returns Promise. + */ + private hasPromiseVoidReturn(method: ts.MethodDeclaration): boolean { + return ( + this.hasAnnotatedPromiseVoidReturn(method) || this.isAsyncMethod(method) || this.hasBodyPromiseReturn(method) + ); + } + + /** + * Checks if the method’s declared return type annotation includes Promise. + */ + private hasAnnotatedPromiseVoidReturn(method: ts.MethodDeclaration): boolean { + void this; + if (!method.type) { + return false; + } + const t = method.type; + // Union type check + if (ts.isUnionTypeNode(t)) { + return t.types.some((u) => { + return this.isSinglePromiseVoid(u); + }); + } + // Single Promise check + return this.isSinglePromiseVoid(t); + } + + private isSinglePromiseVoid(n: ts.Node): boolean { + void this; + return ts.isTypeReferenceNode(n) && n.typeName.getText() === PROMISE && n.typeArguments?.[0]?.getText() === VOID; + } + + /** + * Checks if the method is declared async (implying Promise return). + */ + private isAsyncMethod(method: ts.MethodDeclaration): boolean { + void this; + return ( + method.modifiers?.some((m) => { + return m.kind === ts.SyntaxKind.AsyncKeyword; + }) ?? false + ); + } + + /** + * Scans the method body iteratively for any Promise-returning statements. + */ + private hasBodyPromiseReturn(method: ts.MethodDeclaration): boolean { + if (!method.body) { + return false; + } + + let found = false; + const visit = (node: ts.Node): void => { + if (ts.isReturnStatement(node) && node.expression) { + const retType = this.tsTypeChecker.getTypeAtLocation(node.expression); + if (retType.symbol?.getName() === PROMISE) { + found = true; + return; + } + } + ts.forEachChild(node, visit); + }; + ts.forEachChild(method.body, visit); + + return found; + } + + /** + * Returns true if this method name is onDestroy/onDisconnect and class extends one of the supported Ability subclasses. + */ + private isLifecycleMethodOnAbilitySubclass(method: ts.MethodDeclaration): boolean { + const name = method.name.getText(); + if (name !== ON_DESTROY && name !== ON_DISCONNECT) { + return false; + } + const cls = method.parent; + if (!ts.isClassDeclaration(cls) || !cls.heritageClauses) { + return false; + } + return cls.heritageClauses.some((h) => { + return ( + h.token === ts.SyntaxKind.ExtendsKeyword && + h.types.some((tn) => { + return this.isSupportedAbilityBase(method.name.getText(), tn.expression); + }) + ); + }); + } + + /** + * Checks that the base class name and its import source or declaration file are supported, + * and matches the lifecycle method (onDestroy vs onDisconnect). + */ + private isSupportedAbilityBase(methodName: string, baseExprNode: ts.Expression): boolean { + const sym = this.tsTypeChecker.getSymbolAtLocation(baseExprNode); + if (!sym) { + return false; + } + + const baseName = sym.getName(); + if (!ASYNC_LIFECYCLE_SDK_LIST.has(baseName)) { + return false; + } + + if (methodName === ON_DISCONNECT && baseName !== SERVICE_EXTENSION_ABILITY) { + return false; + } + if (methodName === ON_DESTROY && baseName === SERVICE_EXTENSION_ABILITY) { + return false; + } + + const decl = sym.getDeclarations()?.[0]; + if (!decl || !ts.isImportSpecifier(decl)) { + return false; + } + + const importDecl = decl.parent.parent.parent; + const moduleName = (importDecl.moduleSpecifier as ts.StringLiteral).text; + const srcFile = decl.getSourceFile().fileName; + + return moduleName === ABILITY_KIT || srcFile.endsWith(`${baseName}.${EXTNAME_D_TS}`); + } + + /** + * Rule sdk-void-lifecycle-return: + * Flags onDestroy/onDisconnect methods in Ability subclasses + * whose return type includes Promise. + */ + private checkVoidLifecycleReturn(method: ts.MethodDeclaration): void { + if (!this.options.arkts2) { + return; + } + + if (!this.isLifecycleMethodOnAbilitySubclass(method)) { + return; + } + + if (!this.hasPromiseVoidReturn(method)) { + return; + } + + this.incrementCounters(method.name, FaultID.SdkAbilityAsynchronousLifecycle); + } + private handleGetOwnPropertyNames(decl: ts.PropertyAccessExpression): void { if (this.checkPropertyAccessExpression(decl, GET_OWN_PROPERTY_NAMES_TEXT, TypeScriptLinter.missingAttributeSet)) { const autofix = this.autofixer?.fixMissingAttribute(decl); @@ -9325,6 +9762,102 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.incrementCounters(awaitExpr, FaultID.NoAwaitJsPromise, autofix); } + private handleNotsLikeSmartTypeOnCallExpression(tsCallExpr: ts.CallExpression, callSignature: ts.Signature): void { + if (!this.options.arkts2) { + return; + } + const isContinue = + ts.isCallExpression(tsCallExpr) && + ts.isIdentifier(tsCallExpr.expression) && + !ts.isReturnStatement(tsCallExpr.parent); + if (!isContinue || !tsCallExpr.arguments) { + return; + } + const declaration = callSignature.getDeclaration(); + if (!declaration || !ts.isFunctionDeclaration(declaration)) { + return; + } + const parameterTypes = declaration.parameters?.map((param) => { + const paramType = this.tsTypeChecker.getTypeAtLocation(param); + return this.tsTypeChecker.typeToString(paramType); + }); + tsCallExpr.arguments.forEach((arg, index) => { + if (index >= parameterTypes.length) { + return; + } + const expectedType = parameterTypes[index]; + const actualSym = this.tsTypeChecker.getSymbolAtLocation(arg); + const decl = TsUtils.getDeclaration(actualSym); + if (decl && ts.isParameter(decl) && decl.type) { + const actualType = this.tsTypeChecker.getTypeFromTypeNode(decl.type); + const actualTypeName = this.tsTypeChecker.typeToString(actualType); + if (actualTypeName !== expectedType) { + this.incrementCounters(arg, FaultID.NoTsLikeSmartType); + } + } + }); + } + + private handleNotsLikeSmartTypeOnAsExpression(tsAsExpr: ts.AsExpression): void { + if (!this.options.arkts2) { + return; + } + const asType = this.tsTypeChecker.getTypeAtLocation(tsAsExpr.type); + const originType = this.tsTypeChecker.getTypeAtLocation(tsAsExpr.expression); + const originTypeStr = this.tsTypeChecker.typeToString(originType); + if (originTypeStr === 'never' && this.tsTypeChecker.typeToString(asType) !== originTypeStr) { + this.incrementCounters(tsAsExpr, FaultID.NoTsLikeSmartType); + } + } + + private handleAssignmentNotsLikeSmartType(tsBinaryExpr: ts.BinaryExpression): void { + if (!this.options.arkts2) { + return; + } + + if (this.isPriorityInThreadInfo(tsBinaryExpr)) { + this.incrementCounters(tsBinaryExpr, FaultID.NoTsLikeSmartType); + } + } + + private isPriorityInThreadInfo(node: ts.BinaryExpression): boolean { + if (!ts.isBinaryExpression(node)) { + return false; + } + + // Handle both regular assignment and 'as' type assertion + let right: ts.Expression = ts.isAsExpression(node.right) ? node.right.expression : node.right; + if (!ts.isPropertyAccessExpression(right)) { + return false; + } + + const propertyName = right.name; + if (!ts.isIdentifier(propertyName)) { + return false; + } + + const object = right.expression; + if (!ts.isIdentifier(object)) { + return false; + } + + const symbol = this.tsTypeChecker.getSymbolAtLocation(object); + if (!symbol) { + return false; + } + + const type = this.tsTypeChecker.getTypeOfSymbolAtLocation(symbol, object); + const typeString = this.tsTypeChecker.typeToString(type); + + for (const [typeName, properties] of Object.entries(ERROR_TASKPOOL_PROP_LIST)) { + if (typeString === typeName && properties.has(propertyName.text)) { + return true; + } + } + + return false; + } + private handleNotsLikeSmartType(classDecl: ts.ClassDeclaration): void { if (!this.options.arkts2) { return; @@ -9501,7 +10034,11 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const autofix = this.autofixer?.fixCustomLayout(node); - this.incrementCounters(node.name, FaultID.CustomLayoutNeedAddDecorator, autofix); + const name = node.name.getText(); + const errorMsg = + `The Custom component "${name}" with custom layout capability needs to add the "@CustomLayout" decorator ` + + '(arkui-custom-layout-need-add-decorator)'; + this.incrementCounters(node.name, FaultID.CustomLayoutNeedAddDecorator, autofix, errorMsg); } private handleArkTSPropertyAccess(expr: ts.BinaryExpression): void { @@ -9586,6 +10123,11 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } + const arrayDecl = TypeScriptLinter.findArrayDeclaration(arraySym); + if (arrayDecl && TypeScriptLinter.isArrayCreatedWithOtherArrayLength(arrayDecl)) { + return; + } + const indexExpr = accessExpr.argumentExpression; const loopVarName = ts.isIdentifier(indexExpr) ? indexExpr.text : undefined; @@ -9951,4 +10493,31 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return false; } + + static isArrayCreatedWithOtherArrayLength(decl: ts.VariableDeclaration): boolean { + if (!decl.initializer || !ts.isNewExpression(decl.initializer)) { + return false; + } + + const newExpr = decl.initializer; + return ( + newExpr.arguments?.some((arg) => { + return ts.isPropertyAccessExpression(arg) && arg.name.text === 'length'; + }) ?? false + ); + } + + static findArrayDeclaration(sym: ts.Symbol): ts.VariableDeclaration | undefined { + const decls = sym.getDeclarations(); + if (!decls) { + return undefined; + } + + for (const decl of decls) { + if (ts.isVariableDeclaration(decl)) { + return decl; + } + } + return undefined; + } } diff --git a/ets2panda/linter/src/lib/autofixes/AutofixTitles.ts b/ets2panda/linter/src/lib/autofixes/AutofixTitles.ts index 9a990259ea..743f8e7382 100644 --- a/ets2panda/linter/src/lib/autofixes/AutofixTitles.ts +++ b/ets2panda/linter/src/lib/autofixes/AutofixTitles.ts @@ -64,5 +64,6 @@ export const cookBookRefToFixTitle: Map = new Map([ [339, 'Using \'ESValue\' interface call'], [341, 'Create JS objects using instantite'], [358, 'Replace missing attribute'], - [359, '"@LocalBuilder" transform to "@Builder"'] + [359, '"@LocalBuilder" transform to "@Builder"'], + [381, 'StateStyles needs arrow function block'] ]); diff --git a/ets2panda/linter/src/lib/autofixes/Autofixer.ts b/ets2panda/linter/src/lib/autofixes/Autofixer.ts index dc78eabc87..a29f4742e4 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -46,10 +46,8 @@ import { ES_VALUE } from '../utils/consts/ESObject'; import type { IncrementDecrementNodeInfo } from '../utils/consts/InteropAPI'; import { LOAD, - GET_PROPERTY_BY_NAME, - SET_PROPERTY_BY_NAME, - GET_PROPERTY_BY_INDEX, - SET_PROPERTY_BY_INDEX, + GET_PROPERTY, + SET_PROPERTY, ARE_EQUAL, ARE_STRICTLY_EQUAL, WRAP, @@ -3294,7 +3292,7 @@ export class Autofixer { ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier(expression), - ts.factory.createIdentifier(GET_PROPERTY_BY_NAME) + ts.factory.createIdentifier(GET_PROPERTY) ), undefined, [ts.factory.createStringLiteral(name)] @@ -3329,7 +3327,7 @@ export class Autofixer { const node = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier(expression), - ts.factory.createIdentifier(SET_PROPERTY_BY_NAME) + ts.factory.createIdentifier(SET_PROPERTY) ), undefined, [ts.factory.createIdentifier(field), value] @@ -3647,7 +3645,9 @@ export class Autofixer { annotationEndLine = sourceFile.getLineAndCharacterOfPosition(annotationEndPos).line; } - let text = this.printer.printNode(ts.EmitHint.Unspecified, importDeclaration, sourceFile); + let text = Autofixer.formatImportStatement( + this.printer.printNode(ts.EmitHint.Unspecified, importDeclaration, sourceFile) + ); if (annotationEndPos !== 0) { text = this.getNewLine() + this.getNewLine() + text; } @@ -3659,6 +3659,25 @@ export class Autofixer { return [{ start: annotationEndPos, end: annotationEndPos, replacementText: text }]; } + private static formatImportStatement(stmt: string): string { + return stmt.replace(/\{([^}]+)\}/, (match, importList) => { + const items = importList.split(',').map((item) => { + return item.trim(); + }); + + if (items.length > 1) { + const formattedList = items + .map((item) => { + return ` ${item.trim()},`; + }) + .join('\n'); + return `{\n${formattedList}\n}`; + } + return `{${importList}}`; + }); + } + + fixStylesDecoratorGlobal( funcDecl: ts.FunctionDeclaration, calls: ts.Identifier[], @@ -3696,6 +3715,10 @@ export class Autofixer { const parameters: ts.MemberName[] = []; const values: ts.Expression[][] = []; const statements = block?.statements; + const type = ts.factory.createTypeReferenceNode( + ts.factory.createIdentifier(CustomDecoratorName.CustomStyles), + undefined + ); Autofixer.getParamsAndValues(statements, parameters, values); const newBlock = Autofixer.createBlock(parameters, values, ts.factory.createIdentifier(INSTANCE_IDENTIFIER)); const parameDecl = ts.factory.createParameterDeclaration( @@ -3714,7 +3737,10 @@ export class Autofixer { ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), newBlock ); - const expr = ts.factory.createPropertyDeclaration(undefined, methodDecl.name, undefined, undefined, arrowFunc); + const newModifiers = ts.getModifiers(methodDecl)?.filter((modifier) => { + return !(ts.isDecorator(modifier) && TsUtils.getDecoratorName(modifier) === CustomDecoratorName.Styles); + }); + const expr = ts.factory.createPropertyDeclaration(newModifiers, methodDecl.name, undefined, type, arrowFunc); needImport.add(COMMON_METHOD_IDENTIFIER); let text = this.printer.printNode(ts.EmitHint.Unspecified, expr, methodDecl.getSourceFile()); const startPos = this.sourceFile.getLineAndCharacterOfPosition(methodDecl.getStart()).character; @@ -3868,7 +3894,7 @@ export class Autofixer { void this; const base = lhs.expression.getText(); const prop = lhs.name.text; - const replacementText = `${base}.setPropertyByName('${prop}',ESValue.wrap(${rhs.getText()}))`; + const replacementText = `${base}.setProperty('${prop}',ESValue.wrap(${rhs.getText()}))`; return [{ start: binaryExpr.getStart(), end: binaryExpr.getEnd(), replacementText }]; } @@ -3906,7 +3932,7 @@ export class Autofixer { let start = node.getStart(); let end = node.getEnd(); - let replacementText = `${objName}.${GET_PROPERTY_BY_NAME}('${propName}')`; + let replacementText = `${objName}.${GET_PROPERTY}('${propName}')`; // Check if there is an "as number" type assertion in the statement if (ts.isAsExpression(node.parent) && node.parent.type.kind === ts.SyntaxKind.NumberKeyword) { @@ -3926,7 +3952,7 @@ export class Autofixer { const end = node.getEnd(); const typeTag = this.utils.findTypeOfNodeForConversion(node); - const replacement = `${objName}.${GET_PROPERTY_BY_NAME}('${propName}')${typeTag}`; + const replacement = `${objName}.${GET_PROPERTY}('${propName}')${typeTag}`; return [{ replacementText: replacement, start, end }]; } @@ -3934,8 +3960,8 @@ export class Autofixer { /** * Converts a JS element access (e.g. `arr[index]`) into the corresponding * interop call: - * - On assignment (`arr[index] = value`), emits `arr.setPropertyByIndex(index, ESValue.wrap(value))` - * - On read, emits `arr.getPropertyByIndex(index)` plus any type conversion suffix + * - On assignment (`arr[index] = value`), emits `arr.setProperty(index, ESValue.wrap(value))` + * - On read, emits `arr.getProperty(index)` plus any type conversion suffix * * @param elementAccessExpr The original `ElementAccessExpression` node. * @returns An array with a single `Autofix` describing the replacement range and text. @@ -3951,7 +3977,7 @@ export class Autofixer { let replacementText: string; if (isAssignment) { - // arr.setPropertyByIndex(index, ESValue.wrap(value)) + // arr.setProperty(index, ESValue.wrap(value)) const wrapped = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier(ES_VALUE), @@ -3962,16 +3988,16 @@ export class Autofixer { ); const callExpr = ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(identifierNode, ts.factory.createIdentifier(SET_PROPERTY_BY_INDEX)), + ts.factory.createPropertyAccessExpression(identifierNode, ts.factory.createIdentifier(SET_PROPERTY)), undefined, [elementAccessExpr.argumentExpression, wrapped] ); replacementText = this.printer.printNode(ts.EmitHint.Unspecified, callExpr, elementAccessExpr.getSourceFile()); } else { - // arr.getPropertyByIndex(index) plus conversion + // arr.getProperty(index) plus conversion const callExpr = ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(identifierNode, ts.factory.createIdentifier(GET_PROPERTY_BY_INDEX)), + ts.factory.createPropertyAccessExpression(identifierNode, ts.factory.createIdentifier(GET_PROPERTY)), undefined, [elementAccessExpr.argumentExpression] ); @@ -3989,17 +4015,17 @@ export class Autofixer { /** * Replace each loop‐variable reference (e.g. `element`) with - * `array.getPropertyByIndex(i)` plus appropriate conversion. + * `array.getProperty(i)` plus appropriate conversion. * * @param identifier The Identifier node of the loop variable usage. * @param arrayName The name of the array being iterated. */ fixInteropArrayElementUsage(identifier: ts.Identifier, arrayName: string): Autofix { - // arr.getPropertyByIndex(i) + // arr.getProperty(i) const callExpr = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier(arrayName), - ts.factory.createIdentifier(GET_PROPERTY_BY_INDEX) + ts.factory.createIdentifier(GET_PROPERTY) ), undefined, [ts.factory.createIdentifier('i')] @@ -4040,7 +4066,7 @@ export class Autofixer { /** * Converts a `for...of` over an interop array into - * an index-based `for` loop using `getPropertyByName("length")`. + * an index-based `for` loop using `getProperty("length")`. * * @param node The `ForOfStatement` node to fix. * @returns A single Autofix for the loop header replacement. @@ -4063,7 +4089,7 @@ export class Autofixer { const lengthAccess = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier(iterableName), - ts.factory.createIdentifier(GET_PROPERTY_BY_NAME) + ts.factory.createIdentifier(GET_PROPERTY) ), undefined, [ts.factory.createStringLiteral(LENGTH)] @@ -4216,7 +4242,7 @@ export class Autofixer { return undefined; } const propName = node.name.text; - return `${base}.${GET_PROPERTY_BY_NAME}('${propName}')`; + return `${base}.${GET_PROPERTY}('${propName}')`; } else if (ts.isNewExpression(node)) { const newArgs = this.createArgs(node.arguments); const newCallExpr = this.createJSInvokeCallExpression(node.expression, INSTANTIATE, [...newArgs || []]); @@ -4286,7 +4312,7 @@ export class Autofixer { const propertyName = originalName || symbolName; const constructDeclInfo: string[] = isLoad ? [this.modVarName, ES_VALUE, LOAD] : - [symbolName, this.modVarName, GET_PROPERTY_BY_NAME]; + [symbolName, this.modVarName, GET_PROPERTY]; const newVarDecl = Autofixer.createVariableForInteropImport( constructDeclInfo[0], constructDeclInfo[1], @@ -4311,7 +4337,7 @@ export class Autofixer { fixInteropPropertyAccessExpression(express: ts.PropertyAccessExpression): Autofix[] | undefined { let text: string = ''; const statements = ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(express.expression, ts.factory.createIdentifier(GET_PROPERTY_BY_NAME)), + ts.factory.createPropertyAccessExpression(express.expression, ts.factory.createIdentifier(GET_PROPERTY)), undefined, [ts.factory.createStringLiteral(express.name.getText())] ); @@ -4333,7 +4359,7 @@ export class Autofixer { const statements = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier(objectName), - ts.factory.createIdentifier(SET_PROPERTY_BY_NAME) + ts.factory.createIdentifier(SET_PROPERTY) ), undefined, [ @@ -4370,7 +4396,7 @@ export class Autofixer { } const propertyAccess = ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(express.expression, ts.factory.createIdentifier(GET_PROPERTY_BY_NAME)), + ts.factory.createPropertyAccessExpression(express.expression, ts.factory.createIdentifier(GET_PROPERTY)), undefined, [ts.factory.createStringLiteral(express.name.getText())] ); @@ -4429,7 +4455,7 @@ export class Autofixer { private fixPropertyAccessToNumber(expr: ts.PropertyAccessExpression): Autofix[] { const getPropCall = ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(expr.expression, ts.factory.createIdentifier(GET_PROPERTY_BY_NAME)), + ts.factory.createPropertyAccessExpression(expr.expression, ts.factory.createIdentifier(GET_PROPERTY)), undefined, [ts.factory.createStringLiteral(expr.name.getText())] ); @@ -4453,7 +4479,7 @@ export class Autofixer { fixInteropArrayElementAccessExpression(express: ts.ElementAccessExpression): Autofix[] | undefined { const statements = ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(express.expression, ts.factory.createIdentifier(GET_PROPERTY_BY_INDEX)), + ts.factory.createPropertyAccessExpression(express.expression, ts.factory.createIdentifier(GET_PROPERTY)), undefined, [express.argumentExpression] ); @@ -4467,7 +4493,7 @@ export class Autofixer { const statements = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier(left.expression.getText()), - ts.factory.createIdentifier(SET_PROPERTY_BY_INDEX) + ts.factory.createIdentifier(SET_PROPERTY) ), undefined, [ @@ -4503,7 +4529,7 @@ export class Autofixer { const getPropertyCall = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( ts.factory.createIdentifier(propertyAccess.expression.getText()), - ts.factory.createIdentifier(GET_PROPERTY_BY_NAME) + ts.factory.createIdentifier(GET_PROPERTY) ), undefined, [ts.factory.createStringLiteral(propertyAccess.name.getText())] @@ -4627,17 +4653,22 @@ export class Autofixer { return [{ start: argExpr.getStart(), end: argExpr.getEnd(), replacementText: `${argExpr.getText()} as int` }]; } - fixNoTsLikeFunctionCall(identifier: ts.Node): Autofix[] { + fixNoTsLikeFunctionCall(callExpr: ts.CallExpression): Autofix[] { void this; - const funcName = identifier.getText(); - const replacementText = `${funcName}.unsafeCall`; - return [ - { - replacementText, - start: identifier.getStart(), - end: identifier.getEnd() - } - ]; + const expr = callExpr.expression; + const hasOptionalChain = !!callExpr.questionDotToken; + + const replacementText = hasOptionalChain + ? `${expr.getText()}${callExpr.questionDotToken.getText()}unsafeCall` + : `${expr.getText()}.unsafeCall`; + + return [{ + start: expr.getStart(), + end: hasOptionalChain + ? callExpr.questionDotToken.getEnd() + : expr.getEnd(), + replacementText + }]; } private static createBuiltInTypeInitializer(type: ts.TypeReferenceNode): ts.Expression | undefined { @@ -4871,6 +4902,12 @@ export class Autofixer { if (!typeNode) { return this.fixGenericCallNoTypeArgsWithContextualType(node); } + if (ts.isUnionTypeNode(typeNode)) { + return this.fixGenericCallNoTypeArgsForUnionType(node, typeNode); + } + if (ts.isArrayTypeNode(typeNode)) { + return this.fixGenericCallNoTypeArgsForArrayType(node, typeNode); + } if (!ts.isTypeReferenceNode(typeNode) || typeNode.typeName.getText() !== node.expression.getText()) { return undefined; } @@ -4887,6 +4924,36 @@ export class Autofixer { return [{ start: insertPos, end: insertPos, replacementText: typeArgsText }]; } + private fixGenericCallNoTypeArgsForArrayType(node: ts.NewExpression, arrayTypeNode: ts.ArrayTypeNode): Autofix[] | undefined { + const elementTypeNode = arrayTypeNode.elementType; + const srcFile = node.getSourceFile(); + const typeArgsText = `<${this.printer.printNode(ts.EmitHint.Unspecified, elementTypeNode, srcFile)}>`; + const insertPos = node.expression.getEnd(); + return [{ start: insertPos, end: insertPos, replacementText: typeArgsText }]; + } + + private fixGenericCallNoTypeArgsForUnionType(node: ts.NewExpression, unionType: ts.UnionTypeNode): Autofix[] | undefined { + const matchingTypes = unionType.types.filter((type) => { + return ts.isTypeReferenceNode(type) && type.typeName.getText() === node.expression.getText(); + }) as ts.TypeReferenceNode[]; + + if (matchingTypes.length === 1) { + const matchingType = matchingTypes[0]; + if (matchingType.typeArguments) { + const srcFile = node.getSourceFile(); + const typeArgsText = `<${matchingType.typeArguments. + map((arg) => { + return this.printer.printNode(ts.EmitHint.Unspecified, arg, srcFile); + }). + join(', ')}>`; + + const insertPos = node.expression.getEnd(); + return [{ start: insertPos, end: insertPos, replacementText: typeArgsText }]; + } + } + return undefined; + } + private generateGenericTypeArgumentsAutofix( node: ts.NewExpression, typeArgs: ts.TypeReferenceNode[] diff --git a/ets2panda/linter/src/lib/statistics/scan/CountFile.ts b/ets2panda/linter/src/lib/statistics/scan/CountFile.ts new file mode 100644 index 0000000000..04f0166f35 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/CountFile.ts @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 fs from 'fs'; +import path from 'path'; +import { promisify } from 'util'; + +// Define file type extensions +const FILE_TYPES: { [key: string]: string[] } = { + 'C/C++': ['.c', '.h', '.cpp', '.hpp'], + JavaScript: ['.js'], + TypeScript: ['.ts'], + JSON: ['.json', '.json5'], + XML: ['.xml'], + ArkTS: ['.ets'], + 'ArkTS Test': ['.test.ets'] +}; + +// Comment regex patterns by file type +const COMMENT_REGEX1: { [key: string]: RegExp } = { + 'C/C++': /\/\/.*/g, + JavaScript: /\/\/.*/g, + TypeScript: /\/\/.*/g, + ArkTS: /\/\/.*/g, + 'ArkTS Test': /\/\/.*/g, + XML: //g +}; + +const COMMENT_REGEX2: { [key: string]: RegExp } = { + 'C/C++': /\/\*.*?\*\//gs, + JavaScript: /\/\*.*?\*\//gs, + TypeScript: /\/\*.*?\*\//gs, + ArkTS: /\/\*.*?\*\//gs, + 'ArkTS Test': /\/\*.*?\*\//gs +}; + +/** + * Remove comments from file content + */ +function removeComments(content: string, fileType: string): string { + if (COMMENT_REGEX1[fileType]) { + content = content.replace(COMMENT_REGEX1[fileType], ''); + } + if (COMMENT_REGEX2[fileType]) { + content = content.replace(COMMENT_REGEX2[fileType], ''); + } + return content; +} + +/** + * Count valid lines of code (excluding comments and empty lines) + */ +async function countLines(filePath: string, fileType: string): Promise { + try { + const content = await promisify(fs.readFile)(filePath, 'utf-8'); + const cleanedContent = removeComments(content, fileType); + const lines = cleanedContent.split('\n'); + + // Filter out empty lines + const validLines = lines.filter((line) => { + return line.trim(); + }); + return validLines.length; + } catch (error) { + console.error(`Error reading ${filePath}: ${error}`); + return 0; + } +} + +/** + * Merge multiple result objects + */ +function mergeAllResults(results: { [key: string]: { fileCount: number; lineCount: number } }[]): { + [key: string]: { fileCount: number; lineCount: number }; +} { + const combined: { [key: string]: { fileCount: number; lineCount: number } } = {}; + + for (const result of results) { + for (const [type, counts] of Object.entries(result)) { + if (!combined[type]) { + combined[type] = { fileCount: 0, lineCount: 0 }; + } + combined[type].fileCount += counts.fileCount; + combined[type].lineCount += counts.lineCount; + } + } + + return combined; +} + +/** + * Process directory entries recursively + */ +async function walkDir(dir: string): Promise<{ [key: string]: { fileCount: number; lineCount: number } }> { + try { + const entries = await promisify(fs.readdir)(dir, { withFileTypes: true }); + const fileResults = await processFiles(dir, entries); + const dirResults = await processDirs(dir, entries); + return mergeAllResults([fileResults, dirResults]); + } catch (error) { + console.error(`Error reading ${dir}: ${error}`); + return {}; + } +} + +/** + * Process files in a directory + */ +async function processFiles( + dir: string, + entries: fs.Dirent[] +): Promise<{ [key: string]: { fileCount: number; lineCount: number } }> { + const fileResults = await Promise.all( + entries. + filter((entry) => { + return entry.isFile(); + }). + map(async(entry) => { + return processFileEntry(dir, entry); + }) + ); + return mergeAllResults(fileResults); +} + +/** + * Process a single file entry + */ +async function processFileEntry( + dir: string, + entry: fs.Dirent +): Promise<{ [key: string]: { fileCount: number; lineCount: number } }> { + const fullPath = path.join(dir, entry.name); + + for (const fileType in FILE_TYPES) { + const extensions = FILE_TYPES[fileType]; + const ext = path.extname(entry.name); + + if (extensions.includes(ext)) { + const lines = await countLines(fullPath, fileType); + return { + [fileType]: { + fileCount: 1, + lineCount: lines + } + }; + } + } + + return {}; +} + +/** + * Process subdirectories recursively + */ +async function processDirs( + dir: string, + entries: fs.Dirent[] +): Promise<{ [key: string]: { fileCount: number; lineCount: number } }> { + const dirEntries = entries.filter((entry) => { + return entry.isDirectory(); + }); + const dirResults = await Promise.all( + dirEntries.map((entry) => { + return walkDir(path.join(dir, entry.name)); + }) + ); + return mergeAllResults(dirResults); +} + +/** + * Analyze directory and count files/lines by type + */ +async function analyzeDirectory( + directory: string +): Promise<{ [key: string]: { fileCount: number; lineCount: number } }> { + // Initialize results + const results: { [key: string]: { fileCount: number; lineCount: number } } = {}; + for (const fileType in FILE_TYPES) { + results[fileType] = { fileCount: 0, lineCount: 0 }; + } + + const finalResults = await walkDir(directory); + Object.assign(results, finalResults); + return results; +} + +/** + * Main export function + */ +export async function countFiles( + directory: string +): Promise<{ [key: string]: { fileCount: number; lineCount: number } }> { + try { + const stats = await promisify(fs.stat)(directory); + if (stats.isDirectory()) { + return await analyzeDirectory(directory); + } + console.error('The directory is invalid!'); + return {}; + } catch (error) { + console.error('Read directory failed', error); + return {}; + } +} diff --git a/ets2panda/linter/src/lib/statistics/scan/CountNapiFile.ts b/ets2panda/linter/src/lib/statistics/scan/CountNapiFile.ts new file mode 100644 index 0000000000..93e31a0aa5 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/CountNapiFile.ts @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 * as fs from 'fs'; +import * as path from 'path'; +import type { NapiFileStatisticInfo } from './NapiFileStatisticInfo'; + +const EXTENSIONS = ['.c', '.cpp', '.cc', '.cxx', '.h', '.hpp', '.hh', '.hxx']; + +const SINGLE_LINE_COMMENT_REGEX = /\/\/.*/g; +const MULTI_LINE_COMMENT_REGEX = /\/\*[\s\S]*?\*\//g; + +const DEFAULT_STATISTICS: NapiFileStatisticInfo = { + totalFiles: 0, + totalLines: 0, + napiFiles: 0, + napiLines: 0, + napiFileLines: 0 +}; + +function removeComments(content: string): string { + return content.replace(MULTI_LINE_COMMENT_REGEX, '').replace(SINGLE_LINE_COMMENT_REGEX, ''); +} + +async function countLines(filePath: string): Promise { + try { + const content = await fs.promises.readFile(filePath, 'utf-8'); + const contentWithoutComments = removeComments(content); + const validLines = contentWithoutComments.split('\n').filter((line) => { + return line.trim(); + }); + return validLines.length; + } catch (e) { + console.error(`Error reading ${filePath}: ${e}`); + return 0; + } +} + +async function countNapiLines(filePath: string): Promise { + try { + const content = await fs.promises.readFile(filePath, 'utf-8'); + const lines = content.split('\n'); + const napiLines = new Set(); + + for (const line of lines) { + if (line.toLowerCase().includes('napi')) { + napiLines.add(line); + } + } + + return napiLines.size; + } catch (e) { + console.error(`Error reading ${filePath}: ${e}`); + return 0; + } +} + +async function analyzeDirectoryAsync(directory: string): Promise { + const dirQueue: string[] = [directory]; + const allResults: NapiFileStatisticInfo[] = []; + + while (dirQueue.length > 0) { + const currentDir = dirQueue.shift()!; + const entries = await fs.promises.readdir(currentDir, { withFileTypes: true }); + const fileResults = await Promise.all( + entries. + map((entry) => { + const fullPath = path.join(currentDir, entry.name); + if (entry.isDirectory()) { + dirQueue.push(fullPath); + return null; + } else if (isTargetFile(entry.name)) { + return processFile(fullPath); + } + return null; + }). + filter(Boolean) as Promise[] + ); + allResults.push(...fileResults); + } + + return allResults.reduce( + (acc, cur) => { + acc.totalFiles += cur.totalFiles; + acc.totalLines += cur.totalLines; + if (cur.napiFiles > 0) { + acc.napiFiles += cur.napiFiles; + acc.napiLines += cur.napiLines; + acc.napiFileLines += cur.napiFileLines; + } + return acc; + }, + { ...DEFAULT_STATISTICS } + ); +} + +async function processFile(filePath: string): Promise { + const result: NapiFileStatisticInfo = { + totalFiles: 1, + totalLines: 0, + napiFiles: 0, + napiLines: 0, + napiFileLines: 0 + }; + + try { + const [lines, napiCount] = await Promise.all([countLines(filePath), countNapiLines(filePath)]); + + result.totalLines = lines; + if (napiCount > 0) { + result.napiFiles = 1; + result.napiLines = napiCount; + result.napiFileLines = lines; + } + } catch (e) { + console.error(`Error processing ${filePath}: ${e}`); + } + return result; +} + +function isTargetFile(filename: string): boolean { + return EXTENSIONS.some((ext) => { + return filename.endsWith(ext); + }); +} + +export async function countNapiFiles(directory: string): Promise { + try { + const stat = await fs.promises.stat(directory); + if (!stat.isDirectory()) { + console.log('The provided path is not a directory!'); + return DEFAULT_STATISTICS; + } + return await analyzeDirectoryAsync(directory); + } catch (e) { + console.error(`Error accessing directory ${directory}: ${e}`); + return DEFAULT_STATISTICS; + } +} diff --git a/ets2panda/linter/src/lib/statistics/scan/FloderScanResultInfo.ts b/ets2panda/linter/src/lib/statistics/scan/FloderScanResultInfo.ts new file mode 100644 index 0000000000..447813a2d2 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/FloderScanResultInfo.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. + */ + +export interface FloderScanResultInfo { + normalizedPath: string; + arkTSCodeLines: number; + cAndCPPCodeLines: number; + napiCodeLines: number; + jsCodeLines: number; + tsCodeLines: number; + jsonCodeLines: number; + xmlCodeLines: number; +} diff --git a/ets2panda/linter/src/lib/statistics/scan/NapiFileStatisticInfo.ts b/ets2panda/linter/src/lib/statistics/scan/NapiFileStatisticInfo.ts new file mode 100644 index 0000000000..20b3243802 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/NapiFileStatisticInfo.ts @@ -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. + */ + +export interface NapiFileStatisticInfo { + totalFiles: number; + totalLines: number; + napiFiles: number; + napiLines: number; + napiFileLines: number; +} diff --git a/ets2panda/linter/src/lib/statistics/scan/ProblemNumbersInfo.ts b/ets2panda/linter/src/lib/statistics/scan/ProblemNumbersInfo.ts new file mode 100644 index 0000000000..d969313546 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/ProblemNumbersInfo.ts @@ -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. + */ + +export interface ProblemNumbersInfo { + totalProblemNumbers: number; + arkOnePointOneProblemNumbers: number; + arkOnePointTWOProblemNumbers: number; + canBeAutoFixedproblemNumbers: number; + needToManualFixproblemNumbers: number; +} diff --git a/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsCommonFunction.ts b/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsCommonFunction.ts new file mode 100644 index 0000000000..cdf625ab5f --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsCommonFunction.ts @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 * as fs from 'node:fs'; +import * as path from 'node:path'; +import type { LintRunResult } from '../../LintRunResult'; +import type { ProblemInfo } from '../../ProblemInfo'; +import * as mk from '../../utils/consts/MapKeyConst'; +import { countFiles } from './CountFile'; +import { countNapiFiles } from './CountNapiFile'; +import type { ProblemNumbersInfo } from './ProblemNumbersInfo'; +import type { ProblemStatisticsInfo } from './ProblemStatisticsInfo'; +import type { RuleDetailedErrorInfo } from './RuleDetailedErrorInfo'; +import type { StatisticsReportInPutInfo } from './StatisticsReportInPutInfo'; +import type { TimeRecorder } from './TimeRecorder'; +import { WorkLoadInfo } from './WorkLoadInfo'; + +export function getProblemStatisticsInfo( + problemNumbers: ProblemNumbersInfo, + ruleToNumbersMap: Map, + ruleToAutoFixedNumbersMap: Map, + timeRecorder: TimeRecorder, + WorkLoadInfo?: WorkLoadInfo +): ProblemStatisticsInfo { + const problemNumberMap: Map = new Map(); + problemNumberMap.set(mk.TOTAL_PROBLEMS, problemNumbers.totalProblemNumbers); + problemNumberMap.set(mk.ONE_POINT_ONE_PROBLEMS, problemNumbers.arkOnePointOneProblemNumbers); + problemNumberMap.set(mk.ONE_POINT_TWO_PROBLEMS, problemNumbers.arkOnePointTWOProblemNumbers); + problemNumberMap.set(mk.CAN_BE_AUTO_FIXED_PROBLEMS_NUMBERS, problemNumbers.canBeAutoFixedproblemNumbers); + problemNumberMap.set(mk.NEED_TO_NAMUAL_FIX_PROBLEM_NUMBERS, problemNumbers.needToManualFixproblemNumbers); + + const scanTime = timeRecorder.getScanTime(); + const migrationTime = timeRecorder.getMigrationTime(); + const usedTimeMap: Map = new Map(); + usedTimeMap.set(mk.SCAN_TIME, scanTime); + usedTimeMap.set(mk.MIGRATION_TIME, migrationTime); + + const detailRuleProblemsMap: Map = new Map(); + ruleToNumbersMap.forEach((value, key) => { + const ruleDetailedErrorInfo: RuleDetailedErrorInfo = { + rule: key, + problemNumbers: value, + canBeAutoFixedMumbers: ruleToAutoFixedNumbersMap.get(key) ?? 0 + }; + detailRuleProblemsMap.set(key, ruleDetailedErrorInfo); + }); + + const problemStatisticsInfo: ProblemStatisticsInfo = { + problems: Object.fromEntries(problemNumberMap), + usedTime: Object.fromEntries(usedTimeMap), + WorkLoadInfo: WorkLoadInfo, + eachRuleProblemsDetail: Array.from(detailRuleProblemsMap.values()) + }; + return problemStatisticsInfo; +} + +export function getArktsOnePointOneProlemNumbers(problems: ProblemInfo[]): number { + let problemNumbersForATSOnePointOne: number = 0; + const signForOne: string = 's2d'; + problems.forEach((problem) => { + if (problem.rule !== undefined) { + if (problem.rule.includes(signForOne)) { + problemNumbersForATSOnePointOne = problemNumbersForATSOnePointOne + 1; + } + } + }); + return problemNumbersForATSOnePointOne; +} + +export function accumulateRuleNumbers( + problems: ProblemInfo[], + ruleToNumbersMap: Map, + ruleToAutoFixedNumbersMap: Map +): void { + problems.forEach((problem) => { + if (problem.rule !== undefined) { + if (problem.autofix) { + const currentNumber = ruleToAutoFixedNumbersMap.get(problem.rule) || 0; + ruleToAutoFixedNumbersMap.set(problem.rule, currentNumber + 1); + } + const currentNumber = ruleToNumbersMap.get(problem.rule) || 0; + ruleToNumbersMap.set(problem.rule, currentNumber + 1); + } + }); +} + +export async function generateReportFile(reportName: string, reportData, reportPath?: string): Promise { + let reportFilePath = path.join(reportName); + if (reportPath !== undefined) { + reportFilePath = path.join(path.normalize(reportPath), reportName); + } + try { + await fs.promises.mkdir(path.dirname(reportFilePath), { recursive: true }); + await fs.promises.writeFile(reportFilePath, JSON.stringify(reportData, null, 2)); + } catch (error) { + console.error('Error generating report file:', error); + } +} + +export function generateReportFileSync(reportName: string, reportData: any, reportPath?: string): void { + let reportFilePath = reportName; + if (reportPath !== undefined) { + reportFilePath = path.join(path.normalize(reportPath), reportName); + } + try { + fs.mkdirSync(path.dirname(reportFilePath), { recursive: true }); + fs.writeFileSync(reportFilePath, JSON.stringify(reportData, null, 2)); + } catch (error) { + console.error('Error generating report file:', error); + } +} + +export function getMapValueSum(map: Map): number { + let result = 0; + for (const value of map.values()) { + result += value; + } + return result; +} + +export async function generateScanProbelemStatisticsReport( + statisticsReportInPutInfo: StatisticsReportInPutInfo +): Promise { + const canBeAutoFixedproblemNumbers = getMapValueSum(statisticsReportInPutInfo.ruleToAutoFixedNumbersMap); + const problemNumbers: ProblemNumbersInfo = { + totalProblemNumbers: statisticsReportInPutInfo.totalProblemNumbers, + arkOnePointOneProblemNumbers: statisticsReportInPutInfo.arkOnePointOneProblemNumbers, + arkOnePointTWOProblemNumbers: + statisticsReportInPutInfo.totalProblemNumbers - statisticsReportInPutInfo.arkOnePointOneProblemNumbers, + canBeAutoFixedproblemNumbers: canBeAutoFixedproblemNumbers, + needToManualFixproblemNumbers: statisticsReportInPutInfo.totalProblemNumbers - canBeAutoFixedproblemNumbers + }; + const projectFolderList = statisticsReportInPutInfo.cmdOptions.linterOptions.projectFolderList!; + const WorkLoadInfo = await getWorkLoadInfo(projectFolderList); + const statisticsReportData = getProblemStatisticsInfo( + problemNumbers, + statisticsReportInPutInfo.ruleToNumbersMap, + statisticsReportInPutInfo.ruleToAutoFixedNumbersMap, + statisticsReportInPutInfo.timeRecorder, + WorkLoadInfo + ); + await generateReportFile( + statisticsReportInPutInfo.statisticsReportName, + statisticsReportData, + statisticsReportInPutInfo.cmdOptions.outputFilePath + ); +} + +export function generateMigrationStatisicsReport( + lintResult: LintRunResult, + timeRecorder: TimeRecorder, + outputFilePath?: string +): void { + const ruleToNumbersMap: Map = new Map(); + const ruleToAutoFixedNumbersMap: Map = new Map(); + let arkOnePointOneProblemNumbers: number = 0; + + const problemsInfoAfterAutofixed = lintResult.problemsInfos; + for (const problems of problemsInfoAfterAutofixed.values()) { + accumulateRuleNumbers(problems, ruleToNumbersMap, ruleToAutoFixedNumbersMap); + arkOnePointOneProblemNumbers = arkOnePointOneProblemNumbers + getArktsOnePointOneProlemNumbers(problems); + } + + let totalProblemNumbers: number = 0; + for (const problems of problemsInfoAfterAutofixed.values()) { + totalProblemNumbers += problems.length; + } + + const canBeAutoFixedproblemNumbers = getMapValueSum(ruleToAutoFixedNumbersMap); + + const problemNumbers: ProblemNumbersInfo = { + totalProblemNumbers: totalProblemNumbers, + arkOnePointOneProblemNumbers: arkOnePointOneProblemNumbers, + arkOnePointTWOProblemNumbers: totalProblemNumbers - arkOnePointOneProblemNumbers, + canBeAutoFixedproblemNumbers: canBeAutoFixedproblemNumbers, + needToManualFixproblemNumbers: totalProblemNumbers - canBeAutoFixedproblemNumbers + }; + + const statisticsReportData = getProblemStatisticsInfo( + problemNumbers, + ruleToNumbersMap, + ruleToAutoFixedNumbersMap, + timeRecorder + ); + const statisticsReportName: string = 'migration-results-statistics.json'; + generateReportFileSync(statisticsReportName, statisticsReportData, outputFilePath); +} + +export async function getWorkLoadInfo(projectPathList: string[]): Promise { + const workloadInfo = new WorkLoadInfo(); + const projectResults = await Promise.all( + projectPathList.map(async(projectPath) => { + const normalizedPath = path.normalize(projectPath); + const [countFilesResults, countNapiFileResults] = await Promise.all([ + countFiles(normalizedPath), + countNapiFiles(normalizedPath) + ]); + + const getLines = (lang: keyof typeof countFilesResults): number => { + return countFilesResults[lang]?.lineCount || 0; + }; + + return { + normalizedPath, + arkTSCodeLines: getLines('ArkTS') + getLines('ArkTS Test'), + cAndCPPCodeLines: getLines('C/C++'), + napiCodeLines: countNapiFileResults.napiLines, + jsCodeLines: getLines('JavaScript'), + tsCodeLines: getLines('TypeScript'), + jsonCodeLines: getLines('JSON'), + xmlCodeLines: getLines('XML') + }; + }) + ); + + projectResults.forEach((result) => { + workloadInfo.addFloderResult(result); + }); + return workloadInfo; +} diff --git a/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsInfo.ts b/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsInfo.ts new file mode 100644 index 0000000000..8bbef29b16 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsInfo.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. + */ + +import type { RuleDetailedErrorInfo } from './RuleDetailedErrorInfo'; +import type { WorkLoadInfo } from './WorkLoadInfo'; + +export interface ProblemStatisticsInfo { + problems: { [k: string]: number }; + usedTime: { [k: string]: string }; + eachRuleProblemsDetail: RuleDetailedErrorInfo[]; + WorkLoadInfo?: WorkLoadInfo; +} diff --git a/ets2panda/linter/src/lib/statistics/scan/RuleDetailedErrorInfo.ts b/ets2panda/linter/src/lib/statistics/scan/RuleDetailedErrorInfo.ts new file mode 100644 index 0000000000..b4c56ee615 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/RuleDetailedErrorInfo.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 interface RuleDetailedErrorInfo { + rule: string; + problemNumbers: number; + canBeAutoFixedMumbers: number; +} diff --git a/ets2panda/linter/src/lib/statistics/scan/ScanTaskRelatedInfo.ts b/ets2panda/linter/src/lib/statistics/scan/ScanTaskRelatedInfo.ts new file mode 100644 index 0000000000..6cc3f6dafd --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/ScanTaskRelatedInfo.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. + */ + +import type { CommandLineOptions } from '../../CommandLineOptions'; +import type { LinterConfig } from '../../LinterConfig'; +import type { ProblemInfo } from '../../ProblemInfo'; +import type { StatisticsReportInPutInfo } from './StatisticsReportInPutInfo'; +import type { TimeRecorder } from './TimeRecorder'; + +export interface ScanTaskRelatedInfo { + cmdOptions: CommandLineOptions; + timeRecorder: TimeRecorder; + statisticsReportInPutInfo: StatisticsReportInPutInfo; + mergedProblems: Map; + homeCheckResult: Map; + totalProblemNumbers: number; + statisticsReportName: number; + compileOptions: LinterConfig; +} diff --git a/ets2panda/linter/src/lib/statistics/scan/StatisticsReportInPutInfo.ts b/ets2panda/linter/src/lib/statistics/scan/StatisticsReportInPutInfo.ts new file mode 100644 index 0000000000..377f0843ff --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/StatisticsReportInPutInfo.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. + */ + +import type { CommandLineOptions } from '../../CommandLineOptions'; +import type { TimeRecorder } from './TimeRecorder'; + +export class StatisticsReportInPutInfo { + totalProblemNumbers: number = 0; + arkOnePointOneProblemNumbers: number = 0; + ruleToNumbersMap: Map = {} as Map; + ruleToAutoFixedNumbersMap: Map = {} as Map; + cmdOptions: CommandLineOptions = {} as CommandLineOptions; + timeRecorder: TimeRecorder = {} as TimeRecorder; + statisticsReportName: string = ''; +} diff --git a/ets2panda/linter/src/lib/statistics/scan/TimeRecorder.ts b/ets2panda/linter/src/lib/statistics/scan/TimeRecorder.ts new file mode 100644 index 0000000000..5f21944a81 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/TimeRecorder.ts @@ -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. + */ + +export class TimeRecorder { + private lintStart = BigInt(0); + private lintEnd = BigInt(0); + private migrationStart = BigInt(0); + private migrationEnd = BigInt(0); + private isHomeCheckCount: boolean = false; + + setHomeCheckCountStatus(isHomeCheckCount: boolean): void { + this.isHomeCheckCount = isHomeCheckCount; + } + + getHomeCheckCountStatus(): boolean { + return this.isHomeCheckCount; + } + + startScan(): void { + this.lintStart = process.hrtime.bigint(); + } + + endScan(): void { + this.lintEnd = process.hrtime.bigint(); + } + + startMigration(): void { + this.migrationStart = process.hrtime.bigint(); + } + + endMigration(): void { + this.migrationEnd = process.hrtime.bigint(); + } + + getScanTime(): string { + return `${(Number(this.lintEnd - this.lintStart) / 1000000000).toFixed(2)} s`; + } + + getMigrationTime(): string { + return `${(Number(this.migrationEnd - this.migrationStart) / 1000000000).toFixed(2)} s`; + } +} diff --git a/ets2panda/linter/src/lib/statistics/scan/WorkLoadInfo.ts b/ets2panda/linter/src/lib/statistics/scan/WorkLoadInfo.ts new file mode 100644 index 0000000000..59135b1db2 --- /dev/null +++ b/ets2panda/linter/src/lib/statistics/scan/WorkLoadInfo.ts @@ -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. + */ + +import { + AVERAGE_LINE_FOR_REPAIRE_RULE_COEFFICIENT, + NPAI_REPAIRE_WORKLOADA_COEFFICIEN, + TEST_DEBUG_WORKLOAD_COEFFICIENT +} from '../../utils/consts/WorkloadRelatedConst'; +import type { FloderScanResultInfo } from './FloderScanResultInfo'; +import type { ProblemNumbersInfo } from './ProblemNumbersInfo'; + +export class WorkLoadInfo { + scanFilePathList: string[] = []; + totalArkTSCodeLines = 0; + totalCAndCPPCodeLines = 0; + totalNapiCodeLines = 0; + totalJsCodeLines = 0; + totalTsCodeLines = 0; + totalJsonCodeLines = 0; + totalXmlCodeLines = 0; + + addFloderResult(result: FloderScanResultInfo): void { + this.scanFilePathList.push(result.normalizedPath); + this.totalArkTSCodeLines += result.arkTSCodeLines; + this.totalCAndCPPCodeLines += result.cAndCPPCodeLines; + this.totalNapiCodeLines += result.napiCodeLines; + this.totalJsCodeLines += result.jsCodeLines; + this.totalTsCodeLines += result.tsCodeLines; + this.totalJsonCodeLines += result.jsonCodeLines; + this.totalXmlCodeLines += result.xmlCodeLines; + } + + calculateFixRate(problemNumbers: ProblemNumbersInfo): string { + const totalLines = this.totalArkTSCodeLines + this.totalCAndCPPCodeLines; + if (totalLines <= 0) { + return '0.00%'; + } + + const problemCount = problemNumbers.needToManualFixproblemNumbers; + const ratio = + (problemCount * AVERAGE_LINE_FOR_REPAIRE_RULE_COEFFICIENT * TEST_DEBUG_WORKLOAD_COEFFICIENT + + this.totalNapiCodeLines * NPAI_REPAIRE_WORKLOADA_COEFFICIEN) / + totalLines; + + return `${(ratio * 100).toFixed(2)}%`; + } +} diff --git a/ets2panda/linter/src/lib/utils/TsUtils.ts b/ets2panda/linter/src/lib/utils/TsUtils.ts index 7aa8050e88..e164774602 100644 --- a/ets2panda/linter/src/lib/utils/TsUtils.ts +++ b/ets2panda/linter/src/lib/utils/TsUtils.ts @@ -48,6 +48,7 @@ import { ETS_MODULE, PATH_SEPARATOR, VALID_OHM_COMPONENTS_MODULE_PATH } from './ import { EXTNAME_ETS, EXTNAME_JS, EXTNAME_D_ETS } from './consts/ExtensionName'; import { STRING_ERROR_LITERAL } from './consts/Literals'; +export const PROMISE_METHODS = new Set(['all', 'race', 'any', 'resolve', 'allSettled']); export const SYMBOL = 'Symbol'; export const SYMBOL_CONSTRUCTOR = 'SymbolConstructor'; const ITERATOR = 'iterator'; @@ -824,18 +825,22 @@ export class TsUtils { isStrict: boolean = false ): boolean { if ( - TsUtils.reduceReference(lhsType) === TsUtils.reduceReference(rhsType) && - TsUtils.isTypeReference(lhsType) && - TsUtils.isTypeReference(rhsType) + TsUtils.reduceReference(lhsType) !== TsUtils.reduceReference(rhsType) || + !TsUtils.isTypeReference(lhsType) || + !TsUtils.isTypeReference(rhsType) ) { - const lhsArgs = lhsType.typeArguments; - const rhsArgs = rhsType.typeArguments; - if (lhsArgs && lhsArgs.length > 0) { - if (rhsArgs && rhsArgs.length > 0) { - return this.needToDeduceStructuralIdentity(lhsArgs[0], rhsArgs[0], rhsExpr, isStrict); + return false; + } + const lhsArgs = lhsType.typeArguments; + const rhsArgs = rhsType.typeArguments; + if (lhsArgs && lhsArgs.length > 0) { + if (rhsArgs && rhsArgs.length > 0) { + if (rhsArgs[0] === lhsArgs[0]) { + return false; } - return this.needToDeduceStructuralIdentity(lhsArgs[0], rhsType, rhsExpr, isStrict); + return this.needToDeduceStructuralIdentity(lhsArgs[0], rhsArgs[0], rhsExpr, isStrict); } + return this.needToDeduceStructuralIdentity(lhsArgs[0], rhsType, rhsExpr, isStrict); } return false; } @@ -3701,41 +3706,6 @@ export class TsUtils { return undefined; } - /** - * Checks whether an exported identifier is imported from an ArkTS1 file. - * @param exportIdentifier The exported identifier to check. - * @param node The node where the export occurs (used to get the current source file). - * @returns true if imported from ArkTS1, false if not, undefined if undetermined. - */ - isExportImportedFromArkTs1(exportIdentifier: ts.Identifier, node: ts.Node): boolean | undefined { - // Get the symbol associated with the identifier. - const symbol = this.tsTypeChecker.getSymbolAtLocation(exportIdentifier); - if (!symbol) { - return undefined; - } - - // If the symbol is an alias (imported), resolve the real symbol. - const realSymbol = - (symbol.flags & ts.SymbolFlags.Alias) !== 0 ? this.tsTypeChecker.getAliasedSymbol(symbol) : undefined; - - const declarations = realSymbol?.getDeclarations(); - if (!declarations || declarations.length === 0) { - return undefined; - } - - // Get the source file where the declaration is located. - const importSourceFile = declarations[0].getSourceFile(); - - // Ensure import is from ArkTS1 file and usage is in ArkTS1.2 file - const currentSourceFile = node.getSourceFile(); - return ( - importSourceFile.fileName.endsWith(EXTNAME_ETS) && - currentSourceFile.fileName.endsWith(EXTNAME_ETS) && - !this.isArkts12File(importSourceFile) && - this.isArkts12File(currentSourceFile) - ); - } - isArkts12File(sourceFile: ts.SourceFile): boolean { if (!sourceFile?.fileName) { return false; diff --git a/ets2panda/linter/src/lib/utils/consts/ArkTS2Rules.ts b/ets2panda/linter/src/lib/utils/consts/ArkTS2Rules.ts index 1f26e36e86..a8b07dafce 100644 --- a/ets2panda/linter/src/lib/utils/consts/ArkTS2Rules.ts +++ b/ets2panda/linter/src/lib/utils/consts/ArkTS2Rules.ts @@ -108,7 +108,6 @@ export const arkts2Rules: number[] = [ 321, 322, 323, - 324, 325, 326, 327, @@ -136,6 +135,7 @@ export const arkts2Rules: number[] = [ 349, 350, 351, + 352, 355, 356, 357, @@ -149,7 +149,9 @@ export const arkts2Rules: number[] = [ 375, 376, 377, - 378 + 378, + 381, + 382 ]; export const onlyArkts2SyntaxRules: Map = new Map([ @@ -193,5 +195,17 @@ export const onlyArkts2SyntaxRules: Map = new Map([ [255, 'arkts-no-extends-expression'], [300, 'arkts-no-ts-like-function-call'], [301, 'arkts-ohmurl-full-path'], - [304, 'arkts-no-duplicate-function-name'] + [304, 'arkts-no-duplicate-function-name'], + [319, 'arkts-method-inherit-rule'], + [325, 'arkts-default-args-behind-required-args'], + [329, 'arkts-unsupport-prop-name-from-value'], + [370, 'arkts-no-sparse-array'], + [371, 'arkts-no-enum-prop-as-type'], + [372, 'arkts-no-ts-like-smart-type'], + [373, 'arkts-array-type-immutable'], + [374, 'arkts-primitive-type-normalization'], + [375, 'arkts-no-ts-like-catch-type'], + [376, 'arkts-numeric-bigint-compare'], + [377, 'arkts-only-support-decimal-bigint-literal'], + [378, 'arkts-unsupport-operator'] ]); diff --git a/ets2panda/linter/src/lib/utils/consts/ArkuiConstants.ts b/ets2panda/linter/src/lib/utils/consts/ArkuiConstants.ts index b12761975d..5405ffe91f 100644 --- a/ets2panda/linter/src/lib/utils/consts/ArkuiConstants.ts +++ b/ets2panda/linter/src/lib/utils/consts/ArkuiConstants.ts @@ -34,7 +34,8 @@ export enum CustomDecoratorName { AnimatableExtend = 'AnimatableExtend', Memo = 'Memo', Observed = 'Observed', - CustomLayout = 'CustomLayout' + CustomLayout = 'CustomLayout', + CustomStyles = 'CustomStyles' } export enum StorageTypeName { diff --git a/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts b/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts index 3adcc10ab5..3beae87577 100644 --- a/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts +++ b/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts @@ -57,6 +57,7 @@ export const arkuiImportList: Set = new Set([ 'Animator', 'AnimatorAttribute', 'AnimatorInterface', + 'applyStyles', 'AppRotation', 'AppStorage', 'AppearSymbolEffect', @@ -275,6 +276,7 @@ export const arkuiImportList: Set = new Set([ 'CustomSpanDrawInfo', 'CustomSpanMeasureInfo', 'CustomSpanMetrics', + 'CustomStyles', 'CustomTheme', 'CutEvent', 'DataAddOperation', @@ -1612,3 +1614,54 @@ export const arkuiImportList: Set = new Set([ 'sharedTransitionOptions', 'vp2px' ]); + +export const arkTsBuiltInTypeName: Set = new Set([ + 'Object', + 'Function', + 'Boolean', + 'Symbol', + 'Number', + 'BigInt', + 'Math', + 'Date', + 'String', + 'RegExp', + 'Array', + 'Int8Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array', + 'BigInt64Array', + 'BigUint64Array', + 'Map', + 'Set', + 'WeakMap', + 'WeakSet', + 'ArrayBuffer', + 'SharedArrayBuffer', + 'DataView', + 'JSON', + 'Promise', + 'Generator', + 'GeneratorFunction', + 'AsyncFunction', + 'AsyncGenerator', + 'AsyncGeneratorFunction', + 'Reflect', + 'Proxy', + 'Error', + 'EvalError', + 'RangeError', + 'ReferenceError', + 'SyntaxError', + 'TypeError', + 'URIError', + 'AggregateError', + 'Intl', + 'WebAssembly' +]); \ No newline at end of file diff --git a/ets2panda/linter/src/lib/utils/consts/AsyncLifecycleSDK.ts b/ets2panda/linter/src/lib/utils/consts/AsyncLifecycleSDK.ts new file mode 100644 index 0000000000..b589d85b4f --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/AsyncLifecycleSDK.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 const VOID = 'Void'; +export const PROMISE = 'Promise'; + +export const ON_DESTROY = 'onDestroy'; +export const ON_DISCONNECT = 'onDisconnect'; + +export const SERVICE_EXTENSION_ABILITY = 'ServiceExtensionAbility'; + +export const ABILITY_KIT = '@kit.AbilityKit'; + +export const ASYNC_LIFECYCLE_SDK_LIST = new Set([ + 'UIAbility', + 'UIExtensionAbility', + 'AutoFillExtensionAbility', + 'ServiceExtensionAbility' +]); diff --git a/ets2panda/linter/src/lib/utils/consts/ErrorProp.ts b/ets2panda/linter/src/lib/utils/consts/ErrorProp.ts index ce65497062..212bb02ae4 100644 --- a/ets2panda/linter/src/lib/utils/consts/ErrorProp.ts +++ b/ets2panda/linter/src/lib/utils/consts/ErrorProp.ts @@ -1,3 +1,4 @@ + /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,3 +15,9 @@ */ export const ERROR_PROP_LIST: Set = new Set(['name', 'message', 'stack', 'code']); + +export const ERROR_TASKPOOL_PROP_LIST: { [key: string]: Set } = { + 'taskpool.TaskInfo': new Set(['duration']), + 'taskpool.ThreadInfo': new Set(['taskIds', 'priority']), + 'StdProcess.ConditionType': new Set(['timeout', 'killSignal', 'maxBuffer']) +}; diff --git a/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts b/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts index 285a75b407..afd7fcc087 100644 --- a/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts +++ b/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts @@ -39,6 +39,7 @@ export const REFLECT_PROPERTIES = [ 'isExtensible', 'preventExtensions' ]; + export const OBJECT_PROPERTIES = [ 'get', 'set', @@ -66,10 +67,8 @@ export const REFLECT_LITERAL = 'Reflect'; export const NONE = 'none'; export type ForbidenAPICheckResult = 'Object' | 'Reflect' | 'none'; export const LOAD = 'load'; -export const GET_PROPERTY_BY_NAME = 'getPropertyByName'; -export const SET_PROPERTY_BY_NAME = 'setPropertyByName'; -export const GET_PROPERTY_BY_INDEX = 'getPropertyByIndex'; -export const SET_PROPERTY_BY_INDEX = 'setPropertyByIndex'; +export const GET_PROPERTY = 'getProperty'; +export const SET_PROPERTY = 'setProperty'; export const TO_NUMBER = 'toNumber'; export enum InteropType { diff --git a/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts b/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts index ca9bdcd843..eeef04d78d 100644 --- a/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts +++ b/ets2panda/linter/src/lib/utils/consts/LimitedStdAPI.ts @@ -157,3 +157,6 @@ export const MODULE_IMPORTS: Record = { '@ohos.process': ['process'], '@ohos.taskpool': ['taskpool'] }; + +export const ARKTSUTILS_MODULES = ['@arkts.utils', '@kit.ArkTS']; +export const ARKTSUTILS_LOCKS_MEMBER = 'locks'; diff --git a/ets2panda/linter/src/lib/utils/consts/MapKeyConst.ts b/ets2panda/linter/src/lib/utils/consts/MapKeyConst.ts new file mode 100644 index 0000000000..e5689d3f2a --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/MapKeyConst.ts @@ -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 const TOTAL_PROBLEMS = 'totalProblems'; + +export const ONE_POINT_ONE_PROBLEMS = 'arts1.1_Problems'; + +export const ONE_POINT_TWO_PROBLEMS = 'arts1.2_Problems'; + +export const CAN_BE_AUTO_FIXED_PROBLEMS_NUMBERS = 'canBeAutoFixedproblemNumbers'; + +export const NEED_TO_NAMUAL_FIX_PROBLEM_NUMBERS = 'needToManualFixproblemNumbers'; + +export const SCAN_TIME = 'scanTime'; + +export const MIGRATION_TIME = 'migrationTime'; diff --git a/ets2panda/linter/src/lib/utils/consts/WorkloadRelatedConst.ts b/ets2panda/linter/src/lib/utils/consts/WorkloadRelatedConst.ts new file mode 100644 index 0000000000..c0c5efc0cc --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/WorkloadRelatedConst.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 const AVERAGE_LINE_FOR_REPAIRE_RULE_COEFFICIENT = 3; + +export const TEST_DEBUG_WORKLOAD_COEFFICIENT = 1.2; + +export const NPAI_REPAIRE_WORKLOADA_COEFFICIEN = 0.2; \ No newline at end of file diff --git a/ets2panda/linter/src/lib/utils/functions/ConfiguredRulesProcess.ts b/ets2panda/linter/src/lib/utils/functions/ConfiguredRulesProcess.ts new file mode 100644 index 0000000000..99e6c5da6f --- /dev/null +++ b/ets2panda/linter/src/lib/utils/functions/ConfiguredRulesProcess.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 * as fs from 'node:fs'; +import * as path from 'node:path'; + +export function getConfiguredRuleTags( + arkTSRulesMap: Map, + configuredRulesMap: Map +): Set { + const mergedRulesMap: string[] = Array.from(configuredRulesMap.values()).flat(); + const configuredRuleTags = new Set(); + const mergedRulesSet = new Set(mergedRulesMap); + arkTSRulesMap.forEach((key, value) => { + if (mergedRulesSet.has(key)) { + configuredRuleTags.add(value); + } + }); + return configuredRuleTags; +} + +export function getRulesFromConfig(configRulePath: string): Map { + try { + const normalizedPath = path.normalize(configRulePath); + const data = fs.readFileSync(normalizedPath, 'utf-8'); + const jsonData = JSON.parse(data); + const dataMap = new Map(); + for (const [key, value] of Object.entries(jsonData)) { + dataMap.set(key, value); + } + return convertToStringArrayMap(dataMap); + } catch (error) { + if (error instanceof SyntaxError) { + throw new Error(`JSON parsing failed: ${error.message}`); + } + return new Map(); + } +} + +function convertToStringArrayMap(inputMap: Map): Map { + const resultMap: Map = new Map(); + for (const [key, value] of inputMap) { + if (isStringArray(value)) { + resultMap.set(key, value); + } + } + return resultMap; +} + +function isStringArray(value: any): value is string[] { + return ( + Array.isArray(value) && + value.every((item) => { + return typeof item === 'string'; + }) + ); +} diff --git a/ets2panda/linter/src/lib/utils/functions/CookBookUtils.ts b/ets2panda/linter/src/lib/utils/functions/CookBookUtils.ts new file mode 100644 index 0000000000..0f2bec5ade --- /dev/null +++ b/ets2panda/linter/src/lib/utils/functions/CookBookUtils.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 function extractRuleTags(tags: string[]): Map { + const resultMap = new Map(); + + for (let i = 0; i < tags.length; i++) { + const tag = tags[i]; + + if (!tag?.trim()) { + continue; + } + + const regex = /\(([^)]+)\)/; + const match = tag.match(regex); + + if (match?.[1]?.trim()) { + resultMap.set(i, match[1]); + } + } + + return resultMap; +} diff --git a/ets2panda/linter/src/lib/utils/functions/ProcessWrite.ts b/ets2panda/linter/src/lib/utils/functions/ProcessWrite.ts new file mode 100644 index 0000000000..ef8e100ae8 --- /dev/null +++ b/ets2panda/linter/src/lib/utils/functions/ProcessWrite.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 async function processSyncOut(message: string): Promise { + await new Promise((resolve) => { + process.stdout.write(message, () => { + resolve('success'); + }); + }); +} + +export async function processSyncErr(message: string): Promise { + await new Promise((resolve) => { + process.stderr.write(message, () => { + resolve('success'); + }); + }); +} diff --git a/ets2panda/linter/src/testRunner/LintTest.ts b/ets2panda/linter/src/testRunner/LintTest.ts index 02db53dd49..8661ed7c74 100644 --- a/ets2panda/linter/src/testRunner/LintTest.ts +++ b/ets2panda/linter/src/testRunner/LintTest.ts @@ -15,20 +15,21 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; +import type { Autofix } from '../lib/autofixes/Autofixer'; import type { CommandLineOptions } from '../lib/CommandLineOptions'; import type { LinterConfig } from '../lib/LinterConfig'; import { lint } from '../lib/LinterRunner'; +import type { LintRunResult } from '../lib/LintRunResult'; import { Logger } from '../lib/Logger'; +import { TimeRecorder } from '../lib/statistics/scan/TimeRecorder'; import { compileLintOptions } from '../lib/ts-compiler/Compiler'; +import { DIFF_EXT, RESULTS_DIR, TAB } from './Consts'; +import type { CreateLintTestOptions } from './TestFactory'; import type { TestModeProperties } from './TestMode'; import { TestMode } from './TestMode'; -import { transformProblemInfos } from './TestUtil'; import type { TestProblemInfo, TestResult } from './TestResult'; import { validateTestResult } from './TestResult'; -import type { LintRunResult } from '../lib/LintRunResult'; -import { DIFF_EXT, RESULTS_DIR, TAB } from './Consts'; -import type { Autofix } from '../lib/autofixes/Autofixer'; -import type { CreateLintTestOptions } from './TestFactory'; +import { transformProblemInfos } from './TestUtil'; export class LintTest { readonly testDir: string; @@ -47,7 +48,8 @@ export class LintTest { Logger.info(`Running test ${this.testFile} (${TestMode[this.testModeProps.mode]} mode)`); const linterConfig = this.compile(); - const linterResult = lint(linterConfig); + const timeRecorder = new TimeRecorder(); + const linterResult = lint(linterConfig, timeRecorder); return this.validate(linterResult); } diff --git a/ets2panda/linter/src/testRunner/TestRunner.ts b/ets2panda/linter/src/testRunner/TestRunner.ts index 4d3639fb32..1f068e2f51 100755 --- a/ets2panda/linter/src/testRunner/TestRunner.ts +++ b/ets2panda/linter/src/testRunner/TestRunner.ts @@ -143,6 +143,21 @@ function runTests(): boolean { const { passed, failed } = testStats; Logger.info(`\nSUMMARY: ${passed + failed} total, ${passed} passed, ${failed} failed.`); Logger.info(failed > 0 ? '\nTEST FAILED' : '\nTEST SUCCESSFUL'); + + const saveCoverageData = (): void => { + const coverageData = globalThis.__coverage__; + if (coverageData) { + const projectRoot = path.resolve(__dirname, '../../..'); + const coverageDir = path.join(projectRoot, 'coverage'); + fs.mkdirSync(coverageDir, { recursive: true }); + + const coverageFile = path.join(coverageDir, 'coverage.json'); + fs.writeFileSync(coverageFile, JSON.stringify(coverageData, null, 4)); + } else { + console.log('no coverage data found'); + } + }; + saveCoverageData(); process.exit(failed > 0 ? -1 : 0); } diff --git a/ets2panda/linter/test/builtin/builtin_thisArgs.ets b/ets2panda/linter/test/builtin/builtin_thisArgs.ets index 2a73669055..b296e847c1 100755 --- a/ets2panda/linter/test/builtin/builtin_thisArgs.ets +++ b/ets2panda/linter/test/builtin/builtin_thisArgs.ets @@ -28,4 +28,12 @@ let a = new MyClass(2); let b = new MyClass(3); arr.filter(a.compare, a); arr.filter(a.compare); -arr.filter(a.compare, b); \ No newline at end of file +arr.filter(a.compare, b); + +type T = number | T[]; +let arr: ReadonlyArray = [[1.0, 2.0], 3.0, [4.0, 5.0]]; +arr.flatMap( + (value, index, array) => { + return value; + } +); \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets new file mode 100644 index 0000000000..3ad92e0865 --- /dev/null +++ b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets @@ -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. + */ + +import { ArkTSUtils } from '../main/oh_modules/@kit.ArkTS'; + +let lock1 = new ArkTSUtils.locks.AsyncLock(); + +let lock2 = new ArkTSUtils.locks.AsyncLock(); \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.arkts2.json b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.arkts2.json new file mode 100644 index 0000000000..31d218b8f0 --- /dev/null +++ b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.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": 18, + "column": 28, + "endLine": 18, + "endColumn": 33, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 28, + "endLine": 20, + "endColumn": 33, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.autofix.json b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.autofix.json new file mode 100644 index 0000000000..31d218b8f0 --- /dev/null +++ b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.autofix.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": 18, + "column": 28, + "endLine": 18, + "endColumn": 33, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 28, + "endLine": 20, + "endColumn": 33, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.json b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.json new file mode 100644 index 0000000000..ca88f857e9 --- /dev/null +++ b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.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/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.ets b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.ets new file mode 100644 index 0000000000..c8cd4f5b48 --- /dev/null +++ b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.ets @@ -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. + */ + +import { ArkTSUtils } from '../main/oh_modules/@kit.ArkTS'; + +let lock1 = new ArkTSUtils.locks.AsyncLock(); + +let lock2 = new ArkTSUtils.locks.AsyncLock(); \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.json b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.json new file mode 100644 index 0000000000..31d218b8f0 --- /dev/null +++ b/ets2panda/linter/test/concurrent/ no_support_arktsutils_locks_asynclock.ets.migrate.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": 18, + "column": 28, + "endLine": 18, + "endColumn": 33, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 28, + "endLine": 20, + "endColumn": 33, + "problem": "LimitedStdLibNoImportConcurrency", + "suggest": "", + "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/no_support_isconcurrent.ets.arkts2.json b/ets2panda/linter/test/concurrent/no_support_isconcurrent.ets.arkts2.json index 428032b2d8..9b627b9d72 100644 --- a/ets2panda/linter/test/concurrent/no_support_isconcurrent.ets.arkts2.json +++ b/ets2panda/linter/test/concurrent/no_support_isconcurrent.ets.arkts2.json @@ -23,6 +23,26 @@ "suggest": "", "rule": "Usage of standard library is restricted(arkts-limited-stdlib-no-concurrent-decorator)", "severity": "ERROR" + }, + { + "line": 23, + "column": 32, + "endLine": 23, + "endColumn": 44, + "problem": "IsConcurrentDeprecated", + "suggest": "", + "rule": "isConcurrent is not supported (arkts-limited-stdlib-no-support-isConcurrent)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 27, + "endLine": 25, + "endColumn": 39, + "problem": "IsConcurrentDeprecated", + "suggest": "", + "rule": "isConcurrent is not supported (arkts-limited-stdlib-no-support-isConcurrent)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/concurrent/no_support_isconcurrent2.ets.arkts2.json b/ets2panda/linter/test/concurrent/no_support_isconcurrent2.ets.arkts2.json index b418f42b21..bba9654328 100755 --- a/ets2panda/linter/test/concurrent/no_support_isconcurrent2.ets.arkts2.json +++ b/ets2panda/linter/test/concurrent/no_support_isconcurrent2.ets.arkts2.json @@ -24,26 +24,6 @@ "rule": "Import Concurrency is not required (arkts-limited-stdlib-no-import-concurrency)", "severity": "ERROR" }, - { - "line": 23, - "column": 17, - "endLine": 23, - "endColumn": 29, - "problem": "IsConcurrentDeprecated", - "suggest": "", - "rule": "isConcurrent is not supported (arkts-limited-stdlib-no-support-isConcurrent)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 12, - "endLine": 25, - "endColumn": 24, - "problem": "IsConcurrentDeprecated", - "suggest": "", - "rule": "isConcurrent is not supported (arkts-limited-stdlib-no-support-isConcurrent)", - "severity": "ERROR" - }, { "line": 25, "column": 25, 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 8bf1b635a6..796dfbb772 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 GeneratedImportVar_1 = ESValue.load('./binary_operation_js_obj_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\nlet m = GeneratedImportVar_1.getPropertyByName('m');\nlet n = GeneratedImportVar_1.getPropertyByName('n');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./binary_operation_js_obj_js');\nlet foo = GeneratedImportVar_1.getProperty('foo');\nlet m = GeneratedImportVar_1.getProperty('m');\nlet n = GeneratedImportVar_1.getProperty('n');\n", "line": 15, "column": 1, "endLine": 15, @@ -54,7 +54,7 @@ { "start": 665, "end": 670, - "replacementText": "foo.getPropertyByName(\"a\")", + "replacementText": "foo.getProperty(\"a\")", "line": 16, "column": 9, "endLine": 16, @@ -75,7 +75,7 @@ { "start": 679, "end": 684, - "replacementText": "foo.getPropertyByName(\"b\")", + "replacementText": "foo.getProperty(\"b\")", "line": 17, "column": 9, "endLine": 17, @@ -96,7 +96,7 @@ { "start": 665, "end": 670, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 18, "column": 1, "endLine": 18, @@ -117,7 +117,7 @@ { "start": 679, "end": 684, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 18, "column": 5, "endLine": 18, @@ -138,7 +138,7 @@ { "start": 665, "end": 670, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 19, "column": 1, "endLine": 19, @@ -159,7 +159,7 @@ { "start": 679, "end": 684, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 19, "column": 5, "endLine": 19, @@ -180,7 +180,7 @@ { "start": 665, "end": 670, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 20, "column": 1, "endLine": 20, @@ -201,7 +201,7 @@ { "start": 679, "end": 684, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 20, "column": 5, "endLine": 20, @@ -222,7 +222,7 @@ { "start": 665, "end": 670, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 21, "column": 1, "endLine": 21, @@ -243,7 +243,7 @@ { "start": 679, "end": 684, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 21, "column": 5, "endLine": 21, @@ -264,7 +264,7 @@ { "start": 665, "end": 670, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 22, "column": 1, "endLine": 22, @@ -285,7 +285,7 @@ { "start": 679, "end": 684, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 22, "column": 5, "endLine": 22, @@ -306,7 +306,7 @@ { "start": 665, "end": 670, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 23, "column": 1, "endLine": 23, @@ -327,7 +327,7 @@ { "start": 679, "end": 684, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 23, "column": 6, "endLine": 23, @@ -756,7 +756,7 @@ { "start": 884, "end": 889, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 43, "column": 1, "endLine": 43, @@ -777,7 +777,7 @@ { "start": 892, "end": 897, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 43, "column": 9, "endLine": 43, @@ -798,7 +798,7 @@ { "start": 884, "end": 889, - "replacementText": "foo.getPropertyByName(\"a\")", + "replacementText": "foo.getProperty(\"a\")", "line": 43, "column": 1, "endLine": 43, @@ -819,7 +819,7 @@ { "start": 892, "end": 897, - "replacementText": "foo.getPropertyByName(\"b\")", + "replacementText": "foo.getProperty(\"b\")", "line": 43, "column": 9, "endLine": 43, 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 f29b91c275..f71f2540b4 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 @@ -13,12 +13,12 @@ * limitations under the License. */ let GeneratedImportVar_1 = ESValue.load('./binary_operation_js_obj_js'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); -let m = GeneratedImportVar_1.getPropertyByName('m'); -let n = GeneratedImportVar_1.getPropertyByName('n'); +let foo = GeneratedImportVar_1.getProperty('foo'); +let m = GeneratedImportVar_1.getProperty('m'); +let n = GeneratedImportVar_1.getProperty('n'); -let a = foo.getPropertyByName("a") -let b = foo.getPropertyByName("b") +let a = foo.getProperty("a") +let b = foo.getProperty("b") a + b a - b a * b @@ -48,4 +48,4 @@ x2 - y2; x2 % y2; Math.pow(x2, y2); -foo.getPropertyByName("a").toNumber() + foo.getPropertyByName("b").toNumber(); \ No newline at end of file +foo.getProperty("a").toNumber() + foo.getProperty("b").toNumber(); \ No newline at end of file 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 817c2a9450..00ccbc39c6 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 @@ -28,7 +28,7 @@ "line": 16, "column": 5, "endLine": 16, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 17, "column": 5, "endLine": 17, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +48,7 @@ "line": 18, "column": 5, "endLine": 18, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -58,7 +58,7 @@ "line": 20, "column": 5, "endLine": 20, - "endColumn": 35, + "endColumn": 29, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 21, "column": 5, "endLine": 21, - "endColumn": 35, + "endColumn": 29, "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 5776d747e9..ca67f37978 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 GeneratedImportVar_1 = ESValue.load('./call_object_methods_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./call_object_methods_js');\nlet foo = GeneratedImportVar_1.getProperty('foo');\n", "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 2d455bda8e..600a9cadac 100644 --- a/ets2panda/linter/test/interop/call_object_methods.ets.migrate.ets +++ b/ets2panda/linter/test/interop/call_object_methods.ets.migrate.ets @@ -13,7 +13,7 @@ * limitations under the License. */ let GeneratedImportVar_1 = ESValue.load('./call_object_methods_js'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); +let foo = GeneratedImportVar_1.getProperty('foo'); foo.invokeMethod("bar", ESValue.wrap(123.0)) diff --git a/ets2panda/linter/test/interop/call_object_methods.ets.migrate.json b/ets2panda/linter/test/interop/call_object_methods.ets.migrate.json index 4f96146af1..ccc6caf0a4 100644 --- a/ets2panda/linter/test/interop/call_object_methods.ets.migrate.json +++ b/ets2panda/linter/test/interop/call_object_methods.ets.migrate.json @@ -28,7 +28,7 @@ "line": 16, "column": 5, "endLine": 16, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", diff --git a/ets2panda/linter/test/interop/ignore_files/unique_types.ts b/ets2panda/linter/test/interop/ignore_files/unique_types.ts index 1c19752b63..f56856f73a 100644 --- a/ets2panda/linter/test/interop/ignore_files/unique_types.ts +++ b/ets2panda/linter/test/interop/ignore_files/unique_types.ts @@ -13,24 +13,217 @@ * limitations under the License. */ -type SomeType = { - name: string, +// 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; +}; + +export class A { + static instance = new A(); } -enum X { - a = 0, - b = '1', +export interface B { + name:string } -type UnionString = "A" | "B"; -type TemplateLiteralType = `${UnionString}_id`; +//用例一 +export function throw_number() { + throw 123; +} -export let objectLiteralType: SomeType; -export let mixedEnumType: X; -export let intersectionType: SomeType & X; -export let templateLiteralType: TemplateLiteralType; +export function throw_string() { + throw "error"; +} -export function tsFunction() { - throw 123; -}; -export let stringType: string; +export function throw_boolean() { + throw true; +} + +export function throw_bigint() { + throw 111n; +} + +export function throw_obj() { + throw { name:'error' }; +} + +export function throw_error() { + throw new Error("error"); +} + +export class SubError extends Error { + extraField: number = 123; + foo() { return 456; } +} + +export function throwErrorSubClass() { + throw new SubError(); +} +export function throwRangeError() { + throw new RangeError(); +} + +//用例二 +export class ObjectLiteralClass { + name:string = "" +} + +export interface ObjectLiteralInter { + name:string +} +//用例三 +//类装饰器 +export function MyClassDecorator(klass: Object) {} + +//属性装饰器 +export function propertyDecorator(target: Object, propertyKey: string) { + console.log(Property Decorator called on: ${target.constructor.name} with propertyKey: ${propertyKey}); +} + +//方法装饰器 +export function methodDecorator(target: Object, propertyKey: string , descriptor: PropertyDescriptor) { + console.log(Method Decorator called on: ${target.constructor.name} with propertyKey: ${propertyKey}); + descriptor.value = function (...args: any[]) { + console.log(Called: ${propertyKey} with, args); + return args[0] * 2; + }; + return descriptor; +} + +// 参数装饰器 +export function parameterDecorator(target: Object, propertyKey: string , parameterIndex: number) { + console.log(Parameter Decorator called on: ${target.constructor.name} with propertyKey: ${propertyKey} and parameterIndex: ${parameterIndex}); +} + +// 访问器装饰器 +export function accessorDecorator(target: any, propertyKey: string, descriptor: PropertyDescriptor) { + const originalGet = descriptor.get; + const originalSet = descriptor.set; + + descriptor.get = function() { + console.log(Getter for ${propertyKey} called.); + return originalGet.apply(this); + }; + descriptor.set = function(value) { + console.log(Setter for ${propertyKey} called with value: ${value}); + originalSet.apply(this, [value]); + }; + return descriptor; +} + +// 装饰器工厂 +export function readonly1(isReadonly: boolean) { + return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) { + if (isReadonly) { + descriptor.writable = false; + } + }; +} + +export let num_boxed = new Number(123) +export let bool_boxed = new Boolean(true) +export let str_boxed = new String('hello') +export let bigint_boxed = BigInt(123n) + +export function ts_object_method(prx: any) { + Object.getOwnPropertyDescriptor(prx, "a") // arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-limited-stdlib not undefined + Object.getOwnPropertyDescriptors(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 not {} + Object.getOwnPropertyNames(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 ["a"] + Object.hasOwn(prx, "a") // true + Object.isExtensible(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true + Object.isFrozen(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 false + Object.isSealed(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 false + Object.keys(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 ["a"] + Object.setPrototypeOf(prx, {}) // arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-limited-stdlib OK + Object.values(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-no-inferred-generic-params [1] + prx.hasOwnProperty("a") // true + prx.propertyIsEnumerable("a") // true +} + +export function ts_object_method_getOwnPropertyDescriptor(prx: any) { + return Object.getOwnPropertyDescriptor(prx, "a") // arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-limited-stdlib not undefined +} +export function ts_object_method_getOwnPropertyDescriptors(prx: any) { + return Object.getOwnPropertyDescriptors(prx)// arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-limited-stdlib not {} +} +export function ts_object_method_getOwnPropertyNames(prx: any) { + return Object.getOwnPropertyNames(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 ["a"] +} +export function ts_object_method_hasOwn(prx: any) { + return Object.hasOwn(prx, "a") // true +} +export function ts_object_method_isExtensible(prx: any) { + return Object.isExtensible(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-limited-stdlib true +} +export function ts_object_method_isFrozen(prx: any) { + return Object.isFrozen(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-limited-stdlib false +} + +export function ts_object_method_isSealed(prx: any) { + return Object.isSealed(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-limited-stdlib false +} + +export function ts_object_method_keys(prx: any) { + return Object.keys(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 3 ["a"] +} + +export function ts_object_method_setPrototypeOf(prx: any) { + return Object.setPrototypeOf(prx, {}) // arkts-limited-stdlib OK +} + +export function ts_object_method_values(prx: any) { + return Object.values(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 + arkts-no-inferred-generic-params [1] +} + +interface Iface { + a:number +} +export let interObj:Iface = {a:1} + +export function ts_reflect_method(prx: any) { + Reflect.apply(prx.getName, {a: 12}) // arkts-interop-ts2s-ts-object-on-static-instance * 2 12 + Reflect.defineProperty(prx, 'newField', {value: 7}) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true + Reflect.deleteProperty(prx, "a") // arkts-interop-ts2s-ts-object-on-static-instance * 2 true + Reflect.getOwnPropertyDescriptor(prx, "a") // arkts-interop-ts2s-ts-object-on-static-instance * 2 not undefined + Reflect.ownKeys(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 ['a'] + Reflect.isExtensible(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true + Reflect.set(prx, 'newField', 7) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true + Reflect.setPrototypeOf(prx, {}) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true +} + +export function ts_reflect_method_apply(prx: any) { + Reflect.apply(prx.getName, {a: 12}) // arkts-interop-ts2s-ts-object-on-static-instance * 2 12 +} +export function ts_reflect_method_defineProperty(prx: any) { + Reflect.defineProperty(prx, 'newField', {value: 7}) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true +} +export function ts_reflect_method_deleteProperty(prx: any) { + Reflect.deleteProperty(prx, "a") // arkts-interop-ts2s-ts-object-on-static-instance * 2 true +} +export function ts_reflect_method_getOwnPropertyDescriptor(prx: any) { + Reflect.getOwnPropertyDescriptor(prx, "a") // arkts-interop-ts2s-ts-object-on-static-instance * 2 not undefined +} +export function ts_reflect_method_ownKeys(prx: any) { + Reflect.ownKeys(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 ['a'] +} +export function ts_reflect_method_isExtensible(prx: any) { + Reflect.isExtensible(prx) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true +} +export function ts_reflect_method_set(prx: any) { + Reflect.set(prx, 'newField', 7) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true +} +export function ts_reflect_method_setPrototypeOf(prx: any) { + Reflect.setPrototypeOf(prx, {}) // arkts-interop-ts2s-ts-object-on-static-instance * 2 true +} \ 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 e48a8565b9..a0e63a21c5 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 @@ -14,7 +14,7 @@ "limitations under the License." ], "result": [ - { + { "line": 15, "column": 1, "endLine": 15, @@ -33,7 +33,7 @@ { "start": 655, "end": 655, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./increases_decreases_js_obj_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./increases_decreases_js_obj_js');\nlet foo = GeneratedImportVar_1.getProperty('foo');\n", "line": 15, "column": 1, "endLine": 15, @@ -73,7 +73,7 @@ "problem": "InteropIncrementDecrement", "autofix": [ { - "replacementText": "a = foo.getPropertyByName(\"num\").toNumber()\nfoo.setPropertyByName(num, a + 1)\na = a + 1\n", + "replacementText": "a = foo.getProperty(\"num\").toNumber()\nfoo.setProperty(num, a + 1)\na = a + 1\n", "start": 673, "end": 686, "line": 17, @@ -96,7 +96,7 @@ { "start": 677, "end": 684, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 17, "column": 5, "endLine": 17, @@ -115,7 +115,7 @@ "problem": "InteropIncrementDecrement", "autofix": [ { - "replacementText": "a = foo.getPropertyByName(\"num\").toNumber()\na = a + 1\nfoo.setPropertyByName(num, a)\n", + "replacementText": "a = foo.getProperty(\"num\").toNumber()\na = a + 1\nfoo.setProperty(num, a)\n", "start": 687, "end": 700, "line": 18, @@ -138,7 +138,7 @@ { "start": 693, "end": 700, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 18, "column": 7, "endLine": 18, @@ -157,7 +157,7 @@ "problem": "InteropIncrementDecrement", "autofix": [ { - "replacementText": "a = foo.getPropertyByName(\"num\").toNumber()\nfoo.setPropertyByName(num, a - 1)\na = a - 1\n", + "replacementText": "a = foo.getProperty(\"num\").toNumber()\nfoo.setProperty(num, a - 1)\na = a - 1\n", "start": 701, "end": 714, "line": 19, @@ -180,7 +180,7 @@ { "start": 705, "end": 712, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 19, "column": 5, "endLine": 19, @@ -199,7 +199,7 @@ "problem": "InteropIncrementDecrement", "autofix": [ { - "replacementText": "a = foo.getPropertyByName(\"num\").toNumber()\na = a - 1\nfoo.setPropertyByName(num, a)\n", + "replacementText": "a = foo.getProperty(\"num\").toNumber()\na = a - 1\nfoo.setProperty(num, a)\n", "start": 715, "end": 728, "line": 20, @@ -222,7 +222,7 @@ { "start": 721, "end": 728, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 20, "column": 7, "endLine": 20, @@ -241,7 +241,7 @@ "problem": "InteropIncrementDecrement", "autofix": [ { - "replacementText": "let tmp_1 = foo.getPropertyByName(\"num\").toNumber()\nfoo.setPropertyByName(num, tmp_1 + 1)\ntmp_1 = tmp_1 + 1\n", + "replacementText": "let tmp_1 = foo.getProperty(\"num\").toNumber()\nfoo.setProperty(num, tmp_1 + 1)\ntmp_1 = tmp_1 + 1\n", "start": 730, "end": 739, "line": 22, @@ -264,7 +264,7 @@ { "start": 730, "end": 737, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 22, "column": 1, "endLine": 22, @@ -283,7 +283,7 @@ "problem": "InteropIncrementDecrement", "autofix": [ { - "replacementText": "let tmp_2 = foo.getPropertyByName(\"num\").toNumber()\ntmp_2 = tmp_2 + 1\nfoo.setPropertyByName(num, tmp_2)\n", + "replacementText": "let tmp_2 = foo.getProperty(\"num\").toNumber()\ntmp_2 = tmp_2 + 1\nfoo.setProperty(num, tmp_2)\n", "start": 740, "end": 749, "line": 23, @@ -306,7 +306,7 @@ { "start": 742, "end": 749, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 23, "column": 3, "endLine": 23, @@ -325,7 +325,7 @@ "problem": "InteropIncrementDecrement", "autofix": [ { - "replacementText": "let tmp_3 = foo.getPropertyByName(\"num\").toNumber()\nfoo.setPropertyByName(num, tmp_3 - 1)\ntmp_3 = tmp_3 - 1\n", + "replacementText": "let tmp_3 = foo.getProperty(\"num\").toNumber()\nfoo.setProperty(num, tmp_3 - 1)\ntmp_3 = tmp_3 - 1\n", "start": 750, "end": 759, "line": 24, @@ -348,7 +348,7 @@ { "start": 750, "end": 757, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 24, "column": 1, "endLine": 24, @@ -367,7 +367,7 @@ "problem": "InteropIncrementDecrement", "autofix": [ { - "replacementText": "let tmp_4 = foo.getPropertyByName(\"num\").toNumber()\ntmp_4 = tmp_4 - 1\nfoo.setPropertyByName(num, tmp_4)\n", + "replacementText": "let tmp_4 = foo.getProperty(\"num\").toNumber()\ntmp_4 = tmp_4 - 1\nfoo.setProperty(num, tmp_4)\n", "start": 760, "end": 769, "line": 25, @@ -390,7 +390,7 @@ { "start": 762, "end": 769, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 25, "column": 3, "endLine": 25, 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 f022ce0834..276cf1196d 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,39 +13,39 @@ * limitations under the License. */ let GeneratedImportVar_1 = ESValue.load('./increases_decreases_js_obj_js'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); +let foo = GeneratedImportVar_1.getProperty('foo'); let a: number =0.0 -a = foo.getPropertyByName("num").toNumber() -foo.setPropertyByName(num, a + 1.0) +a = foo.getProperty("num").toNumber() +foo.setProperty(num, a + 1.0) a = a + 1.0 -a = foo.getPropertyByName("num").toNumber() +a = foo.getProperty("num").toNumber() a = a + 1.0 -foo.setPropertyByName(num, a) +foo.setProperty(num, a) -a = foo.getPropertyByName("num").toNumber() -foo.setPropertyByName(num, a - 1.0) +a = foo.getProperty("num").toNumber() +foo.setProperty(num, a - 1.0) a = a - 1.0 -a = foo.getPropertyByName("num").toNumber() +a = foo.getProperty("num").toNumber() a = a - 1.0 -foo.setPropertyByName(num, a) +foo.setProperty(num, a) -let tmp_1 = foo.getPropertyByName("num").toNumber() -foo.setPropertyByName(num, tmp_1 + 1.0) +let tmp_1 = foo.getProperty("num").toNumber() +foo.setProperty(num, tmp_1 + 1.0) tmp_1 = tmp_1 + 1.0 -let tmp_2 = foo.getPropertyByName("num").toNumber() +let tmp_2 = foo.getProperty("num").toNumber() tmp_2 = tmp_2 + 1.0 -foo.setPropertyByName(num, tmp_2) +foo.setProperty(num, tmp_2) -let tmp_3 = foo.getPropertyByName("num").toNumber() -foo.setPropertyByName(num, tmp_3 - 1.0) +let tmp_3 = foo.getProperty("num").toNumber() +foo.setProperty(num, tmp_3 - 1.0) tmp_3 = tmp_3 - 1.0 -let tmp_4 = foo.getPropertyByName("num").toNumber() +let tmp_4 = foo.getProperty("num").toNumber() tmp_4 = tmp_4 - 1.0 -foo.setPropertyByName(num, tmp_4) +foo.setProperty(num, tmp_4) 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 0a10b6a69e..78b7199f4f 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 @@ -28,7 +28,7 @@ "line": 16, "column": 5, "endLine": 16, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 36, "column": 5, "endLine": 36, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +48,7 @@ "line": 40, "column": 5, "endLine": 40, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -58,7 +58,7 @@ "line": 44, "column": 5, "endLine": 44, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 48, "column": 5, "endLine": 48, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", 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 f9ae170771..c0509f85ea 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 GeneratedImportVar_1 = ESValue.load('./instantiated_js_obj_js');\nlet Foo = GeneratedImportVar_1.getPropertyByName('Foo');\nlet Foo1 = GeneratedImportVar_1.getPropertyByName('Foo1');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./instantiated_js_obj_js');\nlet Foo = GeneratedImportVar_1.getProperty('Foo');\nlet Foo1 = GeneratedImportVar_1.getProperty('Foo1');\n", "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 b033816ddb..754fa9a041 100644 --- a/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.ets +++ b/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.ets @@ -14,8 +14,8 @@ */ let GeneratedImportVar_1 = ESValue.load('./instantiated_js_obj_js'); -let Foo = GeneratedImportVar_1.getPropertyByName('Foo'); -let Foo1 = GeneratedImportVar_1.getPropertyByName('Foo1'); +let Foo = GeneratedImportVar_1.getProperty('Foo'); +let Foo1 = GeneratedImportVar_1.getProperty('Foo1'); class A { num: number = 1.0; diff --git a/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.json b/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.json index 2084de8763..5c043e26be 100644 --- a/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.json +++ b/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.json @@ -28,7 +28,7 @@ "line": 17, "column": 5, "endLine": 17, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 18, "column": 5, "endLine": 18, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets b/ets2panda/linter/test/interop/interop_convert_import.ets index 02426a4318..ea40300e23 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets +++ b/ets2panda/linter/test/interop/interop_convert_import.ets @@ -1,4 +1,3 @@ -<<<<<<< HEAD /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,27 +38,4 @@ return null_val as null === null;// 扫描出 arkts-interop-js2s-convert-js-type // convert type - undefined test_helper.test(() => { return undefined_val as undefined === undefined; // 扫描出 arkts-interop-js2s-convert-js-type - no pass -}, "undefined_val as undefined === undefined"); -======= -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 {foo, foo2, foo3, foo4} from "./interop_convert_import_js.js" - - let a: number = foo.num as number - let a: boolean = foo2.bool as boolean - let a: string = foo3.str as string - let a: bigint = foo4.big as bigint" ->>>>>>> efeb0a81e (modify use static spec) +}, "undefined_val as undefined === undefined"); diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json b/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json index d6f91a557d..2891efe2d7 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.arkts2.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 18, + "line": 17, "column": 2, - "endLine": 18, + "endLine": 17, "endColumn": 106, "problem": "ImportAfterStatement", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 18, + "line": 17, "column": 2, - "endLine": 18, + "endLine": 17, "endColumn": 106, "problem": "InterOpImportJs", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 20, + "line": 19, "column": 18, - "endLine": 20, + "endLine": 19, "endColumn": 35, "problem": "InterOpConvertImport", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 20, + "line": 19, "column": 18, - "endLine": 20, + "endLine": 19, "endColumn": 25, "problem": "InteropObjectProperty", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 21, + "line": 20, "column": 20, - "endLine": 21, + "endLine": 20, "endColumn": 41, "problem": "InterOpConvertImport", "suggest": "", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 21, + "line": 20, "column": 20, - "endLine": 21, + "endLine": 20, "endColumn": 29, "problem": "InteropObjectProperty", "suggest": "", @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 22, + "line": 21, "column": 19, - "endLine": 22, + "endLine": 21, "endColumn": 38, "problem": "InterOpConvertImport", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 22, + "line": 21, "column": 19, - "endLine": 22, + "endLine": 21, "endColumn": 27, "problem": "InteropObjectProperty", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 23, + "line": 22, "column": 19, - "endLine": 23, + "endLine": 22, "endColumn": 38, "problem": "InterOpConvertImport", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 23, + "line": 22, "column": 19, - "endLine": 23, + "endLine": 22, "endColumn": 27, "problem": "InteropObjectProperty", "suggest": "", @@ -115,9 +115,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 9, - "endLine": 26, + "endLine": 25, "endColumn": 27, "problem": "InterOpConvertImport", "suggest": "", @@ -125,9 +125,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 44, - "endLine": 26, + "endLine": 25, "endColumn": 62, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -135,9 +135,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 54, - "endLine": 26, + "endLine": 25, "endColumn": 55, "problem": "NumericSemantics", "suggest": "", @@ -145,9 +145,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 57, - "endLine": 26, + "endLine": 25, "endColumn": 58, "problem": "NumericSemantics", "suggest": "", @@ -155,9 +155,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 60, - "endLine": 26, + "endLine": 25, "endColumn": 61, "problem": "NumericSemantics", "suggest": "", @@ -165,9 +165,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 9, - "endLine": 31, + "endLine": 30, "endColumn": 30, "problem": "InterOpConvertImport", "suggest": "", @@ -175,9 +175,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 48, - "endLine": 31, + "endLine": 30, "endColumn": 49, "problem": "NumericSemantics", "suggest": "", @@ -185,9 +185,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 50, - "endLine": 31, + "endLine": 30, "endColumn": 51, "problem": "NumericSemantics", "suggest": "", @@ -195,9 +195,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 52, - "endLine": 31, + "endLine": 30, "endColumn": 53, "problem": "NumericSemantics", "suggest": "", @@ -205,9 +205,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 35, "column": 8, - "endLine": 36, + "endLine": 35, "endColumn": 24, "problem": "InterOpConvertImport", "suggest": "", @@ -215,9 +215,9 @@ "severity": "ERROR" }, { - "line": 41, + "line": 40, "column": 8, - "endLine": 41, + "endLine": 40, "endColumn": 34, "problem": "InterOpConvertImport", "suggest": "", 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 b49b275bb5..f2a8c5c3a4 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 18, + "line": 17, "column": 2, - "endLine": 18, + "endLine": 17, "endColumn": 106, "problem": "ImportAfterStatement", "suggest": "", @@ -25,28 +25,28 @@ "severity": "ERROR" }, { - "line": 18, + "line": 17, "column": 2, - "endLine": 18, + "endLine": 17, "endColumn": 106, "problem": "InterOpImportJs", "autofix": [ { - "start": 649, - "end": 753, + "start": 636, + "end": 740, "replacementText": "", - "line": 18, + "line": 17, "column": 2, - "endLine": 18, + "endLine": 17, "endColumn": 106 }, { - "start": 753, - "end": 753, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_convert_import_js.js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\nlet foo2 = GeneratedImportVar_1.getPropertyByName('foo2');\nlet foo3 = GeneratedImportVar_1.getPropertyByName('foo3');\nlet foo4 = GeneratedImportVar_1.getPropertyByName('foo4');\nlet array_val = GeneratedImportVar_1.getPropertyByName('array_val');\nlet null_val = GeneratedImportVar_1.getPropertyByName('null_val');\nlet undefined_val = GeneratedImportVar_1.getPropertyByName('undefined_val');\n", - "line": 18, + "start": 740, + "end": 740, + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_convert_import_js.js');\r\nlet foo = GeneratedImportVar_1.getProperty('foo');\r\nlet foo2 = GeneratedImportVar_1.getProperty('foo2');\r\nlet foo3 = GeneratedImportVar_1.getProperty('foo3');\r\nlet foo4 = GeneratedImportVar_1.getProperty('foo4');\r\nlet array_val = GeneratedImportVar_1.getProperty('array_val');\r\nlet null_val = GeneratedImportVar_1.getProperty('null_val');\r\nlet undefined_val = GeneratedImportVar_1.getProperty('undefined_val');\r\n", + "line": 17, "column": 2, - "endLine": 18, + "endLine": 17, "endColumn": 106 } ], @@ -55,19 +55,19 @@ "severity": "ERROR" }, { - "line": 20, + "line": 19, "column": 18, - "endLine": 20, + "endLine": 19, "endColumn": 35, "problem": "InterOpConvertImport", "autofix": [ { - "start": 774, - "end": 791, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", - "line": 20, + "start": 761, + "end": 778, + "replacementText": "foo.getProperty(\"num\").toNumber()", + "line": 19, "column": 18, - "endLine": 20, + "endLine": 19, "endColumn": 35 } ], @@ -76,19 +76,19 @@ "severity": "ERROR" }, { - "line": 20, + "line": 19, "column": 18, - "endLine": 20, + "endLine": 19, "endColumn": 25, "problem": "InteropObjectProperty", "autofix": [ { - "start": 774, - "end": 781, - "replacementText": "foo.getPropertyByName(\"num\")", - "line": 20, + "start": 761, + "end": 768, + "replacementText": "foo.getProperty(\"num\")", + "line": 19, "column": 18, - "endLine": 20, + "endLine": 19, "endColumn": 25 } ], @@ -97,19 +97,19 @@ "severity": "ERROR" }, { - "line": 21, + "line": 20, "column": 20, - "endLine": 21, + "endLine": 20, "endColumn": 41, "problem": "InterOpConvertImport", "autofix": [ { - "start": 812, - "end": 833, - "replacementText": "foo2.getPropertyByName(\"bool\").toBoolean()", - "line": 21, + "start": 799, + "end": 820, + "replacementText": "foo2.getProperty(\"bool\").toBoolean()", + "line": 20, "column": 20, - "endLine": 21, + "endLine": 20, "endColumn": 41 } ], @@ -118,19 +118,19 @@ "severity": "ERROR" }, { - "line": 21, + "line": 20, "column": 20, - "endLine": 21, + "endLine": 20, "endColumn": 29, "problem": "InteropObjectProperty", "autofix": [ { - "start": 812, - "end": 821, - "replacementText": "foo2.getPropertyByName(\"bool\")", - "line": 21, + "start": 799, + "end": 808, + "replacementText": "foo2.getProperty(\"bool\")", + "line": 20, "column": 20, - "endLine": 21, + "endLine": 20, "endColumn": 29 } ], @@ -139,19 +139,19 @@ "severity": "ERROR" }, { - "line": 22, + "line": 21, "column": 19, - "endLine": 22, + "endLine": 21, "endColumn": 38, "problem": "InterOpConvertImport", "autofix": [ { - "start": 853, - "end": 872, - "replacementText": "foo3.getPropertyByName(\"str\").toString()", - "line": 22, + "start": 840, + "end": 859, + "replacementText": "foo3.getProperty(\"str\").toString()", + "line": 21, "column": 19, - "endLine": 22, + "endLine": 21, "endColumn": 38 } ], @@ -160,19 +160,19 @@ "severity": "ERROR" }, { - "line": 22, + "line": 21, "column": 19, - "endLine": 22, + "endLine": 21, "endColumn": 27, "problem": "InteropObjectProperty", "autofix": [ { - "start": 853, - "end": 861, - "replacementText": "foo3.getPropertyByName(\"str\")", - "line": 22, + "start": 840, + "end": 848, + "replacementText": "foo3.getProperty(\"str\")", + "line": 21, "column": 19, - "endLine": 22, + "endLine": 21, "endColumn": 27 } ], @@ -181,19 +181,19 @@ "severity": "ERROR" }, { - "line": 23, + "line": 22, "column": 19, - "endLine": 23, + "endLine": 22, "endColumn": 38, "problem": "InterOpConvertImport", "autofix": [ { - "start": 892, - "end": 911, - "replacementText": "foo4.getPropertyByName(\"big\").toBigInt()", - "line": 23, + "start": 879, + "end": 898, + "replacementText": "foo4.getProperty(\"big\").toBigInt()", + "line": 22, "column": 19, - "endLine": 23, + "endLine": 22, "endColumn": 38 } ], @@ -202,19 +202,19 @@ "severity": "ERROR" }, { - "line": 23, + "line": 22, "column": 19, - "endLine": 23, + "endLine": 22, "endColumn": 27, "problem": "InteropObjectProperty", "autofix": [ { - "start": 892, - "end": 900, - "replacementText": "foo4.getPropertyByName(\"big\")", - "line": 23, + "start": 879, + "end": 887, + "replacementText": "foo4.getProperty(\"big\")", + "line": 22, "column": 19, - "endLine": 23, + "endLine": 22, "endColumn": 27 } ], @@ -223,9 +223,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 9, - "endLine": 26, + "endLine": 25, "endColumn": 27, "problem": "InterOpConvertImport", "suggest": "", @@ -233,9 +233,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 44, - "endLine": 26, + "endLine": 25, "endColumn": 62, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -243,19 +243,19 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 54, - "endLine": 26, + "endLine": 25, "endColumn": 55, "problem": "NumericSemantics", "autofix": [ { - "start": 994, - "end": 995, + "start": 981, + "end": 982, "replacementText": "1.0", - "line": 26, + "line": 25, "column": 54, - "endLine": 26, + "endLine": 25, "endColumn": 55 } ], @@ -264,19 +264,19 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 57, - "endLine": 26, + "endLine": 25, "endColumn": 58, "problem": "NumericSemantics", "autofix": [ { - "start": 997, - "end": 998, + "start": 984, + "end": 985, "replacementText": "2.0", - "line": 26, + "line": 25, "column": 57, - "endLine": 26, + "endLine": 25, "endColumn": 58 } ], @@ -285,19 +285,19 @@ "severity": "ERROR" }, { - "line": 26, + "line": 25, "column": 60, - "endLine": 26, + "endLine": 25, "endColumn": 61, "problem": "NumericSemantics", "autofix": [ { - "start": 1000, - "end": 1001, + "start": 987, + "end": 988, "replacementText": "3.0", - "line": 26, + "line": 25, "column": 60, - "endLine": 26, + "endLine": 25, "endColumn": 61 } ], @@ -306,9 +306,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 9, - "endLine": 31, + "endLine": 30, "endColumn": 30, "problem": "InterOpConvertImport", "suggest": "", @@ -316,19 +316,19 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 48, - "endLine": 31, + "endLine": 30, "endColumn": 49, "problem": "NumericSemantics", "autofix": [ { - "start": 1208, - "end": 1209, + "start": 1195, + "end": 1196, "replacementText": "1.0", - "line": 31, + "line": 30, "column": 48, - "endLine": 31, + "endLine": 30, "endColumn": 49 } ], @@ -337,19 +337,19 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 50, - "endLine": 31, + "endLine": 30, "endColumn": 51, "problem": "NumericSemantics", "autofix": [ { - "start": 1210, - "end": 1211, + "start": 1197, + "end": 1198, "replacementText": "2.0", - "line": 31, + "line": 30, "column": 50, - "endLine": 31, + "endLine": 30, "endColumn": 51 } ], @@ -358,19 +358,19 @@ "severity": "ERROR" }, { - "line": 31, + "line": 30, "column": 52, - "endLine": 31, + "endLine": 30, "endColumn": 53, "problem": "NumericSemantics", "autofix": [ { - "start": 1212, - "end": 1213, + "start": 1199, + "end": 1200, "replacementText": "3.0", - "line": 31, + "line": 30, "column": 52, - "endLine": 31, + "endLine": 30, "endColumn": 53 } ], @@ -379,9 +379,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 35, "column": 8, - "endLine": 36, + "endLine": 35, "endColumn": 24, "problem": "InterOpConvertImport", "suggest": "", @@ -389,9 +389,9 @@ "severity": "ERROR" }, { - "line": 41, + "line": 40, "column": 8, - "endLine": 41, + "endLine": 40, "endColumn": 34, "problem": "InterOpConvertImport", "suggest": "", diff --git a/ets2panda/linter/test/interop/interop_convert_import.ets.json b/ets2panda/linter/test/interop/interop_convert_import.ets.json index 5a3f5938e4..98f171cc32 100755 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 18, + "line": 17, "column": 2, - "endLine": 18, + "endLine": 17, "endColumn": 106, "problem": "ImportAfterStatement", "suggest": "", 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 1e107cf338..2c49f3dc58 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.ets @@ -1,4 +1,3 @@ -<<<<<<< HEAD /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,20 +14,20 @@ */ 'use static' - let GeneratedImportVar_1 = ESValue.load('./interop_convert_import_js.js'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); -let foo2 = GeneratedImportVar_1.getPropertyByName('foo2'); -let foo3 = GeneratedImportVar_1.getPropertyByName('foo3'); -let foo4 = GeneratedImportVar_1.getPropertyByName('foo4'); -let array_val = GeneratedImportVar_1.getPropertyByName('array_val'); -let null_val = GeneratedImportVar_1.getPropertyByName('null_val'); -let undefined_val = GeneratedImportVar_1.getPropertyByName('undefined_val'); + let GeneratedImportVar_1 = ESValue.load('./interop_convert_import_js.js'); +let foo = GeneratedImportVar_1.getProperty('foo'); +let foo2 = GeneratedImportVar_1.getProperty('foo2'); +let foo3 = GeneratedImportVar_1.getProperty('foo3'); +let foo4 = GeneratedImportVar_1.getProperty('foo4'); +let array_val = GeneratedImportVar_1.getProperty('array_val'); +let null_val = GeneratedImportVar_1.getProperty('null_val'); +let undefined_val = GeneratedImportVar_1.getProperty('undefined_val'); - let a: number = foo.getPropertyByName("num").toNumber() - let a1: boolean = foo2.getPropertyByName("bool").toBoolean() - let a2: string = foo3.getPropertyByName("str").toString() - let a3: bigint = foo4.getPropertyByName("big").toBigInt() + let a: number = foo.getProperty("num").toNumber() + let a1: boolean = foo2.getProperty("bool").toBoolean() + let a2: string = foo3.getProperty("str").toString() + let a3: bigint = foo4.getProperty("big").toBigInt() test_helper.test(() => { return (array_val as Array).toString() === new Array(1.0, 2.0, 3.0).toString();// 扫描出 arkts-interop-js2s-convert-js-type - no pass @@ -47,27 +46,4 @@ return null_val as null === null;// 扫描出 arkts-interop-js2s-convert-js-type // convert type - undefined test_helper.test(() => { return undefined_val as undefined === undefined; // 扫描出 arkts-interop-js2s-convert-js-type - no pass -}, "undefined_val as undefined === undefined"); -======= -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 {foo, foo2, foo3, foo4} from "./interop_convert_import_js.js" - - let a: number = foo.num as number - let a: boolean = foo2.bool as boolean - let a: string = foo3.str as string - let a: bigint = foo4.big as bigint" ->>>>>>> efeb0a81e (modify use static spec) +}, "undefined_val as undefined === undefined"); 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 a49b70a952..52e07c8a2b 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json @@ -15,20 +15,30 @@ ], "result": [ { - "line": 18, + "line": 17, "column": 6, - "endLine": 18, + "endLine": 17, "endColumn": 75, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, + { + "line": 18, + "column": 5, + "endLine": 18, + "endColumn": 50, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, { "line": 19, "column": 5, "endLine": 19, - "endColumn": 56, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +48,7 @@ "line": 20, "column": 5, "endLine": 20, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +58,7 @@ "line": 21, "column": 5, "endLine": 21, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -58,7 +68,7 @@ "line": 22, "column": 5, "endLine": 22, - "endColumn": 58, + "endColumn": 62, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +78,7 @@ "line": 23, "column": 5, "endLine": 23, - "endColumn": 68, + "endColumn": 60, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -78,26 +88,16 @@ "line": 24, "column": 5, "endLine": 24, - "endColumn": 66, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 5, - "endLine": 25, - "endColumn": 76, + "endColumn": 70, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 34, + "line": 33, "column": 44, - "endLine": 34, + "endLine": 33, "endColumn": 68, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 44, + "line": 43, "column": 8, - "endLine": 44, + "endLine": 43, "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 7145a50507..3f22cfc7bf 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 656, "end": 656, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_equality_judgment_js');\nlet a = GeneratedImportVar_1.getPropertyByName('a');\nlet b = GeneratedImportVar_1.getPropertyByName('b');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_equality_judgment_js');\nlet a = GeneratedImportVar_1.getProperty('a');\nlet b = GeneratedImportVar_1.getProperty('b');\n", "line": 16, "column": 1, "endLine": 16, 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 796cf7f898..9a2c6e2cab 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets @@ -14,8 +14,8 @@ */ let GeneratedImportVar_1 = ESValue.load('./interop_equality_judgment_js'); -let a = GeneratedImportVar_1.getPropertyByName('a'); -let b = GeneratedImportVar_1.getPropertyByName('b'); +let a = GeneratedImportVar_1.getProperty('a'); +let b = GeneratedImportVar_1.getProperty('b'); a.areEqual(b) !a.areEqual(b) diff --git a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json index c3d33e531c..38e88ae0b6 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json @@ -28,7 +28,7 @@ "line": 17, "column": 5, "endLine": 17, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 18, "column": 5, "endLine": 18, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", diff --git a/ets2panda/linter/test/interop/interop_export_js_rules.ets b/ets2panda/linter/test/interop/interop_export_js_rules.ets index e729a7c2c3..3ab29fe81d 100644 --- a/ets2panda/linter/test/interop/interop_export_js_rules.ets +++ b/ets2panda/linter/test/interop/interop_export_js_rules.ets @@ -19,10 +19,6 @@ export {ff1} // imported from js. Error is shown export { ff2 } from "./interop_import_js_rules_js" // ff2 is imported from js. Error is shown -export { MyDecorator } from "./oh_modules/ets_decorator" // MyDecorator is imported from arkts1. Error is shown - export { foo as bar } from "./oh_modules/reflect_export" // foo is imported from arkts1.2. No error. -export * as namespace1 from "./oh_modules/ets_decorator" - export * as namespace2 from "./interop_import_js_rules_js" diff --git a/ets2panda/linter/test/interop/interop_export_js_rules.ets.arkts2.json b/ets2panda/linter/test/interop/interop_export_js_rules.ets.arkts2.json index 1f92c538cd..827762e0bf 100644 --- a/ets2panda/linter/test/interop/interop_export_js_rules.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_export_js_rules.ets.arkts2.json @@ -1,88 +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": 1, - "endLine": 16, - "endColumn": 51, - "problem": "InterOpImportJs", - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 13, - "problem": "InteropJsObjectExport", - "suggest": "", - "rule": "Direct export of interop JS objects is not supported (arkts-interop-js2s-export-js)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 51, - "problem": "InteropJsObjectExport", - "suggest": "", - "rule": "Direct export of interop JS objects is not supported (arkts-interop-js2s-export-js)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 57, - "problem": "InteropArkTs1ObjectExport", - "suggest": "", - "rule": "Direct export of interop ArkTS1.0 objects is not supported (arkts-interop-d2s-export-entity)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 57, - "problem": "InteropArkTs1ObjectExport", - "suggest": "", - "rule": "Direct export of interop ArkTS1.0 objects is not supported (arkts-interop-d2s-export-entity)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 1, - "endLine": 26, - "endColumn": 57, - "problem": "InteropArkTs1ObjectExport", - "suggest": "", - "rule": "Direct export of interop ArkTS1.0 objects is not supported (arkts-interop-d2s-export-entity)", - "severity": "ERROR" - }, - { - "line": 28, - "column": 1, - "endLine": 28, - "endColumn": 59, - "problem": "InteropJsObjectExport", - "suggest": "", - "rule": "Direct export of interop JS objects is not supported (arkts-interop-js2s-export-js)", - "severity": "ERROR" - } - ] -} \ No newline at end of file + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT 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": 1, + "endLine": 16, + "endColumn": 51, + "problem": "InterOpImportJs", + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 13, + "problem": "InteropJsObjectExport", + "suggest": "", + "rule": "Direct export of interop JS objects is not supported (arkts-interop-js2s-export-js)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 51, + "problem": "InteropJsObjectExport", + "suggest": "", + "rule": "Direct export of interop JS objects is not supported (arkts-interop-js2s-export-js)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 59, + "problem": "InteropJsObjectExport", + "suggest": "", + "rule": "Direct export of interop JS objects is not supported (arkts-interop-js2s-export-js)", + "severity": "ERROR" + } + ] +} 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 bda0908dba..2a3dec941a 100755 --- a/ets2panda/linter/test/interop/interop_import_js.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js.ets.autofix.json @@ -33,7 +33,7 @@ { "start": 958, "end": 958, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('../main/js_lib');\nlet Cjs = GeneratedImportVar_1.getPropertyByName('Cjs');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('../main/js_lib');\nlet Cjs = GeneratedImportVar_1.getProperty('Cjs');\n", "line": 16, "column": 1, "endLine": 16, @@ -63,7 +63,7 @@ { "start": 958, "end": 958, - "replacementText": "let GeneratedImportVar_2 = ESValue.load('../main/js_lib');\nlet fjs = GeneratedImportVar_2.getPropertyByName('fjs');\n", + "replacementText": "let GeneratedImportVar_2 = ESValue.load('../main/js_lib');\nlet fjs = GeneratedImportVar_2.getProperty('fjs');\n", "line": 17, "column": 1, "endLine": 17, @@ -93,7 +93,7 @@ { "start": 958, "end": 958, - "replacementText": "let GeneratedImportVar_3 = ESValue.load('./jsfiles/preview_import_js');\nlet CPreview = GeneratedImportVar_3.getPropertyByName('CPreview');\nlet bar = GeneratedImportVar_3.getPropertyByName('bar');\nlet foo = GeneratedImportVar_3.getPropertyByName('foo');\n", + "replacementText": "let GeneratedImportVar_3 = ESValue.load('./jsfiles/preview_import_js');\nlet CPreview = GeneratedImportVar_3.getProperty('CPreview');\nlet bar = GeneratedImportVar_3.getProperty('bar');\nlet foo = GeneratedImportVar_3.getProperty('foo');\n", "line": 18, "column": 1, "endLine": 18, @@ -123,7 +123,7 @@ { "start": 958, "end": 958, - "replacementText": "let GeneratedImportVar_4 = ESValue.load('./interop_import_js_js');\nlet myAaa = GeneratedImportVar_4.getPropertyByName('aaa');\n", + "replacementText": "let GeneratedImportVar_4 = ESValue.load('./interop_import_js_js');\nlet myAaa = GeneratedImportVar_4.getProperty('aaa');\n", "line": 19, "column": 1, "endLine": 19, @@ -153,7 +153,7 @@ { "start": 958, "end": 958, - "replacementText": "let GeneratedImportVar_5 = ESValue.load('./interop_import_js_js');\nlet myAaa = GeneratedImportVar_5.getPropertyByName('aaa');\nlet ClassA = GeneratedImportVar_5.getPropertyByName('ClassA');\nlet Dog = GeneratedImportVar_5.getPropertyByName('Dog');\n", + "replacementText": "let GeneratedImportVar_5 = ESValue.load('./interop_import_js_js');\nlet myAaa = GeneratedImportVar_5.getProperty('aaa');\nlet ClassA = GeneratedImportVar_5.getProperty('ClassA');\nlet Dog = GeneratedImportVar_5.getProperty('Dog');\n", "line": 20, "column": 1, "endLine": 20, @@ -213,7 +213,7 @@ { "start": 958, "end": 958, - "replacementText": "let GeneratedImportVar_7 = ESValue.load('./interop_import_js_js');\nlet Wiki = GeneratedImportVar_7.getPropertyByName('Wiki');\nlet Doge = GeneratedImportVar_7.getPropertyByName('Dog');\n", + "replacementText": "let GeneratedImportVar_7 = ESValue.load('./interop_import_js_js');\nlet Wiki = GeneratedImportVar_7.getProperty('Wiki');\nlet Doge = GeneratedImportVar_7.getProperty('Dog');\n", "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 80f88726e3..851b32fdc0 100644 --- a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.ets @@ -20,20 +20,20 @@ let GeneratedImportVar_7 = ESValue.load('./interop_import_js_js'); -let Wiki = GeneratedImportVar_7.getPropertyByName('Wiki'); -let Doge = GeneratedImportVar_7.getPropertyByName('Dog'); +let Wiki = GeneratedImportVar_7.getProperty('Wiki'); +let Doge = GeneratedImportVar_7.getProperty('Dog'); let GeneratedImportVar_6 = ESValue.load('./interop_import_js_js'); let GeneratedImportVar_5 = ESValue.load('./interop_import_js_js'); -let myAaa = GeneratedImportVar_5.getPropertyByName('aaa'); -let ClassA = GeneratedImportVar_5.getPropertyByName('ClassA'); -let Dog = GeneratedImportVar_5.getPropertyByName('Dog'); +let myAaa = GeneratedImportVar_5.getProperty('aaa'); +let ClassA = GeneratedImportVar_5.getProperty('ClassA'); +let Dog = GeneratedImportVar_5.getProperty('Dog'); let GeneratedImportVar_4 = ESValue.load('./interop_import_js_js'); -let myAaa = GeneratedImportVar_4.getPropertyByName('aaa'); +let myAaa = GeneratedImportVar_4.getProperty('aaa'); let GeneratedImportVar_3 = ESValue.load('./jsfiles/preview_import_js'); -let CPreview = GeneratedImportVar_3.getPropertyByName('CPreview'); -let bar = GeneratedImportVar_3.getPropertyByName('bar'); -let foo = GeneratedImportVar_3.getPropertyByName('foo'); +let CPreview = GeneratedImportVar_3.getProperty('CPreview'); +let bar = GeneratedImportVar_3.getProperty('bar'); +let foo = GeneratedImportVar_3.getProperty('foo'); let GeneratedImportVar_2 = ESValue.load('../main/js_lib'); -let fjs = GeneratedImportVar_2.getPropertyByName('fjs'); +let fjs = GeneratedImportVar_2.getProperty('fjs'); let GeneratedImportVar_1 = ESValue.load('../main/js_lib'); -let Cjs = GeneratedImportVar_1.getPropertyByName('Cjs'); +let Cjs = GeneratedImportVar_1.getProperty('Cjs'); 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 c422eb1668..d46fff44ee 100644 --- a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json @@ -28,7 +28,7 @@ "line": 23, "column": 5, "endLine": 23, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 24, "column": 5, "endLine": 24, - "endColumn": 57, + "endColumn": 51, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 27, "column": 5, "endLine": 27, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -78,7 +78,7 @@ "line": 28, "column": 5, "endLine": 28, - "endColumn": 62, + "endColumn": 56, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -88,7 +88,7 @@ "line": 29, "column": 5, "endLine": 29, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -108,7 +108,7 @@ "line": 31, "column": 5, "endLine": 31, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -128,7 +128,7 @@ "line": 33, "column": 5, "endLine": 33, - "endColumn": 66, + "endColumn": 60, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -138,7 +138,7 @@ "line": 34, "column": 5, "endLine": 34, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -148,7 +148,7 @@ "line": 35, "column": 5, "endLine": 35, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -168,7 +168,7 @@ "line": 37, "column": 5, "endLine": 37, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -188,7 +188,7 @@ "line": 39, "column": 5, "endLine": 39, - "endColumn": 56, + "endColumn": 50, "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 2b90e5d9f0..baf465561b 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 GeneratedImportVar_1 = ESValue.load('./interop_import_js_compare_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\nlet m = GeneratedImportVar_1.getPropertyByName('m');\nlet n = GeneratedImportVar_1.getPropertyByName('n');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_compare_js');\nlet foo = GeneratedImportVar_1.getProperty('foo');\nlet m = GeneratedImportVar_1.getProperty('m');\nlet n = GeneratedImportVar_1.getProperty('n');\n", "line": 17, "column": 1, "endLine": 17, @@ -54,7 +54,7 @@ { "start": 672, "end": 677, - "replacementText": "foo.getPropertyByName(\"a\")", + "replacementText": "foo.getProperty(\"a\")", "line": 18, "column": 9, "endLine": 18, @@ -75,7 +75,7 @@ { "start": 686, "end": 691, - "replacementText": "foo.getPropertyByName(\"b\")", + "replacementText": "foo.getProperty(\"b\")", "line": 19, "column": 9, "endLine": 19, @@ -96,7 +96,7 @@ { "start": 672, "end": 677, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 20, "column": 1, "endLine": 20, @@ -117,7 +117,7 @@ { "start": 686, "end": 691, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 20, "column": 5, "endLine": 20, @@ -138,7 +138,7 @@ { "start": 672, "end": 677, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 21, "column": 1, "endLine": 21, @@ -159,7 +159,7 @@ { "start": 686, "end": 691, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 21, "column": 5, "endLine": 21, @@ -180,7 +180,7 @@ { "start": 672, "end": 677, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 22, "column": 1, "endLine": 22, @@ -201,7 +201,7 @@ { "start": 686, "end": 691, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 22, "column": 6, "endLine": 22, @@ -222,7 +222,7 @@ { "start": 672, "end": 677, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 23, "column": 1, "endLine": 23, @@ -243,7 +243,7 @@ { "start": 686, "end": 691, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 23, "column": 6, "endLine": 23, @@ -546,7 +546,7 @@ { "start": 881, "end": 886, - "replacementText": "foo.getPropertyByName(\"a\").toNumber()", + "replacementText": "foo.getProperty(\"a\").toNumber()", "line": 43, "column": 1, "endLine": 43, @@ -567,7 +567,7 @@ { "start": 889, "end": 894, - "replacementText": "foo.getPropertyByName(\"b\").toNumber()", + "replacementText": "foo.getProperty(\"b\").toNumber()", "line": 43, "column": 9, "endLine": 43, @@ -588,7 +588,7 @@ { "start": 881, "end": 886, - "replacementText": "foo.getPropertyByName(\"a\")", + "replacementText": "foo.getProperty(\"a\")", "line": 43, "column": 1, "endLine": 43, @@ -609,7 +609,7 @@ { "start": 889, "end": 894, - "replacementText": "foo.getPropertyByName(\"b\")", + "replacementText": "foo.getProperty(\"b\")", "line": 43, "column": 9, "endLine": 43, 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 76633c942c..3e99265ba8 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 @@ -15,12 +15,12 @@ let GeneratedImportVar_1 = ESValue.load('./interop_import_js_compare_js'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); -let m = GeneratedImportVar_1.getPropertyByName('m'); -let n = GeneratedImportVar_1.getPropertyByName('n'); +let foo = GeneratedImportVar_1.getProperty('foo'); +let m = GeneratedImportVar_1.getProperty('m'); +let n = GeneratedImportVar_1.getProperty('n'); -let a = foo.getPropertyByName("a") -let b = foo.getPropertyByName("b") +let a = foo.getProperty("a") +let b = foo.getProperty("b") a > b a < b a >= b @@ -48,4 +48,4 @@ x2 < y2; x2 >= y2; x2 <= y2; -foo.getPropertyByName("a").toNumber() > foo.getPropertyByName("b").toNumber(); \ No newline at end of file +foo.getProperty("a").toNumber() > foo.getProperty("b").toNumber(); \ No newline at end of file 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 0ccdec1005..680e681f88 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 @@ -28,7 +28,7 @@ "line": 18, "column": 5, "endLine": 18, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 19, "column": 5, "endLine": 19, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +48,7 @@ "line": 20, "column": 5, "endLine": 20, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -58,7 +58,7 @@ "line": 22, "column": 5, "endLine": 22, - "endColumn": 35, + "endColumn": 29, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 23, "column": 5, "endLine": 23, - "endColumn": 35, + "endColumn": 29, "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_index.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json index c9d2b8aee7..7e7407ab2d 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 @@ -33,7 +33,7 @@ { "start": 703, "end": 703, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_rules_js');\nlet ff3 = GeneratedImportVar_1.getPropertyByName('ff3');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_rules_js');\nlet ff3 = GeneratedImportVar_1.getProperty('ff3');\n", "line": 15, "column": 1, "endLine": 15, @@ -63,7 +63,7 @@ { "start": 703, "end": 703, - "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_index_js');\nlet foo = GeneratedImportVar_2.getPropertyByName('foo');\n", + "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_index_js');\nlet foo = GeneratedImportVar_2.getProperty('foo');\n", "line": 16, "column": 1, "endLine": 16, @@ -84,7 +84,7 @@ { "start": 714, "end": 721, - "replacementText": "foo.getPropertyByName(\"arr\")", + "replacementText": "foo.getProperty(\"arr\")", "line": 17, "column": 11, "endLine": 17, @@ -115,7 +115,7 @@ { "start": 722, "end": 728, - "replacementText": "arr.getPropertyByIndex(1)", + "replacementText": "arr.getProperty(1)", "line": 18, "column": 1, "endLine": 18, @@ -146,7 +146,7 @@ { "start": 729, "end": 739, - "replacementText": "arr.setPropertyByIndex(3, ESValue.wrap(4))", + "replacementText": "arr.setProperty(3, ESValue.wrap(4))", "line": 19, "column": 1, "endLine": 19, @@ -188,7 +188,7 @@ { "start": 752, "end": 759, - "replacementText": "ff3.getPropertyByName(\"arr\")", + "replacementText": "ff3.getProperty(\"arr\")", "line": 21, "column": 12, "endLine": 21, @@ -209,7 +209,7 @@ { "start": 770, "end": 781, - "replacementText": "arr1.getPropertyByName(\"length\")", + "replacementText": "arr1.getProperty(\"length\")", "line": 22, "column": 11, "endLine": 22, @@ -272,7 +272,7 @@ { "start": 812, "end": 823, - "replacementText": "arr1.getPropertyByName(\"length\")", + "replacementText": "arr1.getProperty(\"length\")", "line": 23, "column": 21, "endLine": 23, @@ -291,7 +291,7 @@ "problem": "InteropJsObjectTraverseJsInstance", "autofix": [ { - "replacementText": "arr1.getPropertyByIndex(i).toNumber()", + "replacementText": "arr1.getProperty(i).toNumber()", "start": 848, "end": 855, "line": 24, @@ -314,7 +314,7 @@ { "start": 848, "end": 855, - "replacementText": "arr1.getPropertyByIndex(i)", + "replacementText": "arr1.getProperty(i)", "line": 24, "column": 17, "endLine": 24, @@ -333,7 +333,7 @@ "problem": "InteropJsObjectTraverseJsInstance", "autofix": [ { - "replacementText": "arr1.getPropertyByIndex(i).toNumber()", + "replacementText": "arr1.getProperty(i).toNumber()", "start": 882, "end": 889, "line": 25, @@ -356,7 +356,7 @@ { "start": 882, "end": 889, - "replacementText": "arr1.getPropertyByIndex(i)", + "replacementText": "arr1.getProperty(i)", "line": 25, "column": 13, "endLine": 25, @@ -375,7 +375,7 @@ "problem": "InteropJsObjectTraverseJsInstance", "autofix": [ { - "replacementText": "arr1.setPropertyByIndex(i, ESValue.wrap(0 //error\n))", + "replacementText": "arr1.setProperty(i, ESValue.wrap(0 //error\n))", "start": 903, "end": 914, "line": 26, @@ -398,7 +398,7 @@ { "start": 903, "end": 914, - "replacementText": "arr1.setPropertyByIndex(i, ESValue.wrap(0))", + "replacementText": "arr1.setProperty(i, ESValue.wrap(0))", "line": 26, "column": 5, "endLine": 26, @@ -438,7 +438,7 @@ "problem": "InteropJsObjectTraverseJsInstance", "autofix": [ { - "replacementText": "arr1.getPropertyByIndex(i).toNumber()", + "replacementText": "arr1.getProperty(i).toNumber()", "start": 940, "end": 947, "line": 27, @@ -461,7 +461,7 @@ { "start": 940, "end": 947, - "replacementText": "arr1.getPropertyByIndex(i)", + "replacementText": "arr1.getProperty(i)", "line": 27, "column": 17, "endLine": 27, 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 8e707c2f67..d26adb726f 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 @@ -14,22 +14,22 @@ */ let GeneratedImportVar_2 = ESValue.load('./interop_import_js_index_js'); -let foo = GeneratedImportVar_2.getPropertyByName('foo'); +let foo = GeneratedImportVar_2.getProperty('foo'); let GeneratedImportVar_1 = ESValue.load('./interop_import_js_rules_js'); -let ff3 = GeneratedImportVar_1.getPropertyByName('ff3'); +let ff3 = GeneratedImportVar_1.getProperty('ff3'); -let arr = foo.getPropertyByName("arr") -arr.getPropertyByIndex(1.0) -arr.setPropertyByIndex(3.0, ESValue.wrap(4.0)) +let arr = foo.getProperty("arr") +arr.getProperty(1.0) +arr.setProperty(3.0, ESValue.wrap(4.0)) -let arr1 = ff3.getPropertyByName("arr") -let len: number = arr1.getPropertyByName("length") as number -for (let i: number = 0.0; i < arr1.getPropertyByName("length"); ++i) { - console.log(arr1.getPropertyByIndex(i).toNumber()+''); //error - let x = arr1.getPropertyByIndex(i).toNumber() //error - arr1.setPropertyByIndex(i, ESValue.wrap(0.0 //error +let arr1 = ff3.getProperty("arr") +let len: number = arr1.getProperty("length") as number +for (let i: number = 0.0; i < arr1.getProperty("length"); ++i) { + console.log(arr1.getProperty(i).toNumber()+''); //error + let x = arr1.getProperty(i).toNumber() //error + arr1.setProperty(i, ESValue.wrap(0.0 //error )) //error - console.log(arr1.getPropertyByIndex(i).toNumber()+''); //error + console.log(arr1.getProperty(i).toNumber()+''); //error } for (let element of arr1) { //error 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 526bcedf9d..f816c83809 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 @@ -28,7 +28,7 @@ "line": 17, "column": 5, "endLine": 17, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +48,7 @@ "line": 19, "column": 5, "endLine": 19, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -58,7 +58,7 @@ "line": 21, "column": 5, "endLine": 21, - "endColumn": 39, + "endColumn": 33, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 25, "column": 5, "endLine": 25, - "endColumn": 40, + "endColumn": 34, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -78,7 +78,7 @@ "line": 29, "column": 9, "endLine": 29, - "endColumn": 50, + "endColumn": 43, "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_rules.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json index b44bc6c370..58320d2ba5 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 @@ -43,7 +43,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_rules_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_rules_js');\nlet foo = GeneratedImportVar_1.getProperty('foo');\n", "line": 17, "column": 1, "endLine": 17, @@ -83,7 +83,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_rules_js');\nlet ff1 = GeneratedImportVar_2.getPropertyByName('ff1');\nlet ff2 = GeneratedImportVar_2.getPropertyByName('ff2');\n", + "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_rules_js');\nlet ff1 = GeneratedImportVar_2.getProperty('ff1');\nlet ff2 = GeneratedImportVar_2.getProperty('ff2');\n", "line": 18, "column": 1, "endLine": 18, @@ -123,7 +123,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_3 = ESValue.load('./interop_import_js_rules_js');\nlet A = GeneratedImportVar_3.getPropertyByName('A');\n", + "replacementText": "let GeneratedImportVar_3 = ESValue.load('./interop_import_js_rules_js');\nlet A = GeneratedImportVar_3.getProperty('A');\n", "line": 20, "column": 1, "endLine": 20, @@ -163,7 +163,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_4 = ESValue.load('./interop_import_js_rules_js');\nlet C = GeneratedImportVar_4.getPropertyByName('C');\n", + "replacementText": "let GeneratedImportVar_4 = ESValue.load('./interop_import_js_rules_js');\nlet C = GeneratedImportVar_4.getProperty('C');\n", "line": 21, "column": 1, "endLine": 21, @@ -203,7 +203,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_5 = ESValue.load('./interop_import_js_rules_js');\nlet ff3 = GeneratedImportVar_5.getPropertyByName('ff3');\n", + "replacementText": "let GeneratedImportVar_5 = ESValue.load('./interop_import_js_rules_js');\nlet ff3 = GeneratedImportVar_5.getProperty('ff3');\n", "line": 23, "column": 1, "endLine": 23, @@ -243,7 +243,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_6 = ESValue.load('./interop_import_js_rules_js');\nlet ff4 = GeneratedImportVar_6.getPropertyByName('ff4');\n", + "replacementText": "let GeneratedImportVar_6 = ESValue.load('./interop_import_js_rules_js');\nlet ff4 = GeneratedImportVar_6.getProperty('ff4');\n", "line": 25, "column": 1, "endLine": 25, @@ -283,7 +283,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_7 = ESValue.load('./interop_import_js_rules_js');\nlet handle = GeneratedImportVar_7.getPropertyByName('handle');\n", + "replacementText": "let GeneratedImportVar_7 = ESValue.load('./interop_import_js_rules_js');\nlet handle = GeneratedImportVar_7.getProperty('handle');\n", "line": 27, "column": 1, "endLine": 27, @@ -323,7 +323,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_8 = ESValue.load('./interop_import_js_rules_js');\nlet expand = GeneratedImportVar_8.getPropertyByName('expand');\n", + "replacementText": "let GeneratedImportVar_8 = ESValue.load('./interop_import_js_rules_js');\nlet expand = GeneratedImportVar_8.getProperty('expand');\n", "line": 29, "column": 1, "endLine": 29, @@ -363,7 +363,7 @@ { "start": 1092, "end": 1092, - "replacementText": "let GeneratedImportVar_9 = ESValue.load('./interop_import_js_rules_js');\nlet orange = GeneratedImportVar_9.getPropertyByName('orange');\n", + "replacementText": "let GeneratedImportVar_9 = ESValue.load('./interop_import_js_rules_js');\nlet orange = GeneratedImportVar_9.getProperty('orange');\n", "line": 30, "column": 1, "endLine": 30, @@ -384,7 +384,7 @@ { "start": 1098, "end": 1108, - "replacementText": "foo.getPropertyByName(\"isGood\")", + "replacementText": "foo.getProperty(\"isGood\")", "line": 32, "column": 5, "endLine": 32, @@ -403,7 +403,7 @@ "problem": "InteropJsObjectConditionJudgment", "autofix": [ { - "replacementText": "foo.getPropertyByName('isGood').toBoolean()", + "replacementText": "foo.getProperty('isGood').toBoolean()", "start": 1098, "end": 1108, "line": 32, @@ -426,7 +426,7 @@ { "start": 1118, "end": 1124, - "replacementText": "ff1.getPropertyByName(\"f1\").toNumber()", + "replacementText": "ff1.getProperty(\"f1\").toNumber()", "line": 34, "column": 5, "endLine": 34, @@ -447,7 +447,7 @@ { "start": 1118, "end": 1124, - "replacementText": "ff1.getPropertyByName(\"f1\")", + "replacementText": "ff1.getProperty(\"f1\")", "line": 34, "column": 5, "endLine": 34, @@ -466,7 +466,7 @@ "problem": "InteropJsObjectConditionJudgment", "autofix": [ { - "replacementText": "ff1.getPropertyByName('f1').toNumber()", + "replacementText": "ff1.getProperty('f1').toNumber()", "start": 1118, "end": 1124, "line": 34, @@ -561,7 +561,7 @@ { "start": 1344, "end": 1351, - "replacementText": "ff3.getPropertyByName(\"arr\")", + "replacementText": "ff3.getProperty(\"arr\")", "line": 50, "column": 11, "endLine": 50, @@ -582,7 +582,7 @@ { "start": 1362, "end": 1372, - "replacementText": "arr.getPropertyByName(\"length\")", + "replacementText": "arr.getProperty(\"length\")", "line": 51, "column": 11, "endLine": 51, @@ -653,7 +653,7 @@ "problem": "InteropJsObjectTraverseJsInstance", "autofix": [ { - "replacementText": "arr.getPropertyByIndex(i).toNumber()", + "replacementText": "arr.getProperty(i).toNumber()", "start": 1425, "end": 1431, "line": 53, @@ -676,7 +676,7 @@ { "start": 1425, "end": 1431, - "replacementText": "arr.getPropertyByIndex(i)", + "replacementText": "arr.getProperty(i)", "line": 53, "column": 11, "endLine": 53, @@ -705,7 +705,7 @@ "problem": "InteropJsObjectTraverseJsInstance", "autofix": [ { - "replacementText": "arr.setPropertyByIndex(i, ESValue.wrap(0))", + "replacementText": "arr.setProperty(i, ESValue.wrap(0))", "start": 1434, "end": 1444, "line": 54, @@ -728,7 +728,7 @@ { "start": 1434, "end": 1444, - "replacementText": "arr.setPropertyByIndex(i, ESValue.wrap(0))", + "replacementText": "arr.setProperty(i, ESValue.wrap(0))", "line": 54, "column": 3, "endLine": 54, @@ -1072,7 +1072,7 @@ { "start": 1831, "end": 1850, - "replacementText": "orange.getPropertyByName(\"isVegetable1\")", + "replacementText": "orange.getProperty(\"isVegetable1\")", "line": 84, "column": 5, "endLine": 84, 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 a080a8877d..9481ffc18a 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 @@ -33,7 +33,7 @@ { "start": 783, "end": 783, - "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_js');\nlet myAaa = GeneratedImportVar_1.getPropertyByName('aaa');\nlet ClassA = GeneratedImportVar_1.getPropertyByName('ClassA');\nlet Dog = GeneratedImportVar_1.getPropertyByName('Dog');\nlet Person = GeneratedImportVar_1.getPropertyByName('Person');\nlet Wiki = GeneratedImportVar_1.getPropertyByName('Wiki');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_import_js_js');\nlet myAaa = GeneratedImportVar_1.getProperty('aaa');\nlet ClassA = GeneratedImportVar_1.getProperty('ClassA');\nlet Dog = GeneratedImportVar_1.getProperty('Dog');\nlet Person = GeneratedImportVar_1.getProperty('Person');\nlet Wiki = GeneratedImportVar_1.getProperty('Wiki');\n", "line": 16, "column": 1, "endLine": 16, @@ -63,7 +63,7 @@ { "start": 783, "end": 783, - "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_js');\nlet Doge = GeneratedImportVar_2.getPropertyByName('Dog');\n", + "replacementText": "let GeneratedImportVar_2 = ESValue.load('./interop_import_js_js');\nlet Doge = GeneratedImportVar_2.getProperty('Dog');\n", "line": 17, "column": 1, "endLine": 17, @@ -93,7 +93,7 @@ { "start": 783, "end": 783, - "replacementText": "let GeneratedImportVar_3 = ESValue.load('./interop_import_js_js');\nlet wiki = GeneratedImportVar_3.getPropertyByName('Wiki');\n", + "replacementText": "let GeneratedImportVar_3 = ESValue.load('./interop_import_js_js');\nlet wiki = GeneratedImportVar_3.getProperty('Wiki');\n", "line": 18, "column": 1, "endLine": 18, @@ -260,7 +260,7 @@ { "start": 937, "end": 953, - "replacementText": "Wiki.getPropertyByName('name').typeOf()", + "replacementText": "Wiki.getProperty('name').typeOf()", "line": 27, "column": 1, "endLine": 27, @@ -281,7 +281,7 @@ { "start": 944, "end": 953, - "replacementText": "Wiki.getPropertyByName(\"name\")", + "replacementText": "Wiki.getProperty(\"name\")", "line": 27, "column": 8, "endLine": 27, @@ -323,7 +323,7 @@ { "start": 992, "end": 1001, - "replacementText": "wiki.getPropertyByName(\"name\")", + "replacementText": "wiki.getProperty(\"name\")", "line": 29, "column": 11, "endLine": 29, @@ -428,7 +428,7 @@ { "start": 1136, "end": 1147, - "replacementText": "person.getPropertyByName(\"name\")", + "replacementText": "person.getProperty(\"name\")", "line": 35, "column": 11, "endLine": 35, @@ -584,7 +584,7 @@ { "start": 1701, "end": 1717, - "replacementText": "wiki.getPropertyByName('name').typeOf()", + "replacementText": "wiki.getProperty('name').typeOf()", "line": 61, "column": 5, "endLine": 61, @@ -605,7 +605,7 @@ { "start": 1708, "end": 1717, - "replacementText": "wiki.getPropertyByName(\"name\")", + "replacementText": "wiki.getProperty(\"name\")", "line": 61, "column": 12, "endLine": 61, @@ -689,7 +689,7 @@ { "start": 1868, "end": 1892, - "replacementText": "Person.instantiate().getPropertyByName('name').typeOf()", + "replacementText": "Person.instantiate().getProperty('name').typeOf()", "line": 70, "column": 1, "endLine": 70, @@ -710,7 +710,7 @@ { "start": 1875, "end": 1892, - "replacementText": "new Person().getPropertyByName(\"name\")", + "replacementText": "new Person().getProperty(\"name\")", "line": 70, "column": 8, "endLine": 70, 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 197a8577ce..ec79bd0e7e 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 @@ -16,15 +16,15 @@ let GeneratedImportVar_3 = ESValue.load('./interop_import_js_js'); -let wiki = GeneratedImportVar_3.getPropertyByName('Wiki'); +let wiki = GeneratedImportVar_3.getProperty('Wiki'); let GeneratedImportVar_2 = ESValue.load('./interop_import_js_js'); -let Doge = GeneratedImportVar_2.getPropertyByName('Dog'); +let Doge = GeneratedImportVar_2.getProperty('Dog'); let GeneratedImportVar_1 = ESValue.load('./interop_import_js_js'); -let myAaa = GeneratedImportVar_1.getPropertyByName('aaa'); -let ClassA = GeneratedImportVar_1.getPropertyByName('ClassA'); -let Dog = GeneratedImportVar_1.getPropertyByName('Dog'); -let Person = GeneratedImportVar_1.getPropertyByName('Person'); -let Wiki = GeneratedImportVar_1.getPropertyByName('Wiki'); +let myAaa = GeneratedImportVar_1.getProperty('aaa'); +let ClassA = GeneratedImportVar_1.getProperty('ClassA'); +let Dog = GeneratedImportVar_1.getProperty('Dog'); +let Person = GeneratedImportVar_1.getProperty('Person'); +let Wiki = GeneratedImportVar_1.getProperty('Wiki'); myAaa.invoke().typeOf(); //error @@ -34,15 +34,15 @@ Dog.typeOf(); //error Dog.invoke(ESValue.wrap('doge')).typeOf(); //error Doge.invoke(ESValue.wrap('doge')).typeOf(); //error Wiki.typeOf() //error -Wiki.getPropertyByName('name').typeOf() //error +Wiki.getProperty('name').typeOf() //error wiki.typeOf() //error -let val = wiki.getPropertyByName("name") +let val = wiki.getProperty("name") typeof val; const aClass:ClassA = ClassA.instantiate() ClassA.instantiate().typeOf() //error typeof aClass; let person:Person = Person.instantiate(); -let name =person.getPropertyByName("name") +let name =person.getProperty("name") let name2 =person.invokeMethod("getName") function getPersonInfo(){ typeof person; @@ -68,7 +68,7 @@ class Object { typeof location; } tips(){ - wiki.getPropertyByName('name').typeOf(); //error + wiki.getProperty('name').typeOf(); //error typeof age; typeof person2; typeof fun; @@ -77,6 +77,6 @@ class Object { } myAaa.typeOf(); //error -Person.instantiate().getPropertyByName('name').typeOf() //error +Person.instantiate().getProperty('name').typeOf() //error Person.instantiate().invokeMethod("getName").typeOf() //error Person.instantiate().invokeMethod("setAge", ESValue.wrap(22.0)).typeOf() //error 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 f709470eef..af67e13229 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 @@ -28,7 +28,7 @@ "line": 19, "column": 5, "endLine": 19, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +48,7 @@ "line": 21, "column": 5, "endLine": 21, - "endColumn": 57, + "endColumn": 51, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 23, "column": 5, "endLine": 23, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -78,7 +78,7 @@ "line": 24, "column": 5, "endLine": 24, - "endColumn": 62, + "endColumn": 56, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -88,7 +88,7 @@ "line": 25, "column": 5, "endLine": 25, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -98,7 +98,7 @@ "line": 26, "column": 5, "endLine": 26, - "endColumn": 62, + "endColumn": 56, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -108,7 +108,7 @@ "line": 27, "column": 5, "endLine": 27, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -128,7 +128,7 @@ "line": 39, "column": 5, "endLine": 39, - "endColumn": 41, + "endColumn": 35, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -138,7 +138,7 @@ "line": 45, "column": 5, "endLine": 45, - "endColumn": 43, + "endColumn": 37, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", 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 d66995a3c6..f2e4507626 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 GeneratedImportVar_1 = ESValue.load('./interop_not_have_property_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\nlet person = GeneratedImportVar_1.getPropertyByName('person');\nlet TestHelper = GeneratedImportVar_1.getPropertyByName('TestHelper');\nlet Machine = GeneratedImportVar_1.getPropertyByName('Machine');\nlet User = GeneratedImportVar_1.getPropertyByName('User');\nlet Person = GeneratedImportVar_1.getPropertyByName('Person');\nlet Employee = GeneratedImportVar_1.getPropertyByName('Employee');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_not_have_property_js');\nlet foo = GeneratedImportVar_1.getProperty('foo');\nlet person = GeneratedImportVar_1.getProperty('person');\nlet TestHelper = GeneratedImportVar_1.getProperty('TestHelper');\nlet Machine = GeneratedImportVar_1.getProperty('Machine');\nlet User = GeneratedImportVar_1.getProperty('User');\nlet Person = GeneratedImportVar_1.getProperty('Person');\nlet Employee = GeneratedImportVar_1.getProperty('Employee');\n", "line": 17, "column": 1, "endLine": 17, @@ -64,7 +64,7 @@ { "start": 725, "end": 733, - "replacementText": "foo.getPropertyByName(\"name\")", + "replacementText": "foo.getProperty(\"name\")", "line": 19, "column": 1, "endLine": 19, @@ -85,7 +85,7 @@ { "start": 734, "end": 750, - "replacementText": "foo.setPropertyByName(\"name\", ESValue.wrap(\"456\"))", + "replacementText": "foo.setProperty(\"name\", ESValue.wrap(\"456\"))", "line": 20, "column": 1, "endLine": 20, @@ -106,7 +106,7 @@ { "start": 751, "end": 766, - "replacementText": "person.setPropertyByName(\"age\", ESValue.wrap(23))", + "replacementText": "person.setProperty(\"age\", ESValue.wrap(23))", "line": 21, "column": 1, "endLine": 21, @@ -148,7 +148,7 @@ { "start": 767, "end": 787, - "replacementText": "person.setPropertyByName(\"male\", ESValue.wrap([2, 3]))", + "replacementText": "person.setProperty(\"male\", ESValue.wrap([2, 3]))", "line": 22, "column": 1, "endLine": 22, @@ -211,7 +211,7 @@ { "start": 788, "end": 800, - "replacementText": "foo.setPropertyByName(\"age\", ESValue.wrap(12))", + "replacementText": "foo.setProperty(\"age\", ESValue.wrap(12))", "line": 23, "column": 1, "endLine": 23, @@ -253,7 +253,7 @@ { "start": 805, "end": 821, - "replacementText": "foo.setPropertyByName(\"name\", ESValue.wrap(\"456\"))", + "replacementText": "foo.setProperty(\"name\", ESValue.wrap(\"456\"))", "line": 24, "column": 5, "endLine": 24, @@ -272,7 +272,7 @@ "problem": "InteropJsObjectConditionJudgment", "autofix": [ { - "replacementText": "foo.getPropertyByName('name').toString()", + "replacementText": "foo.getProperty('name').toString()", "start": 805, "end": 813, "line": 24, @@ -326,7 +326,7 @@ { "start": 860, "end": 870, - "replacementText": "a.setPropertyByName(\"age\", ESValue.wrap(12))", + "replacementText": "a.setProperty(\"age\", ESValue.wrap(12))", "line": 27, "column": 1, "endLine": 27, @@ -452,7 +452,7 @@ { "start": 1005, "end": 1017, - "replacementText": "machine.getPropertyByName(\"name\")", + "replacementText": "machine.getProperty(\"name\")", "line": 32, "column": 12, "endLine": 32, @@ -536,7 +536,7 @@ { "start": 1173, "end": 1180, - "replacementText": "user.getPropertyByName(\"id\")", + "replacementText": "user.getProperty(\"id\")", "line": 37, "column": 12, "endLine": 37, @@ -641,7 +641,7 @@ { "start": 1312, "end": 1319, - "replacementText": "user.getPropertyByName(\"id\")", + "replacementText": "user.getProperty(\"id\")", "line": 42, "column": 8, "endLine": 42, @@ -746,7 +746,7 @@ { "start": 1454, "end": 1461, - "replacementText": "user.getPropertyByName(\"id\")", + "replacementText": "user.getProperty(\"id\")", "line": 47, "column": 12, "endLine": 47, @@ -830,7 +830,7 @@ { "start": 1601, "end": 1608, - "replacementText": "user.getPropertyByName(\"id\")", + "replacementText": "user.getProperty(\"id\")", "line": 52, "column": 12, "endLine": 52, @@ -935,7 +935,7 @@ { "start": 1758, "end": 1770, - "replacementText": "machine.getPropertyByName(\"name\")", + "replacementText": "machine.getProperty(\"name\")", "line": 57, "column": 12, "endLine": 57, @@ -1019,7 +1019,7 @@ { "start": 1929, "end": 1942, - "replacementText": "employee.getPropertyByName(\"name\")", + "replacementText": "employee.getProperty(\"name\")", "line": 62, "column": 12, "endLine": 62, 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 b5185b29e4..ff4cf81936 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 @@ -15,24 +15,24 @@ 'use static' let GeneratedImportVar_1 = ESValue.load('./interop_not_have_property_js'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); -let person = GeneratedImportVar_1.getPropertyByName('person'); -let TestHelper = GeneratedImportVar_1.getPropertyByName('TestHelper'); -let Machine = GeneratedImportVar_1.getPropertyByName('Machine'); -let User = GeneratedImportVar_1.getPropertyByName('User'); -let Person = GeneratedImportVar_1.getPropertyByName('Person'); -let Employee = GeneratedImportVar_1.getPropertyByName('Employee'); +let foo = GeneratedImportVar_1.getProperty('foo'); +let person = GeneratedImportVar_1.getProperty('person'); +let TestHelper = GeneratedImportVar_1.getProperty('TestHelper'); +let Machine = GeneratedImportVar_1.getProperty('Machine'); +let User = GeneratedImportVar_1.getProperty('User'); +let Person = GeneratedImportVar_1.getProperty('Person'); +let Employee = GeneratedImportVar_1.getProperty('Employee'); -foo.getPropertyByName("name") -foo.setPropertyByName("name", ESValue.wrap("456")) -person.setPropertyByName("age", ESValue.wrap(23.0)) -person.setPropertyByName("male", ESValue.wrap([2.0, 3.0])) -foo.setPropertyByName("age", ESValue.wrap(12.0)) -if (foo.setPropertyByName("name", ESValue.wrap("456"))) { print("true") } +foo.getProperty("name") +foo.setProperty("name", ESValue.wrap("456")) +person.setProperty("age", ESValue.wrap(23.0)) +person.setProperty("male", ESValue.wrap([2.0, 3.0])) +foo.setProperty("age", ESValue.wrap(12.0)) +if (foo.setProperty("name", ESValue.wrap("456"))) { print("true") } let a = foo.instantiate() -a.setPropertyByName("age", ESValue.wrap(12.0)) +a.setProperty("age", ESValue.wrap(12.0)) let test_helper = TestHelper.instantiate(ESValue.wrap("TEST_INSTANTIATE_JS_OBJECT")); test_helper.invokeMethod("test", ESValue.wrap(() => { 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 540b5557d4..258a8601a0 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 @@ -28,7 +28,7 @@ "line": 18, "column": 5, "endLine": 18, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 19, "column": 5, "endLine": 19, - "endColumn": 62, + "endColumn": 56, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +48,7 @@ "line": 20, "column": 5, "endLine": 20, - "endColumn": 70, + "endColumn": 64, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -58,7 +58,7 @@ "line": 21, "column": 5, "endLine": 21, - "endColumn": 64, + "endColumn": 58, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 22, "column": 5, "endLine": 22, - "endColumn": 58, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -78,7 +78,7 @@ "line": 23, "column": 5, "endLine": 23, - "endColumn": 62, + "endColumn": 56, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -88,7 +88,7 @@ "line": 24, "column": 5, "endLine": 24, - "endColumn": 66, + "endColumn": 60, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", 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 c638dec23e..402aa07005 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 GeneratedImportVar_1 = ESValue.load('./interop_property_num_js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./interop_property_num_js');\nlet foo = GeneratedImportVar_1.getProperty('foo');\n", "line": 16, "column": 1, "endLine": 16, @@ -54,7 +54,7 @@ { "start": 653, "end": 660, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", + "replacementText": "foo.getProperty(\"num\").toNumber()", "line": 18, "column": 1, "endLine": 18, @@ -75,7 +75,7 @@ { "start": 653, "end": 660, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 18, "column": 2, "endLine": 18, @@ -96,7 +96,7 @@ { "start": 663, "end": 670, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", + "replacementText": "foo.getProperty(\"num\").toNumber()", "line": 19, "column": 1, "endLine": 19, @@ -117,7 +117,7 @@ { "start": 663, "end": 670, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 19, "column": 2, "endLine": 19, @@ -138,7 +138,7 @@ { "start": 673, "end": 680, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", + "replacementText": "foo.getProperty(\"num\").toNumber()", "line": 20, "column": 1, "endLine": 20, @@ -159,7 +159,7 @@ { "start": 673, "end": 680, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 20, "column": 2, "endLine": 20, @@ -180,7 +180,7 @@ { "start": 683, "end": 690, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", + "replacementText": "foo.getProperty(\"num\").toNumber()", "line": 21, "column": 1, "endLine": 21, @@ -201,7 +201,7 @@ { "start": 683, "end": 690, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 21, "column": 2, "endLine": 21, @@ -222,7 +222,7 @@ { "start": 693, "end": 702, - "replacementText": "(foo.getPropertyByName(\"num\").toNumber())", + "replacementText": "(foo.getProperty(\"num\").toNumber())", "line": 22, "column": 1, "endLine": 22, @@ -243,7 +243,7 @@ { "start": 694, "end": 701, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 22, "column": 3, "endLine": 22, @@ -264,7 +264,7 @@ { "start": 705, "end": 714, - "replacementText": "(foo.getPropertyByName(\"num\").toNumber())", + "replacementText": "(foo.getProperty(\"num\").toNumber())", "line": 23, "column": 1, "endLine": 23, @@ -285,7 +285,7 @@ { "start": 706, "end": 713, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 23, "column": 3, "endLine": 23, @@ -306,7 +306,7 @@ { "start": 717, "end": 726, - "replacementText": "(foo.getPropertyByName(\"num\").toNumber())", + "replacementText": "(foo.getProperty(\"num\").toNumber())", "line": 24, "column": 1, "endLine": 24, @@ -327,7 +327,7 @@ { "start": 718, "end": 725, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 24, "column": 3, "endLine": 24, @@ -348,7 +348,7 @@ { "start": 729, "end": 738, - "replacementText": "(foo.getPropertyByName(\"num\").toNumber())", + "replacementText": "(foo.getProperty(\"num\").toNumber())", "line": 25, "column": 1, "endLine": 25, @@ -369,7 +369,7 @@ { "start": 730, "end": 737, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 25, "column": 3, "endLine": 25, 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 09086d9892..97d25fc238 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 @@ -14,14 +14,14 @@ */ let GeneratedImportVar_1 = ESValue.load('./interop_property_num_js'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); +let foo = GeneratedImportVar_1.getProperty('foo'); -+foo.getPropertyByName("num").toNumber(); --foo.getPropertyByName("num").toNumber(); -!foo.getPropertyByName("num").toNumber(); -~foo.getPropertyByName("num").toNumber(); -+(foo.getPropertyByName("num").toNumber()); --(foo.getPropertyByName("num").toNumber()); -!(foo.getPropertyByName("num").toNumber()); -~(foo.getPropertyByName("num").toNumber()); \ No newline at end of file ++foo.getProperty("num").toNumber(); +-foo.getProperty("num").toNumber(); +!foo.getProperty("num").toNumber(); +~foo.getProperty("num").toNumber(); ++(foo.getProperty("num").toNumber()); +-(foo.getProperty("num").toNumber()); +!(foo.getProperty("num").toNumber()); +~(foo.getProperty("num").toNumber()); \ No newline at end of file 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 ef4a1a04e1..9ada1a9ba2 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 @@ -28,7 +28,7 @@ "line": 17, "column": 5, "endLine": 17, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 20, "column": 1, "endLine": 20, - "endColumn": 41, + "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", @@ -48,7 +48,7 @@ "line": 21, "column": 1, "endLine": 21, - "endColumn": 41, + "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", @@ -58,7 +58,7 @@ "line": 23, "column": 1, "endLine": 23, - "endColumn": 41, + "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", @@ -68,7 +68,7 @@ "line": 24, "column": 1, "endLine": 24, - "endColumn": 43, + "endColumn": 37, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", @@ -78,7 +78,7 @@ "line": 25, "column": 1, "endLine": 25, - "endColumn": 43, + "endColumn": 37, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", @@ -88,7 +88,7 @@ "line": 27, "column": 1, "endLine": 27, - "endColumn": 43, + "endColumn": 37, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", 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 5254337c77..3803d40f1a 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 GeneratedImportVar_1 = ESValue.load('./no_await_js_promise_export');\nlet p = GeneratedImportVar_1.getPropertyByName('p');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\nlet pFuncCall = GeneratedImportVar_1.getPropertyByName('pFuncCall');\nlet arrowFunc = GeneratedImportVar_1.getPropertyByName('arrowFunc');\nlet pArrowCall = GeneratedImportVar_1.getPropertyByName('pArrowCall');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./no_await_js_promise_export');\nlet p = GeneratedImportVar_1.getProperty('p');\nlet foo = GeneratedImportVar_1.getProperty('foo');\nlet pFuncCall = GeneratedImportVar_1.getProperty('pFuncCall');\nlet arrowFunc = GeneratedImportVar_1.getProperty('arrowFunc');\nlet pArrowCall = GeneratedImportVar_1.getProperty('pArrowCall');\n", "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 a89d3e58d3..a1e4ff667c 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 @@ -14,11 +14,11 @@ */ let GeneratedImportVar_1 = ESValue.load('./no_await_js_promise_export'); -let p = GeneratedImportVar_1.getPropertyByName('p'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); -let pFuncCall = GeneratedImportVar_1.getPropertyByName('pFuncCall'); -let arrowFunc = GeneratedImportVar_1.getPropertyByName('arrowFunc'); -let pArrowCall = GeneratedImportVar_1.getPropertyByName('pArrowCall'); +let p = GeneratedImportVar_1.getProperty('p'); +let foo = GeneratedImportVar_1.getProperty('foo'); +let pFuncCall = GeneratedImportVar_1.getProperty('pFuncCall'); +let arrowFunc = GeneratedImportVar_1.getProperty('arrowFunc'); +let pArrowCall = GeneratedImportVar_1.getProperty('pArrowCall'); async function awaitPromise() { 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 5d4c781348..4aebfd2473 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 @@ -28,7 +28,7 @@ "line": 17, "column": 5, "endLine": 17, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 18, "column": 5, "endLine": 18, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +48,7 @@ "line": 19, "column": 5, "endLine": 19, - "endColumn": 68, + "endColumn": 62, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -58,7 +58,7 @@ "line": 20, "column": 5, "endLine": 20, - "endColumn": 68, + "endColumn": 62, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 21, "column": 5, "endLine": 21, - "endColumn": 70, + "endColumn": 64, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", 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 8b4189586e..bf8dcb076d 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 GeneratedImportVar_1 = ESValue.load('./no_js_instanceof_file.js');\nlet Foo = GeneratedImportVar_1.getPropertyByName('Foo');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\nlet CreatePerson = GeneratedImportVar_1.getPropertyByName('CreatePerson');\nlet a = GeneratedImportVar_1.getPropertyByName('a');\nlet b = GeneratedImportVar_1.getPropertyByName('b');\nlet MyNamespace = GeneratedImportVar_1.getPropertyByName('MyNamespace');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./no_js_instanceof_file.js');\nlet Foo = GeneratedImportVar_1.getProperty('Foo');\nlet foo = GeneratedImportVar_1.getProperty('foo');\nlet CreatePerson = GeneratedImportVar_1.getProperty('CreatePerson');\nlet a = GeneratedImportVar_1.getProperty('a');\nlet b = GeneratedImportVar_1.getProperty('b');\nlet MyNamespace = GeneratedImportVar_1.getProperty('MyNamespace');\n", "line": 16, "column": 1, "endLine": 16, @@ -316,7 +316,7 @@ { "start": 1296, "end": 1311, - "replacementText": "MyNamespace.getPropertyByName(\"Dog\")", + "replacementText": "MyNamespace.getProperty(\"Dog\")", "line": 72, "column": 36, "endLine": 72, @@ -358,7 +358,7 @@ { "start": 1344, "end": 1359, - "replacementText": "MyNamespace.getPropertyByName(\"Dog\")", + "replacementText": "MyNamespace.getProperty(\"Dog\")", "line": 74, "column": 22, "endLine": 74, @@ -377,7 +377,7 @@ "problem": "InteropJsObjectConditionJudgment", "autofix": [ { - "replacementText": "MyNamespace.getPropertyByName('Dog')", + "replacementText": "MyNamespace.getProperty('Dog')", "start": 1344, "end": 1359, "line": 74, 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 b71a99dcc0..89f487d233 100644 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets @@ -14,12 +14,12 @@ */ let GeneratedImportVar_1 = ESValue.load('./no_js_instanceof_file.js'); -let Foo = GeneratedImportVar_1.getPropertyByName('Foo'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); -let CreatePerson = GeneratedImportVar_1.getPropertyByName('CreatePerson'); -let a = GeneratedImportVar_1.getPropertyByName('a'); -let b = GeneratedImportVar_1.getPropertyByName('b'); -let MyNamespace = GeneratedImportVar_1.getPropertyByName('MyNamespace'); +let Foo = GeneratedImportVar_1.getProperty('Foo'); +let foo = GeneratedImportVar_1.getProperty('foo'); +let CreatePerson = GeneratedImportVar_1.getProperty('CreatePerson'); +let a = GeneratedImportVar_1.getProperty('a'); +let b = GeneratedImportVar_1.getProperty('b'); +let MyNamespace = GeneratedImportVar_1.getProperty('MyNamespace'); class Foo1 {} @@ -76,7 +76,7 @@ if(b().isInstanceOf(Array)) { } -const myDog: MyNamespace.Dog = new MyNamespace.getPropertyByName("Dog")('Buddy'); +const myDog: MyNamespace.Dog = new MyNamespace.getProperty("Dog")('Buddy'); if (myDog.isInstanceOf(MyNamespace.Dog)) { console.log("This is a Dog!"); 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 63aabda702..4a61cb89de 100644 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json @@ -28,7 +28,7 @@ "line": 17, "column": 5, "endLine": 17, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 18, "column": 5, "endLine": 18, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -48,7 +48,7 @@ "line": 19, "column": 5, "endLine": 19, - "endColumn": 74, + "endColumn": 68, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -58,7 +58,7 @@ "line": 20, "column": 5, "endLine": 20, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -68,7 +68,7 @@ "line": 21, "column": 5, "endLine": 21, - "endColumn": 52, + "endColumn": 46, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -78,7 +78,7 @@ "line": 22, "column": 5, "endLine": 22, - "endColumn": 72, + "endColumn": 66, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -108,7 +108,7 @@ "line": 79, "column": 36, "endLine": 79, - "endColumn": 65, + "endColumn": 59, "problem": "DynamicCtorCall", "suggest": "", "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", diff --git a/ets2panda/linter/test/interop/object_built_in.ets b/ets2panda/linter/test/interop/object_built_in.ets index 3170f3f087..3b9dceea07 100644 --- a/ets2panda/linter/test/interop/object_built_in.ets +++ b/ets2panda/linter/test/interop/object_built_in.ets @@ -25,3 +25,11 @@ export function foo(prx: Object) { } foo(new X()); // Illegal + +export function shouldPass() { + const bar = JSON.parse('{}'); + console.log(Object.keys(bar).length); +} + +shouldPass() + diff --git a/ets2panda/linter/test/interop/object_built_in.ets.arkts2.json b/ets2panda/linter/test/interop/object_built_in.ets.arkts2.json index d9cadcd5d4..41a2db7981 100644 --- a/ets2panda/linter/test/interop/object_built_in.ets.arkts2.json +++ b/ets2panda/linter/test/interop/object_built_in.ets.arkts2.json @@ -55,14 +55,14 @@ "severity": "ERROR" }, { - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 14, - "problem": "InteropCallObjectParam", + "line": 30, + "column": 11, + "endLine": 30, + "endColumn": 33, + "problem": "AnyType", "suggest": "", - "rule": "Class type is not compatible with \"Object\" parameter in interop call (arkts-interop-d2s-static-object-on-dynamic-instance)", + "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/interop/object_built_in.ets.json b/ets2panda/linter/test/interop/object_built_in.ets.json index d2adea10e5..1918dfda67 100644 --- a/ets2panda/linter/test/interop/object_built_in.ets.json +++ b/ets2panda/linter/test/interop/object_built_in.ets.json @@ -45,14 +45,14 @@ "severity": "ERROR" }, { - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 14, - "problem": "InteropCallObjectParam", + "line": 30, + "column": 11, + "endLine": 30, + "endColumn": 33, + "problem": "AnyType", "suggest": "", - "rule": "Class type is not compatible with \"Object\" parameter in interop call (arkts-interop-d2s-static-object-on-dynamic-instance)", + "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/interop/reflect_built_in.ets.arkts2.json b/ets2panda/linter/test/interop/reflect_built_in.ets.arkts2.json index 1dd3014588..c76a12de83 100644 --- a/ets2panda/linter/test/interop/reflect_built_in.ets.arkts2.json +++ b/ets2panda/linter/test/interop/reflect_built_in.ets.arkts2.json @@ -64,26 +64,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 14, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, - { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 14, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 29, "column": 1, @@ -164,16 +144,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 41, - "column": 1, - "endLine": 41, - "endColumn": 33, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 42, "column": 1, @@ -214,16 +184,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 46, - "column": 1, - "endLine": 46, - "endColumn": 22, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 47, "column": 1, @@ -264,16 +224,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 51, - "column": 1, - "endLine": 51, - "endColumn": 31, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 52, "column": 1, @@ -314,16 +264,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 56, - "column": 1, - "endLine": 56, - "endColumn": 27, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 57, "column": 1, @@ -355,4 +295,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/reflect_built_in.ets.json b/ets2panda/linter/test/interop/reflect_built_in.ets.json index eb39c3a62e..ef3d440bfb 100644 --- a/ets2panda/linter/test/interop/reflect_built_in.ets.json +++ b/ets2panda/linter/test/interop/reflect_built_in.ets.json @@ -54,26 +54,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 14, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, - { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 14, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 31, "column": 1, @@ -134,16 +114,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 41, - "column": 1, - "endLine": 41, - "endColumn": 33, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 42, "column": 1, @@ -174,16 +144,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 46, - "column": 1, - "endLine": 46, - "endColumn": 22, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 47, "column": 1, @@ -214,16 +174,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 51, - "column": 1, - "endLine": 51, - "endColumn": 31, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 52, "column": 1, @@ -254,16 +204,6 @@ "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", "severity": "ERROR" }, - { - "line": 56, - "column": 1, - "endLine": 56, - "endColumn": 27, - "problem": "InteropCallReflect", - "suggest": "", - "rule": "Reflect API usage is not allowed in interop calls when an \"Object\" parameter receives a class instance (arkts-interop-d2s-static-reflect-on-dynamic-instance)", - "severity": "ERROR" - }, { "line": 57, "column": 1, @@ -295,4 +235,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} 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 07cb92eb1a..b3d6f3508f 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 GeneratedImportVar_1 = ESValue.load('./unary_operation_js_obj_js.js');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\n", + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./unary_operation_js_obj_js.js');\nlet foo = GeneratedImportVar_1.getProperty('foo');\n", "line": 15, "column": 1, "endLine": 15, @@ -54,7 +54,7 @@ { "start": 657, "end": 664, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", + "replacementText": "foo.getProperty(\"num\").toNumber()", "line": 17, "column": 1, "endLine": 17, @@ -75,7 +75,7 @@ { "start": 657, "end": 664, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 17, "column": 2, "endLine": 17, @@ -96,7 +96,7 @@ { "start": 667, "end": 674, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", + "replacementText": "foo.getProperty(\"num\").toNumber()", "line": 18, "column": 1, "endLine": 18, @@ -117,7 +117,7 @@ { "start": 667, "end": 674, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 18, "column": 2, "endLine": 18, @@ -138,7 +138,7 @@ { "start": 677, "end": 684, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", + "replacementText": "foo.getProperty(\"num\").toNumber()", "line": 19, "column": 1, "endLine": 19, @@ -159,7 +159,7 @@ { "start": 677, "end": 684, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 19, "column": 2, "endLine": 19, @@ -180,7 +180,7 @@ { "start": 687, "end": 694, - "replacementText": "foo.getPropertyByName(\"num\").toNumber()", + "replacementText": "foo.getProperty(\"num\").toNumber()", "line": 20, "column": 1, "endLine": 20, @@ -201,7 +201,7 @@ { "start": 687, "end": 694, - "replacementText": "foo.getPropertyByName(\"num\")", + "replacementText": "foo.getProperty(\"num\")", "line": 20, "column": 2, "endLine": 20, 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 5448d6f5f0..d0a648c942 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 @@ -13,10 +13,10 @@ * limitations under the License. */ let GeneratedImportVar_1 = ESValue.load('./unary_operation_js_obj_js.js'); -let foo = GeneratedImportVar_1.getPropertyByName('foo'); +let foo = GeneratedImportVar_1.getProperty('foo'); -+foo.getPropertyByName("num").toNumber(); --foo.getPropertyByName("num").toNumber(); -!foo.getPropertyByName("num").toNumber(); -~foo.getPropertyByName("num").toNumber(); \ No newline at end of file ++foo.getProperty("num").toNumber(); +-foo.getProperty("num").toNumber(); +!foo.getProperty("num").toNumber(); +~foo.getProperty("num").toNumber(); \ No newline at end of file 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 4d448e180c..8fbd5964c4 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 @@ -28,7 +28,7 @@ "line": 16, "column": 5, "endLine": 16, - "endColumn": 56, + "endColumn": 50, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,7 +38,7 @@ "line": 19, "column": 1, "endLine": 19, - "endColumn": 41, + "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", @@ -48,7 +48,7 @@ "line": 20, "column": 1, "endLine": 20, - "endColumn": 41, + "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", @@ -58,7 +58,7 @@ "line": 22, "column": 1, "endLine": 22, - "endColumn": 41, + "endColumn": 35, "problem": "UnaryArithmNotNumber", "suggest": "", "rule": "Unary operators \"+\", \"-\" and \"~\" work only on numbers (arkts-no-polymorphic-unops)", diff --git a/ets2panda/linter/test/interop/unique_types.ets b/ets2panda/linter/test/interop/unique_types.ets index da2c034f53..9c16a54d2b 100644 --- a/ets2panda/linter/test/interop/unique_types.ets +++ b/ets2panda/linter/test/interop/unique_types.ets @@ -14,22 +14,387 @@ */ import { - objectLiteralType, - intersectionType, - tsFunction, - stringType, - enumType + any_var, + unknown_var, + symbol_var, + function_var, + A, + B, + TestHelper, + throw_number, + throw_string, + throw_boolean, + throw_bigint, + throw_obj, + throw_error, + throwErrorSubClass, + SubError, + throwRangeError, + ObjectLiteralClass, + ObjectLiteralInter, + MyClassDecorator, + propertyDecorator, + methodDecorator, + parameterDecorator, + accessorDecorator, + readonly1, + num_boxed, + bool_boxed, + str_boxed, + bigint_boxed, + ts_object_method, + ts_object_method_getOwnPropertyDescriptor, + ts_object_method_getOwnPropertyDescriptors, + ts_object_method_getOwnPropertyNames, + ts_object_method_hasOwn, + ts_object_method_isExtensible, + ts_object_method_isFrozen, + ts_object_method_isSealed, + ts_object_method_keys, + ts_object_method_values, + interObj, + ts_reflect_method, + ts_reflect_method_apply, + ts_reflect_method_defineProperty, + ts_reflect_method_deleteProperty, + ts_reflect_method_getOwnPropertyDescriptor, + ts_reflect_method_ownKeys, + ts_reflect_method_isExtensible, + ts_reflect_method_set, + ts_reflect_method_setPrototypeOf } from "./ignore_files/unique_types"; -objectLiteralType.name = "test" -intersectionType.name = "test"; +typeof any_var === 'object'; +typeof unknown_var === 'number'; +typeof symbol_var === 'object'; +function_var() === true; +A.instance; +let obj: B = { name: "hello" }; -try { -tsFunction(); -} catch (e) { +export function test_ts_non_standard_exception(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_TS_NON_STANDARD_EXCEPTION"); + + test_helper.test(() => { + try { + throw_number(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e as number === 123; + } + return false; + }, "e as number === 123"); + + test_helper.test(() => { + try { + throw_boolean(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e as boolean === true; + } + return false; + }, "e as boolean === true"); + + test_helper.test(() => { + try { + throw_bigint(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e as bigint === 111n; + } + return false; + }, "e as bigint === 111n"); + + test_helper.test(() => { + try { + throw_string(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e as string === "error"; + } + return false; + }, "e as string === "error""); + + test_helper.test(() => { + try { + throw_obj(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e.name === "error"; + } + return false; + }, "e.name === "error""); + + test_helper.test(() => { + try { + throw_error(); + } catch (e) { + let errObj: Error = e as Error; + return errObj.name === "error"; + } + return false; + }, "errObj.name === "error""); + + test_helper.test(() => { + try { + throwErrorSubClass(); // arkts-interop-ts2s-ts-exception + } catch (e) { + let errObj = e as SubError; + return errObj.extraField === 123 && errObj.foo() === 456; + } + return false; + }, "errObj.extraField === 123 && errObj.foo() === 456"); + + test_helper.test(() => { + let flag = false + try { + throwRangeError(); // arkts-interop-ts2s-ts-exception + } catch (e) { + let errObj: RangeError = e as RangeError; + return errObj instanceof RangeError; + } + return flag; + }, "Throw: throwRangeError"); + + testCaseRet.push(test_helper.done()); +} + +export function test_object_literal(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_OBJECT_LITERAL"); + + test_helper.test(() => { + let obj: ObjectLiteralClass = { name: "hello" }; // arkts-obj-literal-generate-class-instance + return obj.name === "hello" && obj instanceof ObjectLiteralClass; + }, "obj.name === "hello""); + + test_helper.test(() => { + let obj: ObjectLiteralInter = { name: "hello" }; // arkts-obj-literal-generate-class-instance + return obj.name === "hello" && obj instanceof ObjectLiteralInter; + }, "obj.name === "hello""); + + testCaseRet.push(test_helper.done()); +} + +// 1 ArkTS使用TS装饰器 +// 规则名 arkts-interop-ts2s-no-ts-decorator +// case 1 类装饰器 top level +@MyClassDecorator // arkts-no-ts-decorators + arkts-interop-ts2s-no-ts-decorator +class K {} + +//case 2 类属性装饰器 +class MyClass { + @propertyDecorator// arkts-no-ts-decorators + myProperty: string; +} + +//case 3 方法装饰器 +class MathFunctions { + @methodDecorator// arkts-no-ts-decorators + double1(value: number): number { + return value; + } +} + +//case 4 方法装饰器 +class MyClass1 { + log(value: string, @parameterDecorator metadata: any) {// arkts-no-ts-decorators + console.log(Logged: ${value}); + } +} + +//case 5 访问器装饰器 +class Person { + private _name: string; + @accessorDecorator// arkts-no-ts-decorators + get name(): string { + return this._name; + } + set name(value: string) { + this._name = value; + } +} + +//case 6 访问器工厂 +class Person1 { + private _age: number; + @readonly(true)// arkts-no-ts-decorators + get age(): number { + return this._age; + } + set age(value: number) { + this._age = value; + } +} + +namespace NS{ + // case 7 类装饰器 top level + @MyClassDecorator// arkts-no-ts-decorators + arkts-interop-ts2s-no-ts-decorator + class K {} + + //case 8 类属性装饰器 + class MyClass { + @propertyDecorator// arkts-no-ts-decorators + myProperty: string; + } + + //case 9 方法装饰器 + class MathFunctions { + @methodDecorator// arkts-no-ts-decorators + double1(value: number): number { + return value; + } + } + + //case 10 方法装饰器 + class MyClass1 { + log(value: string, @parameterDecorator metadata: any) {// arkts-no-ts-decorators + console.log(Logged: ${value}); + } + } + + //case 11 访问器装饰器 + class Person { + private _name: string; + constructor(name: string) { + this._name = name; + } + @accessorDecorator// arkts-no-ts-decorators + get name(): string { + return this._name; + } + set name(value: string) { + this._name = value; + } + } + + //case 12 访问器工厂 + class Person1 { + private _age: number; + constructor(age: number) { + this._age = age; + } + @readonly1(true)// arkts-no-ts-decorators + get age(): number { + return this._age; + } + set age(value: number) { + this._age = value; + } + } +} + +export function test_ts_boxed_type(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_TS_BOXED_TYPE"); + + test_helper.test(() => { + return typeof num_boxed === object; + }, "typeof num_boxed === object"); + + test_helper.test(() => { + return typeof bool_boxed === object; + }, "typeof bool_boxed === object"); + + test_helper.test(() => { + return typeof str_boxed === object; + }, "typeof str_boxed === object"); + + test_helper.test(() => { + return typeof bigint_boxed === object; + }, "typeof bigint_boxed === object"); + testCaseRet.push(test_helper.done()); +} + +export function test_ts_object_method(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_TS_OBJECT_METHOD"); + + test_helper.test(() => { + ts_object_method(new Object2()) + ts_object_method_getOwnPropertyDescriptor(new Object2()) + ts_object_method_getOwnPropertyDescriptors(new Object2()) + ts_object_method_getOwnPropertyNames(new Object2()) + ts_object_method_hasOwn(new Object2()) + ts_object_method_isExtensible(new Object2()) + ts_object_method_isFrozen(new Object2()) + ts_object_method_isSealed(new Object2()) + ts_object_method_keys(new Object2()) + ts_object_method_keys(new Object2()) + ts_object_method_values(new Object2()) + return true; + }, "true"); + + test_helper.test(() => { + interface Iface { + a:number + } + let a1:Iface = {a:1} + ts_object_method(a1) + ts_object_method_getOwnPropertyDescriptor(a1) + ts_object_method_getOwnPropertyDescriptors(a1) + ts_object_method_getOwnPropertyNames(a1) + ts_object_method_hasOwn(a1) + ts_object_method_isExtensible(a1) + ts_object_method_isFrozen(a1) + ts_object_method_isSealed(a1) + ts_object_method_keys(a1) + ts_object_method_keys(a1) + ts_object_method_values(a1) + return true; + }, "true"); + + test_helper.test(() => { + ts_object_method(interObj) + return true; + }, "false"); + + testCaseRet.push(test_helper.done()); +} + +class Reflect2 { + a: string = 'hello' + getName() { return this.a } } -stringType = "test" //should pass +// 5 Object内置方法作用在ArkTS对象 +// 规则名 arkts-interop-ts2s-ts-object-on-static-instance +export function test_ts_reflect_method(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_TS_REFLECT_METHOD"); + test_helper.test(() => { + ts_reflect_method(new Reflect2()) + ts_reflect_method_apply(new Reflect2()) + ts_reflect_method_defineProperty(new Reflect2()) + ts_reflect_method_deleteProperty(new Reflect2()) + ts_reflect_method_getOwnPropertyDescriptor(new Reflect2()) + ts_reflect_method_ownKeys(new Reflect2()) + ts_reflect_method_isExtensible(new Reflect2()) + ts_reflect_method_set(new Reflect2()) + ts_reflect_method_setPrototypeOf(new Reflect2()) + return true; + }, "reflect class 1.2 "); + + test_helper.test(() => { + interface Iface { + a:number + } + let a1:Iface = {a:1} + ts_reflect_method(a1) + ts_reflect_method_apply(a1) + ts_reflect_method_defineProperty(a1) + ts_reflect_method_deleteProperty(a1) + ts_reflect_method_getOwnPropertyDescriptor(a1) + ts_reflect_method_ownKeys(a1) + ts_reflect_method_isExtensible(a1) + ts_reflect_method_set(a1) + ts_reflect_method_setPrototypeOf(a1) + return true; + }, "reflect interface 1.2"); + + test_helper.test(() => { + ts_reflect_method(interObj) + ts_reflect_method_apply(interObj) + ts_reflect_method_defineProperty(interObj) + ts_reflect_method_deleteProperty(interObj) + ts_reflect_method_getOwnPropertyDescriptor(interObj) + ts_reflect_method_ownKeys(interObj) + ts_reflect_method_isExtensible(interObj) + ts_reflect_method_set(interObj) + ts_reflect_method_setPrototypeOf(interObj) + return true; + }, "reflect interObj 1.0 "); -enumType = "A"; //should fail + testCaseRet.push(test_helper.done()); +} \ 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 b3274fd874..7fb34afcb3 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.arkts2.json +++ b/ets2panda/linter/test/interop/unique_types.ets.arkts2.json @@ -15,63 +15,543 @@ ], "result": [ { - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 23, + "line": 68, + "column": 8, + "endLine": 68, + "endColumn": 15, "problem": "InteropDirectAccessToTSTypes", "suggest": "", "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, { - "line": 26, - "column": 1, - "endLine": 26, - "endColumn": 22, + "line": 69, + "column": 8, + "endLine": 69, + "endColumn": 19, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 8, + "endLine": 70, + "endColumn": 18, "problem": "InteropDirectAccessToTSTypes", "suggest": "", "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, { - "line": 29, + "line": 71, "column": 1, - "endLine": 29, + "endLine": 71, "endColumn": 13, - "problem": "InteropTSFunctionInvoke", + "problem": "ExplicitFunctionType", "suggest": "", - "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "rule": "The function type should be explicit (arkts-no-ts-like-function-call)", "severity": "ERROR" }, { - "line": 29, + "line": 71, "column": 1, - "endLine": 29, - "endColumn": 11, + "endLine": 71, + "endColumn": 13, "problem": "InteropDirectAccessToTSTypes", "suggest": "", "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, { - "line": 33, + "line": 76, + "column": 7, + "endLine": 76, + "endColumn": 69, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 76, + "column": 25, + "endLine": 76, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 80, + "column": 7, + "endLine": 80, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 30, + "endLine": 82, + "endColumn": 33, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 89, + "column": 7, + "endLine": 89, + "endColumn": 22, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 7, + "endLine": 98, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 107, + "column": 7, + "endLine": 107, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 7, + "endLine": 116, + "endColumn": 18, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 138, + "column": 36, + "endLine": 138, + "endColumn": 39, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 138, + "column": 60, + "endLine": 138, + "endColumn": 63, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 158, + "column": 7, + "endLine": 158, + "endColumn": 58, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 158, + "column": 25, + "endLine": 158, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 176, "column": 1, - "endLine": 33, + "endLine": 176, + "endColumn": 18, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 181, + "column": 3, + "endLine": 181, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 187, + "column": 3, + "endLine": 187, + "endColumn": 19, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 195, + "column": 22, + "endLine": 195, + "endColumn": 41, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 195, + "column": 52, + "endLine": 195, + "endColumn": 55, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 203, + "column": 3, + "endLine": 203, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 215, + "column": 3, + "endLine": 215, + "endColumn": 18, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 226, + "column": 3, + "endLine": 226, "endColumn": 20, - "problem": "InteropDirectAccessToTSTypes", + "problem": "DecoratorsNotSupported", "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", "severity": "ERROR" }, { - "line": 33, - "column": 1, - "endLine": 33, - "endColumn": 11, - "problem": "InteropDirectAccessToTSTypes", + "line": 231, + "column": 5, + "endLine": 231, + "endColumn": 23, + "problem": "DecoratorsNotSupported", "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 237, + "column": 5, + "endLine": 237, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 245, + "column": 24, + "endLine": 245, + "endColumn": 43, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 245, + "column": 54, + "endLine": 245, + "endColumn": 57, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 256, + "column": 5, + "endLine": 256, + "endColumn": 23, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 271, + "column": 5, + "endLine": 271, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 282, + "column": 7, + "endLine": 282, + "endColumn": 57, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 282, + "column": 25, + "endLine": 282, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 303, + "column": 7, + "endLine": 303, + "endColumn": 60, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 303, + "column": 25, + "endLine": 303, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 306, + "column": 26, + "endLine": 306, + "endColumn": 33, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 307, + "column": 51, + "endLine": 307, + "endColumn": 58, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 308, + "column": 52, + "endLine": 308, + "endColumn": 59, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 309, + "column": 46, + "endLine": 309, + "endColumn": 53, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 310, + "column": 33, + "endLine": 310, + "endColumn": 40, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 311, + "column": 39, + "endLine": 311, + "endColumn": 46, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 312, + "column": 35, + "endLine": 312, + "endColumn": 42, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 313, + "column": 35, + "endLine": 313, + "endColumn": 42, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 314, + "column": 31, + "endLine": 314, + "endColumn": 38, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 315, + "column": 31, + "endLine": 315, + "endColumn": 38, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 316, + "column": 33, + "endLine": 316, + "endColumn": 40, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 324, + "column": 23, + "endLine": 324, + "endColumn": 24, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 355, + "column": 7, + "endLine": 355, + "endColumn": 61, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 355, + "column": 25, + "endLine": 355, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 373, + "column": 23, + "endLine": 373, + "endColumn": 24, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 182, + "column": 3, + "endLine": 182, + "endColumn": 13, + "problem": "StrictDiagnostic", + "suggest": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 202, + "column": 11, + "endLine": 202, + "endColumn": 16, + "problem": "StrictDiagnostic", + "suggest": "Property '_name' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property '_name' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 214, + "column": 11, + "endLine": 214, + "endColumn": 15, + "problem": "StrictDiagnostic", + "suggest": "Property '_age' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property '_age' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 232, + "column": 5, + "endLine": 232, + "endColumn": 15, + "problem": "StrictDiagnostic", + "suggest": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/interop/unique_types.ets.autofix.json b/ets2panda/linter/test/interop/unique_types.ets.autofix.json index a6deb3a499..bdb124b2ed 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.autofix.json +++ b/ets2panda/linter/test/interop/unique_types.ets.autofix.json @@ -15,85 +15,609 @@ ], "result": [ { - "line": 24, - "column": 1, - "endLine": 24, - "endColumn": 23, + "line": 68, + "column": 8, + "endLine": 68, + "endColumn": 15, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 8, + "endLine": 69, + "endColumn": 19, "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 8, + "endLine": 70, + "endColumn": 18, + "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 1, + "endLine": 71, + "endColumn": 13, + "problem": "ExplicitFunctionType", "autofix": [ { - "start": 731, - "end": 762, - "replacementText": "objectLiteralType.setPropertyByName('name',ESValue.wrap(\"test\"))", - "line": 24, + "start": 1767, + "end": 1779, + "replacementText": "function_var.unsafeCall", + "line": 71, "column": 1, - "endLine": 24, - "endColumn": 23 + "endLine": 71, + "endColumn": 13 } ], "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "rule": "The function type should be explicit (arkts-no-ts-like-function-call)", "severity": "ERROR" }, { - "line": 26, + "line": 71, "column": 1, - "endLine": 26, - "endColumn": 22, + "endLine": 71, + "endColumn": 13, "problem": "InteropDirectAccessToTSTypes", + "suggest": "", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "severity": "ERROR" + }, + { + "line": 76, + "column": 7, + "endLine": 76, + "endColumn": 69, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 76, + "column": 25, + "endLine": 76, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 80, + "column": 7, + "endLine": 80, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 30, + "endLine": 82, + "endColumn": 33, + "problem": "NumericSemantics", "autofix": [ { - "start": 764, - "end": 794, - "replacementText": "intersectionType.setPropertyByName('name',ESValue.wrap(\"test\"))", - "line": 26, - "column": 1, - "endLine": 26, - "endColumn": 22 + "start": 2118, + "end": 2121, + "replacementText": "123.0", + "line": 82, + "column": 30, + "endLine": 82, + "endColumn": 33 } ], "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 13, + "line": 89, + "column": 7, + "endLine": 89, + "endColumn": 22, "problem": "InteropTSFunctionInvoke", "suggest": "", "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", "severity": "ERROR" }, { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 11, - "problem": "InteropDirectAccessToTSTypes", + "line": 98, + "column": 7, + "endLine": 98, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", "severity": "ERROR" }, { - "line": 33, + "line": 107, + "column": 7, + "endLine": 107, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 7, + "endLine": 116, + "endColumn": 18, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 138, + "column": 36, + "endLine": 138, + "endColumn": 39, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 3384, + "end": 3387, + "replacementText": "123.0", + "line": 138, + "column": 36, + "endLine": 138, + "endColumn": 39 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 138, + "column": 60, + "endLine": 138, + "endColumn": 63, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 3408, + "end": 3411, + "replacementText": "456.0", + "line": 138, + "column": 60, + "endLine": 138, + "endColumn": 63 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 158, + "column": 7, + "endLine": 158, + "endColumn": 58, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 158, + "column": 25, + "endLine": 158, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 176, "column": 1, - "endLine": 33, + "endLine": 176, + "endColumn": 18, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 181, + "column": 3, + "endLine": 181, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 187, + "column": 3, + "endLine": 187, + "endColumn": 19, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 195, + "column": 22, + "endLine": 195, + "endColumn": 41, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 195, + "column": 52, + "endLine": 195, + "endColumn": 55, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 203, + "column": 3, + "endLine": 203, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 215, + "column": 3, + "endLine": 215, + "endColumn": 18, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 226, + "column": 3, + "endLine": 226, "endColumn": 20, - "problem": "InteropDirectAccessToTSTypes", + "problem": "DecoratorsNotSupported", "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", "severity": "ERROR" }, { - "line": 33, - "column": 1, - "endLine": 33, - "endColumn": 11, - "problem": "InteropDirectAccessToTSTypes", + "line": 231, + "column": 5, + "endLine": 231, + "endColumn": 23, + "problem": "DecoratorsNotSupported", "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 237, + "column": 5, + "endLine": 237, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 245, + "column": 24, + "endLine": 245, + "endColumn": 43, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 245, + "column": 54, + "endLine": 245, + "endColumn": 57, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 256, + "column": 5, + "endLine": 256, + "endColumn": 23, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 271, + "column": 5, + "endLine": 271, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 282, + "column": 7, + "endLine": 282, + "endColumn": 57, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 282, + "column": 25, + "endLine": 282, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 303, + "column": 7, + "endLine": 303, + "endColumn": 60, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 303, + "column": 25, + "endLine": 303, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 306, + "column": 26, + "endLine": 306, + "endColumn": 33, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 307, + "column": 51, + "endLine": 307, + "endColumn": 58, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 308, + "column": 52, + "endLine": 308, + "endColumn": 59, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 309, + "column": 46, + "endLine": 309, + "endColumn": 53, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 310, + "column": 33, + "endLine": 310, + "endColumn": 40, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 311, + "column": 39, + "endLine": 311, + "endColumn": 46, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 312, + "column": 35, + "endLine": 312, + "endColumn": 42, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 313, + "column": 35, + "endLine": 313, + "endColumn": 42, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 314, + "column": 31, + "endLine": 314, + "endColumn": 38, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 315, + "column": 31, + "endLine": 315, + "endColumn": 38, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 316, + "column": 33, + "endLine": 316, + "endColumn": 40, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 324, + "column": 23, + "endLine": 324, + "endColumn": 24, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 7971, + "end": 7972, + "replacementText": "1.0", + "line": 324, + "column": 23, + "endLine": 324, + "endColumn": 24 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 355, + "column": 7, + "endLine": 355, + "endColumn": 61, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 355, + "column": 25, + "endLine": 355, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 373, + "column": 23, + "endLine": 373, + "endColumn": 24, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 9425, + "end": 9426, + "replacementText": "1.0", + "line": 373, + "column": 23, + "endLine": 373, + "endColumn": 24 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 182, + "column": 3, + "endLine": 182, + "endColumn": 13, + "problem": "StrictDiagnostic", + "suggest": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 202, + "column": 11, + "endLine": 202, + "endColumn": 16, + "problem": "StrictDiagnostic", + "suggest": "Property '_name' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property '_name' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 214, + "column": 11, + "endLine": 214, + "endColumn": 15, + "problem": "StrictDiagnostic", + "suggest": "Property '_age' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property '_age' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 232, + "column": 5, + "endLine": 232, + "endColumn": 15, + "problem": "StrictDiagnostic", + "suggest": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/interop/unique_types.ets.json b/ets2panda/linter/test/interop/unique_types.ets.json index ca88f857e9..017acb4fb6 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.json +++ b/ets2panda/linter/test/interop/unique_types.ets.json @@ -13,5 +13,116 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [] + "result": [ + { + "line": 76, + "column": 7, + "endLine": 76, + "endColumn": 69, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 158, + "column": 7, + "endLine": 158, + "endColumn": 58, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 195, + "column": 52, + "endLine": 195, + "endColumn": 55, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 245, + "column": 54, + "endLine": 245, + "endColumn": 57, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 282, + "column": 7, + "endLine": 282, + "endColumn": 57, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 303, + "column": 7, + "endLine": 303, + "endColumn": 60, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 355, + "column": 7, + "endLine": 355, + "endColumn": 61, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 182, + "column": 3, + "endLine": 182, + "endColumn": 13, + "problem": "StrictDiagnostic", + "suggest": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 202, + "column": 11, + "endLine": 202, + "endColumn": 16, + "problem": "StrictDiagnostic", + "suggest": "Property '_name' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property '_name' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 214, + "column": 11, + "endLine": 214, + "endColumn": 15, + "problem": "StrictDiagnostic", + "suggest": "Property '_age' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property '_age' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 232, + "column": 5, + "endLine": 232, + "endColumn": 15, + "problem": "StrictDiagnostic", + "suggest": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'myProperty' 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/interop/unique_types.ets.migrate.ets b/ets2panda/linter/test/interop/unique_types.ets.migrate.ets index 884003da24..6f0585bf51 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.migrate.ets +++ b/ets2panda/linter/test/interop/unique_types.ets.migrate.ets @@ -14,22 +14,387 @@ */ import { - objectLiteralType, - intersectionType, - tsFunction, - stringType, - enumType + any_var, + unknown_var, + symbol_var, + function_var, + A, + B, + TestHelper, + throw_number, + throw_string, + throw_boolean, + throw_bigint, + throw_obj, + throw_error, + throwErrorSubClass, + SubError, + throwRangeError, + ObjectLiteralClass, + ObjectLiteralInter, + MyClassDecorator, + propertyDecorator, + methodDecorator, + parameterDecorator, + accessorDecorator, + readonly1, + num_boxed, + bool_boxed, + str_boxed, + bigint_boxed, + ts_object_method, + ts_object_method_getOwnPropertyDescriptor, + ts_object_method_getOwnPropertyDescriptors, + ts_object_method_getOwnPropertyNames, + ts_object_method_hasOwn, + ts_object_method_isExtensible, + ts_object_method_isFrozen, + ts_object_method_isSealed, + ts_object_method_keys, + ts_object_method_values, + interObj, + ts_reflect_method, + ts_reflect_method_apply, + ts_reflect_method_defineProperty, + ts_reflect_method_deleteProperty, + ts_reflect_method_getOwnPropertyDescriptor, + ts_reflect_method_ownKeys, + ts_reflect_method_isExtensible, + ts_reflect_method_set, + ts_reflect_method_setPrototypeOf } from "./ignore_files/unique_types"; -objectLiteralType.setPropertyByName('name',ESValue.wrap("test")) -intersectionType.setPropertyByName('name',ESValue.wrap("test")); +typeof any_var === 'object'; +typeof unknown_var === 'number'; +typeof symbol_var === 'object'; +function_var.unsafeCall() === true; +A.instance; +let obj: B = { name: "hello" }; -try { -tsFunction(); -} catch (e) { +export function test_ts_non_standard_exception(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_TS_NON_STANDARD_EXCEPTION"); + + test_helper.test(() => { + try { + throw_number(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e as number === 123.0; + } + return false; + }, "e as number === 123"); + + test_helper.test(() => { + try { + throw_boolean(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e as boolean === true; + } + return false; + }, "e as boolean === true"); + + test_helper.test(() => { + try { + throw_bigint(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e as bigint === 111n; + } + return false; + }, "e as bigint === 111n"); + + test_helper.test(() => { + try { + throw_string(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e as string === "error"; + } + return false; + }, "e as string === "error""); + + test_helper.test(() => { + try { + throw_obj(); // arkts-interop-ts2s-ts-exception + } catch (e) { + return e.name === "error"; + } + return false; + }, "e.name === "error""); + + test_helper.test(() => { + try { + throw_error(); + } catch (e) { + let errObj: Error = e as Error; + return errObj.name === "error"; + } + return false; + }, "errObj.name === "error""); + + test_helper.test(() => { + try { + throwErrorSubClass(); // arkts-interop-ts2s-ts-exception + } catch (e) { + let errObj = e as SubError; + return errObj.extraField === 123.0 && errObj.foo() === 456.0; + } + return false; + }, "errObj.extraField === 123 && errObj.foo() === 456"); + + test_helper.test(() => { + let flag = false + try { + throwRangeError(); // arkts-interop-ts2s-ts-exception + } catch (e) { + let errObj: RangeError = e as RangeError; + return errObj instanceof RangeError; + } + return flag; + }, "Throw: throwRangeError"); + + testCaseRet.push(test_helper.done()); +} + +export function test_object_literal(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_OBJECT_LITERAL"); + + test_helper.test(() => { + let obj: ObjectLiteralClass = { name: "hello" }; // arkts-obj-literal-generate-class-instance + return obj.name === "hello" && obj instanceof ObjectLiteralClass; + }, "obj.name === "hello""); + + test_helper.test(() => { + let obj: ObjectLiteralInter = { name: "hello" }; // arkts-obj-literal-generate-class-instance + return obj.name === "hello" && obj instanceof ObjectLiteralInter; + }, "obj.name === "hello""); + + testCaseRet.push(test_helper.done()); +} + +// 1 ArkTS使用TS装饰器 +// 规则名 arkts-interop-ts2s-no-ts-decorator +// case 1 类装饰器 top level +@MyClassDecorator // arkts-no-ts-decorators + arkts-interop-ts2s-no-ts-decorator +class K {} + +//case 2 类属性装饰器 +class MyClass { + @propertyDecorator// arkts-no-ts-decorators + myProperty: string; +} + +//case 3 方法装饰器 +class MathFunctions { + @methodDecorator// arkts-no-ts-decorators + double1(value: number): number { + return value; + } +} + +//case 4 方法装饰器 +class MyClass1 { + log(value: string, @parameterDecorator metadata: any) {// arkts-no-ts-decorators + console.log(Logged: ${value}); + } +} + +//case 5 访问器装饰器 +class Person { + private _name: string; + @accessorDecorator// arkts-no-ts-decorators + get name(): string { + return this._name; + } + set name(value: string) { + this._name = value; + } +} + +//case 6 访问器工厂 +class Person1 { + private _age: number; + @readonly(true)// arkts-no-ts-decorators + get age(): number { + return this._age; + } + set age(value: number) { + this._age = value; + } +} + +namespace NS{ + // case 7 类装饰器 top level + @MyClassDecorator// arkts-no-ts-decorators + arkts-interop-ts2s-no-ts-decorator + class K {} + + //case 8 类属性装饰器 + class MyClass { + @propertyDecorator// arkts-no-ts-decorators + myProperty: string; + } + + //case 9 方法装饰器 + class MathFunctions { + @methodDecorator// arkts-no-ts-decorators + double1(value: number): number { + return value; + } + } + + //case 10 方法装饰器 + class MyClass1 { + log(value: string, @parameterDecorator metadata: any) {// arkts-no-ts-decorators + console.log(Logged: ${value}); + } + } + + //case 11 访问器装饰器 + class Person { + private _name: string; + constructor(name: string) { + this._name = name; + } + @accessorDecorator// arkts-no-ts-decorators + get name(): string { + return this._name; + } + set name(value: string) { + this._name = value; + } + } + + //case 12 访问器工厂 + class Person1 { + private _age: number; + constructor(age: number) { + this._age = age; + } + @readonly1(true)// arkts-no-ts-decorators + get age(): number { + return this._age; + } + set age(value: number) { + this._age = value; + } + } +} + +export function test_ts_boxed_type(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_TS_BOXED_TYPE"); + + test_helper.test(() => { + return typeof num_boxed === object; + }, "typeof num_boxed === object"); + + test_helper.test(() => { + return typeof bool_boxed === object; + }, "typeof bool_boxed === object"); + + test_helper.test(() => { + return typeof str_boxed === object; + }, "typeof str_boxed === object"); + + test_helper.test(() => { + return typeof bigint_boxed === object; + }, "typeof bigint_boxed === object"); + testCaseRet.push(test_helper.done()); +} + +export function test_ts_object_method(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_TS_OBJECT_METHOD"); + + test_helper.test(() => { + ts_object_method(new Object2()) + ts_object_method_getOwnPropertyDescriptor(new Object2()) + ts_object_method_getOwnPropertyDescriptors(new Object2()) + ts_object_method_getOwnPropertyNames(new Object2()) + ts_object_method_hasOwn(new Object2()) + ts_object_method_isExtensible(new Object2()) + ts_object_method_isFrozen(new Object2()) + ts_object_method_isSealed(new Object2()) + ts_object_method_keys(new Object2()) + ts_object_method_keys(new Object2()) + ts_object_method_values(new Object2()) + return true; + }, "true"); + + test_helper.test(() => { + interface Iface { + a:number + } + let a1:Iface = {a:1.0} + ts_object_method(a1) + ts_object_method_getOwnPropertyDescriptor(a1) + ts_object_method_getOwnPropertyDescriptors(a1) + ts_object_method_getOwnPropertyNames(a1) + ts_object_method_hasOwn(a1) + ts_object_method_isExtensible(a1) + ts_object_method_isFrozen(a1) + ts_object_method_isSealed(a1) + ts_object_method_keys(a1) + ts_object_method_keys(a1) + ts_object_method_values(a1) + return true; + }, "true"); + + test_helper.test(() => { + ts_object_method(interObj) + return true; + }, "false"); + + testCaseRet.push(test_helper.done()); +} + +class Reflect2 { + a: string = 'hello' + getName() { return this.a } } -stringType = "test" //should pass +// 5 Object内置方法作用在ArkTS对象 +// 规则名 arkts-interop-ts2s-ts-object-on-static-instance +export function test_ts_reflect_method(testCaseRet: Array) { + let test_helper = new TestHelper("TEST_TS_REFLECT_METHOD"); + test_helper.test(() => { + ts_reflect_method(new Reflect2()) + ts_reflect_method_apply(new Reflect2()) + ts_reflect_method_defineProperty(new Reflect2()) + ts_reflect_method_deleteProperty(new Reflect2()) + ts_reflect_method_getOwnPropertyDescriptor(new Reflect2()) + ts_reflect_method_ownKeys(new Reflect2()) + ts_reflect_method_isExtensible(new Reflect2()) + ts_reflect_method_set(new Reflect2()) + ts_reflect_method_setPrototypeOf(new Reflect2()) + return true; + }, "reflect class 1.2 "); + + test_helper.test(() => { + interface Iface { + a:number + } + let a1:Iface = {a:1.0} + ts_reflect_method(a1) + ts_reflect_method_apply(a1) + ts_reflect_method_defineProperty(a1) + ts_reflect_method_deleteProperty(a1) + ts_reflect_method_getOwnPropertyDescriptor(a1) + ts_reflect_method_ownKeys(a1) + ts_reflect_method_isExtensible(a1) + ts_reflect_method_set(a1) + ts_reflect_method_setPrototypeOf(a1) + return true; + }, "reflect interface 1.2"); + + test_helper.test(() => { + ts_reflect_method(interObj) + ts_reflect_method_apply(interObj) + ts_reflect_method_defineProperty(interObj) + ts_reflect_method_deleteProperty(interObj) + ts_reflect_method_getOwnPropertyDescriptor(interObj) + ts_reflect_method_ownKeys(interObj) + ts_reflect_method_isExtensible(interObj) + ts_reflect_method_set(interObj) + ts_reflect_method_setPrototypeOf(interObj) + return true; + }, "reflect interObj 1.0 "); -enumType = "A"; //should fail + testCaseRet.push(test_helper.done()); +} \ 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 6e0fbe1a85..e78688989e 100644 --- a/ets2panda/linter/test/interop/unique_types.ets.migrate.json +++ b/ets2panda/linter/test/interop/unique_types.ets.migrate.json @@ -15,43 +15,473 @@ ], "result": [ { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 13, - "problem": "InteropTSFunctionInvoke", + "line": 68, + "column": 8, + "endLine": 68, + "endColumn": 15, + "problem": "InteropDirectAccessToTSTypes", "suggest": "", - "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, { - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 11, + "line": 69, + "column": 8, + "endLine": 69, + "endColumn": 19, "problem": "InteropDirectAccessToTSTypes", "suggest": "", "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, { - "line": 33, - "column": 1, - "endLine": 33, - "endColumn": 20, + "line": 70, + "column": 8, + "endLine": 70, + "endColumn": 18, "problem": "InteropDirectAccessToTSTypes", "suggest": "", "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", "severity": "ERROR" }, { - "line": 33, + "line": 76, + "column": 7, + "endLine": 76, + "endColumn": 69, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 76, + "column": 25, + "endLine": 76, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 80, + "column": 7, + "endLine": 80, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 89, + "column": 7, + "endLine": 89, + "endColumn": 22, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 7, + "endLine": 98, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 107, + "column": 7, + "endLine": 107, + "endColumn": 21, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 7, + "endLine": 116, + "endColumn": 18, + "problem": "InteropTSFunctionInvoke", + "suggest": "", + "rule": "Trying to catch typescript errors is not permitted (arkts-interop-ts2s-ts-exception)", + "severity": "ERROR" + }, + { + "line": 158, + "column": 7, + "endLine": 158, + "endColumn": 58, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 158, + "column": 25, + "endLine": 158, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 176, "column": 1, - "endLine": 33, - "endColumn": 11, - "problem": "InteropDirectAccessToTSTypes", + "endLine": 176, + "endColumn": 18, + "problem": "DecoratorsNotSupported", "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 181, + "column": 3, + "endLine": 181, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 187, + "column": 3, + "endLine": 187, + "endColumn": 19, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 195, + "column": 22, + "endLine": 195, + "endColumn": 41, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 195, + "column": 52, + "endLine": 195, + "endColumn": 55, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 203, + "column": 3, + "endLine": 203, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 215, + "column": 3, + "endLine": 215, + "endColumn": 18, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 226, + "column": 3, + "endLine": 226, + "endColumn": 20, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 231, + "column": 5, + "endLine": 231, + "endColumn": 23, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 237, + "column": 5, + "endLine": 237, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 245, + "column": 24, + "endLine": 245, + "endColumn": 43, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 245, + "column": 54, + "endLine": 245, + "endColumn": 57, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 256, + "column": 5, + "endLine": 256, + "endColumn": 23, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 271, + "column": 5, + "endLine": 271, + "endColumn": 21, + "problem": "DecoratorsNotSupported", + "suggest": "", + "rule": "Decorators are not supported(arkts-no-ts-decorators)", + "severity": "ERROR" + }, + { + "line": 282, + "column": 7, + "endLine": 282, + "endColumn": 57, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 282, + "column": 25, + "endLine": 282, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 303, + "column": 7, + "endLine": 303, + "endColumn": 60, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 303, + "column": 25, + "endLine": 303, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 306, + "column": 26, + "endLine": 306, + "endColumn": 33, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 307, + "column": 51, + "endLine": 307, + "endColumn": 58, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 308, + "column": 52, + "endLine": 308, + "endColumn": 59, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 309, + "column": 46, + "endLine": 309, + "endColumn": 53, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 310, + "column": 33, + "endLine": 310, + "endColumn": 40, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 311, + "column": 39, + "endLine": 311, + "endColumn": 46, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 312, + "column": 35, + "endLine": 312, + "endColumn": 42, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 313, + "column": 35, + "endLine": 313, + "endColumn": 42, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 314, + "column": 31, + "endLine": 314, + "endColumn": 38, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 315, + "column": 31, + "endLine": 315, + "endColumn": 38, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 316, + "column": 33, + "endLine": 316, + "endColumn": 40, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 355, + "column": 7, + "endLine": 355, + "endColumn": 61, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 355, + "column": 25, + "endLine": 355, + "endColumn": 35, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 182, + "column": 3, + "endLine": 182, + "endColumn": 13, + "problem": "StrictDiagnostic", + "suggest": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 202, + "column": 11, + "endLine": 202, + "endColumn": 16, + "problem": "StrictDiagnostic", + "suggest": "Property '_name' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property '_name' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 214, + "column": 11, + "endLine": 214, + "endColumn": 15, + "problem": "StrictDiagnostic", + "suggest": "Property '_age' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property '_age' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, + { + "line": 232, + "column": 5, + "endLine": 232, + "endColumn": 15, + "problem": "StrictDiagnostic", + "suggest": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'myProperty' has no initializer and is not definitely assigned in the constructor.", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.autofix.json b/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.autofix.json index bedac192c9..15853498f4 100644 --- a/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.autofix.json +++ b/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.autofix.json @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n TextAttribute,\n AnimatableExtend,\n Entry,\n Component,\n State,\n Column,\n Text,\n Curve,\n Button,\n} from '@kit.ArkUI';", "line": 31, "column": 7, "endLine": 31, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n TextAttribute,\n AnimatableExtend,\n Entry,\n Component,\n State,\n Column,\n Text,\n Curve,\n Button,\n} from '@kit.ArkUI';", "line": 31, "column": 7, "endLine": 31, @@ -213,7 +213,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n TextAttribute,\n AnimatableExtend,\n Entry,\n Component,\n State,\n Column,\n Text,\n Curve,\n Button,\n} from '@kit.ArkUI';", "line": 31, "column": 7, "endLine": 31, @@ -234,7 +234,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n TextAttribute,\n AnimatableExtend,\n Entry,\n Component,\n State,\n Column,\n Text,\n Curve,\n Button,\n} from '@kit.ArkUI';", "line": 31, "column": 7, "endLine": 31, @@ -255,7 +255,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n TextAttribute,\n AnimatableExtend,\n Entry,\n Component,\n State,\n Column,\n Text,\n Curve,\n Button,\n} from '@kit.ArkUI';", "line": 31, "column": 7, "endLine": 31, @@ -276,7 +276,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n TextAttribute,\n AnimatableExtend,\n Entry,\n Component,\n State,\n Column,\n Text,\n Curve,\n Button,\n} from '@kit.ArkUI';", "line": 31, "column": 7, "endLine": 31, @@ -297,7 +297,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n TextAttribute,\n AnimatableExtend,\n Entry,\n Component,\n State,\n Column,\n Text,\n Curve,\n Button,\n} from '@kit.ArkUI';", "line": 31, "column": 7, "endLine": 31, @@ -318,7 +318,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n TextAttribute,\n AnimatableExtend,\n Entry,\n Component,\n State,\n Column,\n Text,\n Curve,\n Button,\n} from '@kit.ArkUI';", "line": 31, "column": 7, "endLine": 31, diff --git a/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.migrate.ets b/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.migrate.ets index cc98fd6d8d..5404e94034 100644 --- a/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.migrate.ets @@ -13,7 +13,17 @@ * limitations under the License. */ -import { TextAttribute, AnimatableExtend, Entry, Component, State, Column, Text, Curve, Button } from '@kit.ArkUI'; +import { + TextAttribute, + AnimatableExtend, + Entry, + Component, + State, + Column, + Text, + Curve, + Button, +} from '@kit.ArkUI'; @AnimatableExtend function animatableWidth(this: TextAttribute, width: number): this { diff --git a/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.migrate.json b/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.migrate.json index 32075de8ac..7ed822c159 100644 --- a/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.migrate.json +++ b/ets2panda/linter/test/main/animatable_extend_decorator_1.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 20, + "line": 30, "column": 5, - "endLine": 20, + "endLine": 30, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 21, + "line": 31, "column": 12, - "endLine": 21, + "endLine": 31, "endColumn": 16, "problem": "FunctionContainsThis", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 19, + "line": 29, "column": 26, - "endLine": 19, + "endLine": 29, "endColumn": 30, "problem": "InvalidIdentifier", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 19, + "line": 29, "column": 63, - "endLine": 19, + "endLine": 29, "endColumn": 67, "problem": "ThisType", "suggest": "", diff --git a/ets2panda/linter/test/main/arkts-array-type-immutable.ets b/ets2panda/linter/test/main/arkts-array-type-immutable.ets index c0d79ba065..8f805d8229 100644 --- a/ets2panda/linter/test/main/arkts-array-type-immutable.ets +++ b/ets2panda/linter/test/main/arkts-array-type-immutable.ets @@ -37,7 +37,7 @@ function test(a: number[]): void { } let arrayTypeImmutableA2: [number] = [1]; -let arrayTypeImmutableB2: [number | string] = arrayTypeImmutableA2; +let arrayTypeImmutableB2: [number | string] = arrayTypeImmutableA2; // error class ArrayTypeImmutableA{ arrayTypeImmutableA: number[] = [1]; @@ -45,8 +45,8 @@ class ArrayTypeImmutableA{ arrayTypeImmutableB1: (number | string)[] = this.arrayTypeImmutableA; // error arrayTypeImmutableA2: [number] = [1]; - arrayTypeImmutableB2: [number | string] = arrayTypeImmutableA2; - arrayTypeImmutableB21: [number | string] = this.arrayTypeImmutableA2; + arrayTypeImmutableB2: [number | string] = arrayTypeImmutableA2; // error + arrayTypeImmutableB21: [number | string] = this.arrayTypeImmutableA2; // error } interface IA { 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 fa6b50ae6c..e2441885c3 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 @@ -134,6 +134,16 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, + { + "line": 40, + "column": 5, + "endLine": 40, + "endColumn": 67, + "problem": "ArrayTypeImmutable", + "suggest": "", + "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", + "severity": "ERROR" + }, { "line": 43, "column": 36, @@ -174,6 +184,26 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, + { + "line": 48, + "column": 3, + "endLine": 48, + "endColumn": 66, + "problem": "ArrayTypeImmutable", + "suggest": "", + "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 3, + "endLine": 49, + "endColumn": 72, + "problem": "ArrayTypeImmutable", + "suggest": "", + "rule": "Array type is immutable in ArkTS1.2 (arkts-array-type-immutable)", + "severity": "ERROR" + }, { "line": 67, "column": 6, diff --git a/ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets b/ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets new file mode 100755 index 0000000000..54a185e6c9 --- /dev/null +++ b/ets2panda/linter/test/main/arkts_promise_need_void_resolve.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. + */ + +function test(): Promise{ + return new Promise((resolve: () => void, reject) => { resolve() }) } \ No newline at end of file diff --git a/ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets.args.json b/ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets.args.json new file mode 100755 index 0000000000..b9d72da174 --- /dev/null +++ b/ets2panda/linter/test/main/arkts_promise_need_void_resolve.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/main/arkts_promise_need_void_resolve.ets.arkts2.json b/ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets.arkts2.json new file mode 100755 index 0000000000..83f403ba1f --- /dev/null +++ b/ets2panda/linter/test/main/arkts_promise_need_void_resolve.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": 40, + "endLine": 17, + "endColumn": 50, + "problem": "PromiseVoidNeedResolveArg", + "suggest": "", + "rule": "Promiseconstructor only supports using resolve (undefined) (arkts-promise-with-void-type-need-undefined-as-resolve-arg)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets.json b/ets2panda/linter/test/main/arkts_promise_need_void_resolve.ets.json new file mode 100755 index 0000000000..127a98a334 --- /dev/null +++ b/ets2panda/linter/test/main/arkts_promise_need_void_resolve.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/avoid_using_union_types.ets b/ets2panda/linter/test/main/avoid_using_union_types.ets index 4b633916d9..da1290b868 100644 --- a/ets2panda/linter/test/main/avoid_using_union_types.ets +++ b/ets2panda/linter/test/main/avoid_using_union_types.ets @@ -36,4 +36,12 @@ function foo(a: A | B | C) { } let data: Uint8Array = new Uint8Array(); -let reqPb = data.buffer.slice(data.byteOffset, data.byteLength + data.byteOffset); \ No newline at end of file +let reqPb = data.buffer.slice(data.byteOffset, data.byteLength + data.byteOffset); +class D { + tt() {} +} +class E { + tt() {} +} +let ab: D|E = new D(); +ab.tt(); \ No newline at end of file diff --git a/ets2panda/linter/test/main/custom_layout.ets.arkts2.json b/ets2panda/linter/test/main/custom_layout.ets.arkts2.json index afc0270a64..56fe9a2758 100644 --- a/ets2panda/linter/test/main/custom_layout.ets.arkts2.json +++ b/ets2panda/linter/test/main/custom_layout.ets.arkts2.json @@ -111,7 +111,7 @@ "endColumn": 21, "problem": "CustomLayoutNeedAddDecorator", "suggest": "", - "rule": "Custom components with custom layout capability need to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", + "rule": "The Custom component \"CustomLayout1\" with custom layout capability needs to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", "severity": "ERROR" }, { @@ -181,7 +181,7 @@ "endColumn": 21, "problem": "CustomLayoutNeedAddDecorator", "suggest": "", - "rule": "Custom components with custom layout capability need to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", + "rule": "The Custom component \"CustomLayout2\" with custom layout capability needs to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", "severity": "ERROR" }, { @@ -271,7 +271,7 @@ "endColumn": 21, "problem": "CustomLayoutNeedAddDecorator", "suggest": "", - "rule": "Custom components with custom layout capability need to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", + "rule": "The Custom component \"CustomLayout3\" with custom layout capability needs to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/custom_layout.ets.autofix.json b/ets2panda/linter/test/main/custom_layout.ets.autofix.json index ac5f81be97..23fd6cb93c 100644 --- a/ets2panda/linter/test/main/custom_layout.ets.autofix.json +++ b/ets2panda/linter/test/main/custom_layout.ets.autofix.json @@ -221,7 +221,7 @@ } ], "suggest": "", - "rule": "Custom components with custom layout capability need to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", + "rule": "The Custom component \"CustomLayout1\" with custom layout capability needs to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", "severity": "ERROR" }, { @@ -368,7 +368,7 @@ } ], "suggest": "", - "rule": "Custom components with custom layout capability need to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", + "rule": "The Custom component \"CustomLayout2\" with custom layout capability needs to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", "severity": "ERROR" }, { @@ -557,7 +557,7 @@ } ], "suggest": "", - "rule": "Custom components with custom layout capability need to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", + "rule": "The Custom component \"CustomLayout3\" with custom layout capability needs to add the \"@CustomLayout\" decorator (arkui-custom-layout-need-add-decorator)", "severity": "ERROR" }, { @@ -801,7 +801,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -822,7 +822,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -843,7 +843,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -864,7 +864,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -885,7 +885,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -906,7 +906,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -927,7 +927,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -948,7 +948,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -969,7 +969,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -990,7 +990,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1011,7 +1011,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1032,7 +1032,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1053,7 +1053,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1074,7 +1074,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1095,7 +1095,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1116,7 +1116,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1137,7 +1137,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1158,7 +1158,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1179,7 +1179,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1200,7 +1200,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1221,7 +1221,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1242,7 +1242,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1263,7 +1263,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1284,7 +1284,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1305,7 +1305,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1326,7 +1326,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1347,7 +1347,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1368,7 +1368,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1389,7 +1389,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1410,7 +1410,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1431,7 +1431,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1452,7 +1452,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1473,7 +1473,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1494,7 +1494,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1515,7 +1515,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, @@ -1536,7 +1536,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n Column,\n Builder,\n ForEach,\n Text,\n BuilderParam,\n State,\n SizeResult,\n GeometryInfo,\n Layoutable,\n ConstraintSizeOptions,\n Measurable,\n MeasureResult,\n} from '@kit.ArkUI';", "line": 133, "column": 2, "endLine": 133, diff --git a/ets2panda/linter/test/main/custom_layout.ets.migrate.ets b/ets2panda/linter/test/main/custom_layout.ets.migrate.ets index 5053380e4c..4af3bc0901 100644 --- a/ets2panda/linter/test/main/custom_layout.ets.migrate.ets +++ b/ets2panda/linter/test/main/custom_layout.ets.migrate.ets @@ -15,7 +15,22 @@ import { CustomLayout } from '@kit.ArkUI'; -import { Entry, Component, Column, Builder, ForEach, Text, BuilderParam, State, SizeResult, GeometryInfo, Layoutable, ConstraintSizeOptions, Measurable, MeasureResult } from '@kit.ArkUI'; +import { + Entry, + Component, + Column, + Builder, + ForEach, + Text, + BuilderParam, + State, + SizeResult, + GeometryInfo, + Layoutable, + ConstraintSizeOptions, + Measurable, + MeasureResult, +} from '@kit.ArkUI'; @Entry @Component diff --git a/ets2panda/linter/test/main/custom_layout.ets.migrate.json b/ets2panda/linter/test/main/custom_layout.ets.migrate.json index 21ac1fc70c..05a4428e94 100644 --- a/ets2panda/linter/test/main/custom_layout.ets.migrate.json +++ b/ets2panda/linter/test/main/custom_layout.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 45, + "line": 60, "column": 1, - "endLine": 45, + "endLine": 60, "endColumn": 14, "problem": "DecoratorsNotSupported", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 72, + "line": 87, "column": 1, - "endLine": 72, + "endLine": 87, "endColumn": 14, "problem": "DecoratorsNotSupported", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 103, + "line": 118, "column": 1, - "endLine": 103, + "endLine": 118, "endColumn": 14, "problem": "DecoratorsNotSupported", "suggest": "", diff --git a/ets2panda/linter/test/main/dollar_binding_1.ets.autofix.json b/ets2panda/linter/test/main/dollar_binding_1.ets.autofix.json index 3987f67867..e75da4ad63 100644 --- a/ets2panda/linter/test/main/dollar_binding_1.ets.autofix.json +++ b/ets2panda/linter/test/main/dollar_binding_1.ets.autofix.json @@ -108,7 +108,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Link, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Link,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 39, "column": 7, "endLine": 39, @@ -129,7 +129,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Link, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Link,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 39, "column": 7, "endLine": 39, @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Link, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Link,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 39, "column": 7, "endLine": 39, @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Link, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Link,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 39, "column": 7, "endLine": 39, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Link, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Link,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 39, "column": 7, "endLine": 39, @@ -213,7 +213,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Link, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Link,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 39, "column": 7, "endLine": 39, @@ -234,7 +234,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Link, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Link,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 39, "column": 7, "endLine": 39, @@ -255,7 +255,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Link, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Link,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 39, "column": 7, "endLine": 39, diff --git a/ets2panda/linter/test/main/dollar_binding_1.ets.migrate.ets b/ets2panda/linter/test/main/dollar_binding_1.ets.migrate.ets index aa775da121..305664a70e 100644 --- a/ets2panda/linter/test/main/dollar_binding_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/dollar_binding_1.ets.migrate.ets @@ -13,7 +13,14 @@ * limitations under the License. */ -import { Component, State, Column, Link, Row, Text } from '@kit.ArkUI'; +import { + Component, + State, + Column, + Link, + Row, + Text, +} from '@kit.ArkUI'; @Component struct MyComponent { diff --git a/ets2panda/linter/test/main/double_dollar_binding_1.ets.autofix.json b/ets2panda/linter/test/main/double_dollar_binding_1.ets.autofix.json index b76e000be1..441c4d3b9a 100644 --- a/ets2panda/linter/test/main/double_dollar_binding_1.ets.autofix.json +++ b/ets2panda/linter/test/main/double_dollar_binding_1.ets.autofix.json @@ -87,7 +87,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -108,7 +108,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -129,7 +129,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -213,7 +213,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -234,7 +234,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -255,7 +255,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, @@ -276,7 +276,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n} from '@kit.ArkUI';", "line": 37, "column": 7, "endLine": 37, diff --git a/ets2panda/linter/test/main/double_dollar_binding_1.ets.migrate.ets b/ets2panda/linter/test/main/double_dollar_binding_1.ets.migrate.ets index bb6147cf5b..526e8fd4e0 100644 --- a/ets2panda/linter/test/main/double_dollar_binding_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/double_dollar_binding_1.ets.migrate.ets @@ -13,7 +13,16 @@ * limitations under the License. */ -import { Component, State, Row, Slider, $$, Checkbox, Blank, Text } from '@kit.ArkUI'; +import { + Component, + State, + Row, + Slider, + $$, + Checkbox, + Blank, + Text, +} from '@kit.ArkUI'; @Component struct MyComponent { diff --git a/ets2panda/linter/test/main/double_excla_binding_1.ets.autofix.json b/ets2panda/linter/test/main/double_excla_binding_1.ets.autofix.json index 4115b5173b..f70c84d164 100644 --- a/ets2panda/linter/test/main/double_excla_binding_1.ets.autofix.json +++ b/ets2panda/linter/test/main/double_excla_binding_1.ets.autofix.json @@ -255,7 +255,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -276,7 +276,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -297,7 +297,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -318,7 +318,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -339,7 +339,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -360,7 +360,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -381,7 +381,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -402,7 +402,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -423,7 +423,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -444,7 +444,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -465,7 +465,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -486,7 +486,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -507,7 +507,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -528,7 +528,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -549,7 +549,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -570,7 +570,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -591,7 +591,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -612,7 +612,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -633,7 +633,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -654,7 +654,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -675,7 +675,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -696,7 +696,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -717,7 +717,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -738,7 +738,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -759,7 +759,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -780,7 +780,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -801,7 +801,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -822,7 +822,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -843,7 +843,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -864,7 +864,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -885,7 +885,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -906,7 +906,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -927,7 +927,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -948,7 +948,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, @@ -969,7 +969,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Row,\n Slider,\n $$,\n Checkbox,\n Blank,\n Text,\n Entry,\n ComponentV2,\n Local,\n Column,\n Button,\n Param,\n Event,\n} from '@kit.ArkUI';", "line": 107, "column": 7, "endLine": 107, diff --git a/ets2panda/linter/test/main/double_excla_binding_1.ets.migrate.ets b/ets2panda/linter/test/main/double_excla_binding_1.ets.migrate.ets index 6f1805da3f..e95837b57f 100644 --- a/ets2panda/linter/test/main/double_excla_binding_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/double_excla_binding_1.ets.migrate.ets @@ -13,7 +13,23 @@ * limitations under the License. */ -import { Component, State, Row, Slider, $$, Checkbox, Blank, Text, Entry, ComponentV2, Local, Column, Button, Param, Event } from '@kit.ArkUI'; +import { + Component, + State, + Row, + Slider, + $$, + Checkbox, + Blank, + Text, + Entry, + ComponentV2, + Local, + Column, + Button, + Param, + Event, +} from '@kit.ArkUI'; import { MyCard } from './' diff --git a/ets2panda/linter/test/main/double_excla_binding_1.ets.migrate.json b/ets2panda/linter/test/main/double_excla_binding_1.ets.migrate.json index c697fe6484..83e5c37e26 100644 --- a/ets2panda/linter/test/main/double_excla_binding_1.ets.migrate.json +++ b/ets2panda/linter/test/main/double_excla_binding_1.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 102, + "line": 118, "column": 15, - "endLine": 102, + "endLine": 118, "endColumn": 20, "problem": "AnyType", "suggest": "", diff --git a/ets2panda/linter/test/main/double_excla_binding_3.ets.autofix.json b/ets2panda/linter/test/main/double_excla_binding_3.ets.autofix.json index 36d4ed4525..7b9fc728ca 100644 --- a/ets2panda/linter/test/main/double_excla_binding_3.ets.autofix.json +++ b/ets2panda/linter/test/main/double_excla_binding_3.ets.autofix.json @@ -24,7 +24,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 29, "column": 7, "endLine": 29, @@ -45,7 +45,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 29, "column": 7, "endLine": 29, @@ -66,7 +66,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 29, "column": 7, "endLine": 29, @@ -87,7 +87,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 29, "column": 7, "endLine": 29, @@ -108,7 +108,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 29, "column": 7, "endLine": 29, @@ -129,7 +129,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 29, "column": 7, "endLine": 29, @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n} from '@kit.ArkUI';", "line": 29, "column": 7, "endLine": 29, diff --git a/ets2panda/linter/test/main/double_excla_binding_3.ets.migrate.ets b/ets2panda/linter/test/main/double_excla_binding_3.ets.migrate.ets index b646a64c49..78c6487540 100644 --- a/ets2panda/linter/test/main/double_excla_binding_3.ets.migrate.ets +++ b/ets2panda/linter/test/main/double_excla_binding_3.ets.migrate.ets @@ -13,7 +13,13 @@ * limitations under the License. */ -import { Entry, Component, State, Row, Text } from '@kit.ArkUI'; +import { + Entry, + Component, + State, + Row, + Text, +} from '@kit.ArkUI'; class User { name: string = "Jack" diff --git a/ets2panda/linter/test/main/dynamic_ctor_call.ets.arkts2.json b/ets2panda/linter/test/main/dynamic_ctor_call.ets.arkts2.json index b4ee74500e..0ef26c352d 100644 --- a/ets2panda/linter/test/main/dynamic_ctor_call.ets.arkts2.json +++ b/ets2panda/linter/test/main/dynamic_ctor_call.ets.arkts2.json @@ -124,16 +124,6 @@ "rule": "Construct signatures are not supported in interfaces (arkts-no-ctor-signatures-iface)", "severity": "ERROR" }, - { - "line": 39, - "column": 14, - "endLine": 39, - "endColumn": 18, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 39, "column": 14, diff --git a/ets2panda/linter/test/main/explicit_function_type.ets b/ets2panda/linter/test/main/explicit_function_type.ets index 9b44052197..c42f90e3fb 100755 --- a/ets2panda/linter/test/main/explicit_function_type.ets +++ b/ets2panda/linter/test/main/explicit_function_type.ets @@ -172,4 +172,9 @@ let ab3 = new AB3(); ab3.fn3(); const fn29: Function[] = []; -fn29[1](); \ No newline at end of file +fn29[1](); + +SysApiWrapper.setTimeout = (handler: Function | string, delay?: number): number => { + (handler as Function)?.(); + return Math.random(); +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/explicit_function_type.ets.arkts2.json b/ets2panda/linter/test/main/explicit_function_type.ets.arkts2.json index 54fab7a23c..3427352803 100755 --- a/ets2panda/linter/test/main/explicit_function_type.ets.arkts2.json +++ b/ets2panda/linter/test/main/explicit_function_type.ets.arkts2.json @@ -343,6 +343,16 @@ "suggest": "", "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" + }, + { + "line": 178, + "column": 3, + "endLine": 178, + "endColumn": 24, + "problem": "ExplicitFunctionType", + "suggest": "", + "rule": "The function type should be explicit (arkts-no-ts-like-function-call)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/explicit_function_type.ets.autofix.json b/ets2panda/linter/test/main/explicit_function_type.ets.autofix.json index a9ddde793c..9512b29aac 100644 --- a/ets2panda/linter/test/main/explicit_function_type.ets.autofix.json +++ b/ets2panda/linter/test/main/explicit_function_type.ets.autofix.json @@ -106,9 +106,9 @@ "problem": "ExplicitFunctionType", "autofix": [ { - "replacementText": "fn.unsafeCall", "start": 1572, "end": 1574, + "replacementText": "fn.unsafeCall", "line": 57, "column": 3, "endLine": 57, @@ -374,9 +374,9 @@ "problem": "ExplicitFunctionType", "autofix": [ { - "replacementText": "callback.unsafeCall", "start": 2921, "end": 2929, + "replacementText": "callback.unsafeCall", "line": 139, "column": 3, "endLine": 139, @@ -446,9 +446,9 @@ "problem": "ExplicitFunctionType", "autofix": [ { - "replacementText": "curr.unsafeCall", "start": 3458, "end": 3462, + "replacementText": "curr.unsafeCall", "line": 160, "column": 62, "endLine": 160, @@ -467,9 +467,9 @@ "problem": "ExplicitFunctionType", "autofix": [ { - "replacementText": "prev.unsafeCall", "start": 3463, "end": 3467, + "replacementText": "prev.unsafeCall", "line": 160, "column": 67, "endLine": 160, @@ -488,9 +488,9 @@ "problem": "ExplicitFunctionType", "autofix": [ { - "replacementText": "f1.unsafeCall", "start": 3586, "end": 3588, + "replacementText": "f1.unsafeCall", "line": 166, "column": 1, "endLine": 166, @@ -509,9 +509,9 @@ "problem": "ExplicitFunctionType", "autofix": [ { - "replacementText": "ab3.fn3.unsafeCall", "start": 3656, "end": 3663, + "replacementText": "ab3.fn3.unsafeCall", "line": 172, "column": 1, "endLine": 172, @@ -530,9 +530,9 @@ "problem": "ExplicitFunctionType", "autofix": [ { - "replacementText": "fn29[1].unsafeCall", "start": 3697, "end": 3704, + "replacementText": "fn29[1].unsafeCall", "line": 175, "column": 1, "endLine": 175, @@ -552,6 +552,27 @@ "suggest": "", "rule": "Array bound not checked. (arkts-runtime-array-check)", "severity": "ERROR" + }, + { + "line": 178, + "column": 3, + "endLine": 178, + "endColumn": 24, + "problem": "ExplicitFunctionType", + "autofix": [ + { + "start": 3796, + "end": 3819, + "replacementText": "(handler as Function)?.unsafeCall", + "line": 178, + "column": 3, + "endLine": 178, + "endColumn": 24 + } + ], + "suggest": "", + "rule": "The function type should be explicit (arkts-no-ts-like-function-call)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/explicit_function_type.ets.migrate.ets b/ets2panda/linter/test/main/explicit_function_type.ets.migrate.ets index 7d20e3f229..c5ecffb429 100644 --- a/ets2panda/linter/test/main/explicit_function_type.ets.migrate.ets +++ b/ets2panda/linter/test/main/explicit_function_type.ets.migrate.ets @@ -172,4 +172,9 @@ let ab3 = new AB3(); ab3.fn3.unsafeCall(); const fn29: Function[] = []; -fn29[1].unsafeCall(); \ No newline at end of file +fn29[1].unsafeCall(); + +SysApiWrapper.setTimeout = (handler: Function | string, delay?: number): number => { + (handler as Function)?.unsafeCall(); + return Math.random(); +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/extend_decorator_1.ets.autofix.json b/ets2panda/linter/test/main/extend_decorator_1.ets.autofix.json index 375b4f7440..ebebb8c78c 100644 --- a/ets2panda/linter/test/main/extend_decorator_1.ets.autofix.json +++ b/ets2panda/linter/test/main/extend_decorator_1.ets.autofix.json @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Column, Text, ColumnAttribute, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Column,\n Text,\n ColumnAttribute,\n Color,\n} from '@kit.ArkUI';", "line": 35, "column": 20, "endLine": 35, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Column, Text, ColumnAttribute, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Column,\n Text,\n ColumnAttribute,\n Color,\n} from '@kit.ArkUI';", "line": 35, "column": 20, "endLine": 35, @@ -213,7 +213,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Column, Text, ColumnAttribute, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Column,\n Text,\n ColumnAttribute,\n Color,\n} from '@kit.ArkUI';", "line": 35, "column": 20, "endLine": 35, @@ -234,7 +234,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Column, Text, ColumnAttribute, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Column,\n Text,\n ColumnAttribute,\n Color,\n} from '@kit.ArkUI';", "line": 35, "column": 20, "endLine": 35, diff --git a/ets2panda/linter/test/main/extend_decorator_1.ets.migrate.ets b/ets2panda/linter/test/main/extend_decorator_1.ets.migrate.ets index da62cffcb5..319255d85f 100644 --- a/ets2panda/linter/test/main/extend_decorator_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/extend_decorator_1.ets.migrate.ets @@ -13,7 +13,13 @@ * limitations under the License. */ -import { Component, Column, Text, ColumnAttribute, Color } from '@kit.ArkUI'; +import { + Component, + Column, + Text, + ColumnAttribute, + Color, +} from '@kit.ArkUI'; @Component struct MyCard { diff --git a/ets2panda/linter/test/main/extend_decorator_1.ets.migrate.json b/ets2panda/linter/test/main/extend_decorator_1.ets.migrate.json index be60c93486..3844838bf1 100644 --- a/ets2panda/linter/test/main/extend_decorator_1.ets.migrate.json +++ b/ets2panda/linter/test/main/extend_decorator_1.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 31, + "line": 37, "column": 5, - "endLine": 31, + "endLine": 37, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 32, + "line": 38, "column": 5, - "endLine": 32, + "endLine": 38, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 33, + "line": 39, "column": 5, - "endLine": 33, + "endLine": 39, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 34, + "line": 40, "column": 5, - "endLine": 34, + "endLine": 40, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 35, + "line": 41, "column": 5, - "endLine": 35, + "endLine": 41, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 42, "column": 5, - "endLine": 36, + "endLine": 42, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 37, + "line": 43, "column": 5, - "endLine": 37, + "endLine": 43, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 38, + "line": 44, "column": 5, - "endLine": 38, + "endLine": 44, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 42, + "line": 48, "column": 12, - "endLine": 42, + "endLine": 48, "endColumn": 16, "problem": "FunctionContainsThis", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 30, + "line": 36, "column": 20, - "endLine": 30, + "endLine": 36, "endColumn": 24, "problem": "InvalidIdentifier", "suggest": "", @@ -115,9 +115,9 @@ "severity": "ERROR" }, { - "line": 30, + "line": 36, "column": 44, - "endLine": 30, + "endLine": 36, "endColumn": 48, "problem": "ThisType", "suggest": "", @@ -125,9 +125,9 @@ "severity": "ERROR" }, { - "line": 46, + "line": 52, "column": 5, - "endLine": 46, + "endLine": 52, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -135,9 +135,9 @@ "severity": "ERROR" }, { - "line": 47, + "line": 53, "column": 5, - "endLine": 47, + "endLine": 53, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -145,9 +145,9 @@ "severity": "ERROR" }, { - "line": 48, + "line": 54, "column": 12, - "endLine": 48, + "endLine": 54, "endColumn": 16, "problem": "FunctionContainsThis", "suggest": "", @@ -155,9 +155,9 @@ "severity": "ERROR" }, { - "line": 45, + "line": 51, "column": 20, - "endLine": 45, + "endLine": 51, "endColumn": 24, "problem": "InvalidIdentifier", "suggest": "", @@ -165,9 +165,9 @@ "severity": "ERROR" }, { - "line": 45, + "line": 51, "column": 61, - "endLine": 45, + "endLine": 51, "endColumn": 65, "problem": "ThisType", "suggest": "", diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets b/ets2panda/linter/test/main/func_inferred_type_args_2.ets index 0d7b3467d1..5a79d6f480 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets @@ -94,3 +94,7 @@ class A { } } new A(new C()) +let a: Array | undefined = new Array(); +let aa: Array | Set | undefined = new Array(); +let b: Array | Array | undefined = new Array(); +let test: string[] = new Array(); \ No newline at end of file diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json index bc1cd482a4..81e3df826f 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.arkts2.json @@ -254,16 +254,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 44, - "column": 14, - "endLine": 44, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 44, "column": 10, @@ -274,16 +264,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 48, - "column": 14, - "endLine": 48, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 48, "column": 10, @@ -304,16 +284,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 52, - "column": 14, - "endLine": 52, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 52, "column": 10, @@ -334,16 +304,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 56, - "column": 14, - "endLine": 56, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 56, "column": 10, @@ -354,16 +314,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 61, - "column": 16, - "endLine": 61, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 61, "column": 12, @@ -374,16 +324,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 65, - "column": 16, - "endLine": 65, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 65, "column": 12, @@ -404,16 +344,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 69, - "column": 16, - "endLine": 69, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 69, "column": 12, @@ -434,16 +364,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 73, - "column": 16, - "endLine": 73, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 73, "column": 12, @@ -514,6 +434,46 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 97, + "column": 36, + "endLine": 97, + "endColumn": 47, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 51, + "endLine": 98, + "endColumn": 62, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 52, + "endLine": 99, + "endColumn": 63, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 100, + "column": 22, + "endLine": 100, + "endColumn": 33, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, { "line": 84, "column": 2, diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json index e59af03e37..202b0cc81c 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.autofix.json @@ -375,16 +375,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 44, - "column": 14, - "endLine": 44, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 44, "column": 10, @@ -406,16 +396,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 48, - "column": 14, - "endLine": 48, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 48, "column": 10, @@ -447,16 +427,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 52, - "column": 14, - "endLine": 52, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 52, "column": 10, @@ -477,16 +447,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 56, - "column": 14, - "endLine": 56, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 56, "column": 10, @@ -497,16 +457,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 61, - "column": 16, - "endLine": 61, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 61, "column": 12, @@ -528,16 +478,6 @@ "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, - { - "line": 65, - "column": 16, - "endLine": 65, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 65, "column": 12, @@ -569,16 +509,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 69, - "column": 16, - "endLine": 69, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 69, "column": 12, @@ -599,16 +529,6 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, - { - "line": 73, - "column": 16, - "endLine": 73, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 73, "column": 12, @@ -734,6 +654,79 @@ "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, + { + "line": 97, + "column": 36, + "endLine": 97, + "endColumn": 47, + "problem": "GenericCallNoTypeArgs", + "autofix": [ + { + "start": 2592, + "end": 2592, + "replacementText": "", + "line": 97, + "column": 36, + "endLine": 97, + "endColumn": 47 + } + ], + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 51, + "endLine": 98, + "endColumn": 62, + "problem": "GenericCallNoTypeArgs", + "autofix": [ + { + "start": 2655, + "end": 2655, + "replacementText": "", + "line": 98, + "column": 51, + "endLine": 98, + "endColumn": 62 + } + ], + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 52, + "endLine": 99, + "endColumn": 63, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 100, + "column": 22, + "endLine": 100, + "endColumn": 33, + "problem": "GenericCallNoTypeArgs", + "autofix": [ + { + "start": 2753, + "end": 2753, + "replacementText": "", + "line": 100, + "column": 22, + "endLine": 100, + "endColumn": 33 + } + ], + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, { "line": 84, "column": 2, @@ -744,7 +737,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Observed, Track, CommonAttribute } from '@kit.ArkUI';\n", + "replacementText": "\n\nimport {\n Observed,\n Track,\n CommonAttribute,\n} from '@kit.ArkUI';\n", "line": 86, "column": 94, "endLine": 86, @@ -765,7 +758,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Observed, Track, CommonAttribute } from '@kit.ArkUI';\n", + "replacementText": "\n\nimport {\n Observed,\n Track,\n CommonAttribute,\n} from '@kit.ArkUI';\n", "line": 86, "column": 94, "endLine": 86, @@ -786,7 +779,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Observed, Track, CommonAttribute } from '@kit.ArkUI';\n", + "replacementText": "\n\nimport {\n Observed,\n Track,\n CommonAttribute,\n} from '@kit.ArkUI';\n", "line": 86, "column": 94, "endLine": 86, @@ -807,7 +800,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Observed, Track, CommonAttribute } from '@kit.ArkUI';\n", + "replacementText": "\n\nimport {\n Observed,\n Track,\n CommonAttribute,\n} from '@kit.ArkUI';\n", "line": 86, "column": 94, "endLine": 86, diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.ets b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.ets index f76d33da37..bdd57c5703 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.ets +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.ets @@ -13,7 +13,11 @@ * limitations under the License. */ -import { Observed, Track, CommonAttribute } from '@kit.ArkUI'; +import { + Observed, + Track, + CommonAttribute, +} from '@kit.ArkUI'; import { AttributeUpdater } from '@kit.ArkUI'; @@ -97,3 +101,7 @@ class A { } } new A(new C()) +let a: Array | undefined = new Array(); +let aa: Array | Set | undefined = new Array(); +let b: Array | Array | undefined = new Array(); +let test: string[] = new Array(); \ No newline at end of file diff --git a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.json b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.json index 7926f03ac9..620729cb92 100644 --- a/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.json +++ b/ets2panda/linter/test/main/func_inferred_type_args_2.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 20, + "line": 24, "column": 7, - "endLine": 20, + "endLine": 24, "endColumn": 35, "problem": "AnyType", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 20, + "line": 24, "column": 24, - "endLine": 20, + "endLine": 24, "endColumn": 35, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 24, + "line": 28, "column": 7, - "endLine": 24, + "endLine": 28, "endColumn": 33, "problem": "AnyType", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 24, + "line": 28, "column": 7, - "endLine": 24, + "endLine": 28, "endColumn": 33, "problem": "AnyType", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 24, + "line": 28, "column": 24, - "endLine": 24, + "endLine": 28, "endColumn": 33, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 29, + "line": 33, "column": 3, - "endLine": 29, + "endLine": 33, "endColumn": 37, "problem": "AnyType", "suggest": "", @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 29, + "line": 33, "column": 3, - "endLine": 29, + "endLine": 33, "endColumn": 37, "problem": "AnyType", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 29, + "line": 33, "column": 27, - "endLine": 29, + "endLine": 33, "endColumn": 36, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 30, + "line": 34, "column": 10, - "endLine": 30, + "endLine": 34, "endColumn": 23, "problem": "StructuralIdentity", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 30, + "line": 34, "column": 39, - "endLine": 30, + "endLine": 34, "endColumn": 48, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -115,9 +115,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 40, "column": 7, - "endLine": 36, + "endLine": 40, "endColumn": 35, "problem": "UnknownType", "suggest": "", @@ -125,9 +125,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 40, "column": 22, - "endLine": 36, + "endLine": 40, "endColumn": 35, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -135,9 +135,9 @@ "severity": "ERROR" }, { - "line": 39, + "line": 43, "column": 30, - "endLine": 39, + "endLine": 43, "endColumn": 39, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -145,29 +145,9 @@ "severity": "ERROR" }, { - "line": 47, - "column": 14, - "endLine": 47, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 51, - "column": 14, - "endLine": 51, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 55, + "line": 59, "column": 10, - "endLine": 55, + "endLine": 59, "endColumn": 19, "problem": "StructuralIdentity", "suggest": "", @@ -175,19 +155,9 @@ "severity": "ERROR" }, { - "line": 55, - "column": 14, - "endLine": 55, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 55, + "line": 59, "column": 10, - "endLine": 55, + "endLine": 59, "endColumn": 19, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -195,9 +165,9 @@ "severity": "ERROR" }, { - "line": 59, + "line": 63, "column": 10, - "endLine": 59, + "endLine": 63, "endColumn": 19, "problem": "StructuralIdentity", "suggest": "", @@ -205,19 +175,9 @@ "severity": "ERROR" }, { - "line": 59, - "column": 14, - "endLine": 59, - "endColumn": 17, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 59, + "line": 63, "column": 10, - "endLine": 59, + "endLine": 63, "endColumn": 19, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -225,29 +185,9 @@ "severity": "ERROR" }, { - "line": 64, - "column": 16, - "endLine": 64, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 68, - "column": 16, - "endLine": 68, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 72, + "line": 76, "column": 12, - "endLine": 72, + "endLine": 76, "endColumn": 21, "problem": "StructuralIdentity", "suggest": "", @@ -255,19 +195,9 @@ "severity": "ERROR" }, { - "line": 72, - "column": 16, - "endLine": 72, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 72, + "line": 76, "column": 12, - "endLine": 72, + "endLine": 76, "endColumn": 21, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -275,9 +205,9 @@ "severity": "ERROR" }, { - "line": 76, + "line": 80, "column": 12, - "endLine": 76, + "endLine": 80, "endColumn": 21, "problem": "StructuralIdentity", "suggest": "", @@ -285,19 +215,9 @@ "severity": "ERROR" }, { - "line": 76, - "column": 16, - "endLine": 76, - "endColumn": 19, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 76, + "line": 80, "column": 12, - "endLine": 76, + "endLine": 80, "endColumn": 21, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -305,14 +225,24 @@ "severity": "ERROR" }, { - "line": 89, + "line": 93, "column": 77, - "endLine": 89, + "endLine": 93, "endColumn": 93, "problem": "DynamicCtorCall", "suggest": "", "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" + }, + { + "line": 106, + "column": 52, + "endLine": 106, + "endColumn": 63, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/index_access_static_and_class_instance.ets b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets new file mode 100644 index 0000000000..942125e00d --- /dev/null +++ b/ets2panda/linter/test/main/index_access_static_and_class_instance.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. + */ + +class A { + static foo1(){} + foo2(){} +} + +let a = new A(); +(a as object)["foo2"]; //arkts-no-ops-by-index autofix is right + +(A as object)["foo1"]; // arkts-no-classes-as-obj autofix is right diff --git a/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.args.json b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.args.json new file mode 100755 index 0000000000..6958168fef --- /dev/null +++ b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.args.json @@ -0,0 +1,21 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "", + "autofix": "--arkts-2", + "migrate": "--arkts-2" + } +} diff --git a/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.arkts2.json b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.arkts2.json new file mode 100644 index 0000000000..21e2ed90d0 --- /dev/null +++ b/ets2panda/linter/test/main/index_access_static_and_class_instance.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": 22, + "column": 1, + "endLine": 22, + "endColumn": 22, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 2, + "endLine": 24, + "endColumn": 3, + "problem": "ClassAsObjectError", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.autofix.json b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.autofix.json new file mode 100644 index 0000000000..827a118edf --- /dev/null +++ b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.autofix.json @@ -0,0 +1,60 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT 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": 1, + "endLine": 22, + "endColumn": 22, + "problem": "PropertyAccessByIndex", + "autofix": [ + { + "replacementText": "a.foo2", + "start": 664, + "end": 685, + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 22 + } + ], + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 2, + "endLine": 24, + "endColumn": 3, + "problem": "ClassAsObjectError", + "autofix": [ + { + "replacementText": "A.foo1", + "start": 729, + "end": 750, + "line": 24, + "column": 2, + "endLine": 24, + "endColumn": 3 + } + ], + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.json b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.json new file mode 100644 index 0000000000..9493d7285d --- /dev/null +++ b/ets2panda/linter/test/main/index_access_static_and_class_instance.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": 24, + "column": 2, + "endLine": 24, + "endColumn": 3, + "problem": "ClassAsObject", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "WARNING" + } + ] +} diff --git a/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.migrate.ets b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.migrate.ets new file mode 100644 index 0000000000..eb80664946 --- /dev/null +++ b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.migrate.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. + */ + +class A { + static foo1(){} + foo2(){} +} + +let a = new A(); +a.foo2; //arkts-no-ops-by-index autofix is right + +A.foo1; // arkts-no-classes-as-obj autofix is right diff --git a/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.migrate.json b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.migrate.json new file mode 100644 index 0000000000..dd03fcf544 --- /dev/null +++ b/ets2panda/linter/test/main/index_access_static_and_class_instance.ets.migrate.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/main/interface_import_1.ets.autofix.json b/ets2panda/linter/test/main/interface_import_1.ets.autofix.json index 3379f754c7..88bab00625 100644 --- a/ets2panda/linter/test/main/interface_import_1.ets.autofix.json +++ b/ets2panda/linter/test/main/interface_import_1.ets.autofix.json @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -213,7 +213,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -234,7 +234,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -255,7 +255,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -276,7 +276,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -297,7 +297,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -318,7 +318,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -339,7 +339,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -360,7 +360,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -381,7 +381,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -402,7 +402,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -423,7 +423,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, @@ -444,7 +444,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Column,\n Button,\n Text,\n Row,\n TextAttribute,\n ColumnAttribute,\n AnimatableExtend,\n $$,\n ImageFit,\n} from '@kit.ArkUI';", "line": 86, "column": 36, "endLine": 86, diff --git a/ets2panda/linter/test/main/interface_import_1.ets.migrate.ets b/ets2panda/linter/test/main/interface_import_1.ets.migrate.ets index 97155fd1a2..5c0cf73eaa 100644 --- a/ets2panda/linter/test/main/interface_import_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/interface_import_1.ets.migrate.ets @@ -13,7 +13,20 @@ * limitations under the License. */ -import { Entry, Component, State, Column, Button, Text, Row, TextAttribute, ColumnAttribute, AnimatableExtend, $$, ImageFit } from '@kit.ArkUI'; +import { + Entry, + Component, + State, + Column, + Button, + Text, + Row, + TextAttribute, + ColumnAttribute, + AnimatableExtend, + $$, + ImageFit, +} from '@kit.ArkUI'; import { Slider } from '@kit.ArkUI'; diff --git a/ets2panda/linter/test/main/interface_import_1.ets.migrate.json b/ets2panda/linter/test/main/interface_import_1.ets.migrate.json index 400a3c7033..8ca1591553 100644 --- a/ets2panda/linter/test/main/interface_import_1.ets.migrate.json +++ b/ets2panda/linter/test/main/interface_import_1.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 63, + "line": 76, "column": 5, - "endLine": 63, + "endLine": 76, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 64, + "line": 77, "column": 12, - "endLine": 64, + "endLine": 77, "endColumn": 16, "problem": "FunctionContainsThis", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 62, + "line": 75, "column": 20, - "endLine": 62, + "endLine": 75, "endColumn": 24, "problem": "InvalidIdentifier", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 62, + "line": 75, "column": 42, - "endLine": 62, + "endLine": 75, "endColumn": 46, "problem": "ThisType", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 69, + "line": 82, "column": 5, - "endLine": 69, + "endLine": 82, "endColumn": 9, "problem": "FunctionContainsThis", "suggest": "", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 70, + "line": 83, "column": 12, - "endLine": 70, + "endLine": 83, "endColumn": 16, "problem": "FunctionContainsThis", "suggest": "", @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 68, + "line": 81, "column": 26, - "endLine": 68, + "endLine": 81, "endColumn": 30, "problem": "InvalidIdentifier", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 68, + "line": 81, "column": 65, - "endLine": 68, + "endLine": 81, "endColumn": 69, "problem": "ThisType", "suggest": "", diff --git a/ets2panda/linter/test/main/interface_import_3.ets.autofix.json b/ets2panda/linter/test/main/interface_import_3.ets.autofix.json index a149f61d6c..be5fa2b029 100644 --- a/ets2panda/linter/test/main/interface_import_3.ets.autofix.json +++ b/ets2panda/linter/test/main/interface_import_3.ets.autofix.json @@ -44,7 +44,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n} from '@kit.ArkUI';", "line": 30, "column": 2, "endLine": 30, @@ -65,7 +65,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n} from '@kit.ArkUI';", "line": 30, "column": 2, "endLine": 30, diff --git a/ets2panda/linter/test/main/interface_import_3.ets.migrate.ets b/ets2panda/linter/test/main/interface_import_3.ets.migrate.ets index 437303702c..52825b0256 100644 --- a/ets2panda/linter/test/main/interface_import_3.ets.migrate.ets +++ b/ets2panda/linter/test/main/interface_import_3.ets.migrate.ets @@ -13,7 +13,10 @@ * limitations under the License. */ -import { Entry, Component } from '@kit.ArkUI'; +import { + Entry, + Component, +} from '@kit.ArkUI'; import { A } from './har' diff --git a/ets2panda/linter/test/main/interface_import_3.ets.migrate.json b/ets2panda/linter/test/main/interface_import_3.ets.migrate.json index 97261a31be..89fb6cd577 100644 --- a/ets2panda/linter/test/main/interface_import_3.ets.migrate.json +++ b/ets2panda/linter/test/main/interface_import_3.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 24, + "line": 27, "column": 16, - "endLine": 24, + "endLine": 27, "endColumn": 17, "problem": "DynamicCtorCall", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 27, + "line": 30, "column": 5, - "endLine": 27, + "endLine": 30, "endColumn": 12, "problem": "AnyType", "suggest": "", diff --git a/ets2panda/linter/test/main/interface_import_4.ets.autofix.json b/ets2panda/linter/test/main/interface_import_4.ets.autofix.json index 1ba9932fa3..2699ed7651 100644 --- a/ets2panda/linter/test/main/interface_import_4.ets.autofix.json +++ b/ets2panda/linter/test/main/interface_import_4.ets.autofix.json @@ -223,7 +223,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -244,7 +244,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -265,7 +265,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -286,7 +286,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -307,7 +307,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -328,7 +328,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -349,7 +349,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -370,7 +370,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -391,7 +391,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -412,7 +412,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -433,7 +433,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -454,7 +454,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, @@ -475,7 +475,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n ComponentV2,\n Local,\n Scroller,\n Column,\n List,\n Repeat,\n RepeatItem,\n ListItem,\n Row,\n Text,\n Button,\n} from '@kit.ArkUI';", "line": 40, "column": 7, "endLine": 40, diff --git a/ets2panda/linter/test/main/interface_import_4.ets.migrate.ets b/ets2panda/linter/test/main/interface_import_4.ets.migrate.ets index 0087934e5c..a14500081a 100644 --- a/ets2panda/linter/test/main/interface_import_4.ets.migrate.ets +++ b/ets2panda/linter/test/main/interface_import_4.ets.migrate.ets @@ -13,7 +13,20 @@ * limitations under the License. */ -import { Entry, ComponentV2, Local, Scroller, Column, List, Repeat, RepeatItem, ListItem, Row, Text, Button } from '@kit.ArkUI'; +import { + Entry, + ComponentV2, + Local, + Scroller, + Column, + List, + Repeat, + RepeatItem, + ListItem, + Row, + Text, + Button, +} from '@kit.ArkUI'; @Entry @ComponentV2 diff --git a/ets2panda/linter/test/main/interface_import_4.ets.migrate.json b/ets2panda/linter/test/main/interface_import_4.ets.migrate.json index 1aecbf6f53..eef4db12d7 100644 --- a/ets2panda/linter/test/main/interface_import_4.ets.migrate.json +++ b/ets2panda/linter/test/main/interface_import_4.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 22, + "line": 35, "column": 28, - "endLine": 22, + "endLine": 35, "endColumn": 36, "problem": "DynamicCtorCall", "suggest": "", diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.arkts2.json b/ets2panda/linter/test/main/literals_as_prop_names.ets.arkts2.json index f6d45915a0..5062fc598a 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.arkts2.json +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.arkts2.json @@ -274,16 +274,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 84, - "column": 12, - "endLine": 84, - "endColumn": 31, - "problem": "InteropDirectAccessToTSTypes", - "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", - "severity": "ERROR" - }, { "line": 84, "column": 36, diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.autofix.json b/ets2panda/linter/test/main/literals_as_prop_names.ets.autofix.json index c006698019..f3414d739d 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.autofix.json +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.autofix.json @@ -656,16 +656,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 84, - "column": 12, - "endLine": 84, - "endColumn": 31, - "problem": "InteropDirectAccessToTSTypes", - "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", - "severity": "ERROR" - }, { "line": 84, "column": 36, @@ -1483,7 +1473,7 @@ { "start": 608, "end": 608, - "replacementText": "\n\nimport { Component, State } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n} from '@kit.ArkUI';", "line": 117, "column": 2, "endLine": 117, @@ -1504,7 +1494,7 @@ { "start": 608, "end": 608, - "replacementText": "\n\nimport { Component, State } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n} from '@kit.ArkUI';", "line": 117, "column": 2, "endLine": 117, diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.ets b/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.ets index 5c91b9deba..6fb5cb3e0f 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.ets +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.ets @@ -13,7 +13,10 @@ * limitations under the License. */ -import { Component, State } from '@kit.ArkUI'; +import { + Component, + State, +} from '@kit.ArkUI'; import { ExportLitAsPropName } from './ignore_files/good'; diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.json b/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.json index 2597882d05..a180c18573 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.json +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.json @@ -1,6 +1,6 @@ { "copyright": [ - "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Copyright (c) 2024-2025 Huawei Device Co., Ltd.", "Licensed under the Apache License, Version 2.0 (the 'License');", "you may not use this file except in compliance with the License.", "You may obtain a copy of the License at", @@ -15,9 +15,9 @@ ], "result": [ { - "line": 59, + "line": 62, "column": 9, - "endLine": 59, + "endLine": 62, "endColumn": 10, "problem": "ObjectLiteralNoContextType", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 59, + "line": 62, "column": 10, - "endLine": 59, + "endLine": 62, "endColumn": 16, "problem": "LiteralAsPropertyName", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 59, + "line": 62, "column": 24, - "endLine": 59, + "endLine": 62, "endColumn": 25, "problem": "LiteralAsPropertyName", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 61, + "line": 64, "column": 13, - "endLine": 61, + "endLine": 64, "endColumn": 22, "problem": "PropertyAccessByIndex", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 62, + "line": 65, "column": 13, - "endLine": 62, + "endLine": 65, "endColumn": 17, "problem": "PropertyAccessByIndex", "suggest": "", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 84, + "line": 87, "column": 7, - "endLine": 84, + "endLine": 87, "endColumn": 10, "problem": "InvalidIdentifier", "suggest": "", @@ -75,19 +75,9 @@ "severity": "ERROR" }, { - "line": 90, - "column": 12, - "endLine": 90, - "endColumn": 31, - "problem": "InteropDirectAccessToTSTypes", - "suggest": "", - "rule": "Cannot access typescript types directly (arkts-interop-ts2s-static-access-ts-type)", - "severity": "ERROR" - }, - { - "line": 90, + "line": 93, "column": 36, - "endLine": 90, + "endLine": 93, "endColumn": 37, "problem": "LiteralAsPropertyName", "suggest": "", @@ -95,9 +85,9 @@ "severity": "ERROR" }, { - "line": 92, + "line": 95, "column": 1, - "endLine": 92, + "endLine": 95, "endColumn": 33, "problem": "UnsupportPropNameFromValue", "suggest": "", @@ -105,9 +95,9 @@ "severity": "ERROR" }, { - "line": 141, + "line": 144, "column": 37, - "endLine": 141, + "endLine": 144, "endColumn": 38, "problem": "ObjectLiteralNoContextType", "suggest": "", @@ -115,9 +105,9 @@ "severity": "ERROR" }, { - "line": 142, + "line": 145, "column": 3, - "endLine": 142, + "endLine": 145, "endColumn": 12, "problem": "ComputedPropertyName", "suggest": "", @@ -125,9 +115,9 @@ "severity": "ERROR" }, { - "line": 147, + "line": 150, "column": 3, - "endLine": 147, + "endLine": 150, "endColumn": 15, "problem": "ComputedPropertyName", "suggest": "", @@ -135,9 +125,9 @@ "severity": "ERROR" }, { - "line": 148, + "line": 151, "column": 3, - "endLine": 148, + "endLine": 151, "endColumn": 8, "problem": "ComputedPropertyName", "suggest": "", @@ -145,9 +135,9 @@ "severity": "ERROR" }, { - "line": 149, + "line": 152, "column": 3, - "endLine": 149, + "endLine": 152, "endColumn": 34, "problem": "ComputedPropertyName", "suggest": "", @@ -155,9 +145,9 @@ "severity": "ERROR" }, { - "line": 152, + "line": 155, "column": 19, - "endLine": 152, + "endLine": 155, "endColumn": 20, "problem": "ObjectLiteralNoContextType", "suggest": "", @@ -165,9 +155,9 @@ "severity": "ERROR" }, { - "line": 153, + "line": 156, "column": 3, - "endLine": 153, + "endLine": 156, "endColumn": 15, "problem": "ComputedPropertyName", "suggest": "", @@ -175,9 +165,9 @@ "severity": "ERROR" }, { - "line": 154, + "line": 157, "column": 3, - "endLine": 154, + "endLine": 157, "endColumn": 8, "problem": "ComputedPropertyName", "suggest": "", @@ -185,9 +175,9 @@ "severity": "ERROR" }, { - "line": 155, + "line": 158, "column": 3, - "endLine": 155, + "endLine": 158, "endColumn": 34, "problem": "ComputedPropertyName", "suggest": "", @@ -195,9 +185,9 @@ "severity": "ERROR" }, { - "line": 28, + "line": 31, "column": 11, - "endLine": 28, + "endLine": 31, "endColumn": 14, "problem": "StrictDiagnostic", "suggest": "Property '__2' has no initializer and is not definitely assigned in the constructor.", @@ -205,9 +195,9 @@ "severity": "ERROR" }, { - "line": 29, + "line": 32, "column": 3, - "endLine": 29, + "endLine": 32, "endColumn": 6, "problem": "StrictDiagnostic", "suggest": "Property 'Two' has no initializer and is not definitely assigned in the constructor.", @@ -215,9 +205,9 @@ "severity": "ERROR" }, { - "line": 44, + "line": 47, "column": 11, - "endLine": 44, + "endLine": 47, "endColumn": 13, "problem": "StrictDiagnostic", "suggest": "Property '_2' has no initializer and is not definitely assigned in the constructor.", @@ -225,9 +215,9 @@ "severity": "ERROR" }, { - "line": 45, + "line": 48, "column": 3, - "endLine": 45, + "endLine": 48, "endColumn": 6, "problem": "StrictDiagnostic", "suggest": "Property 'Two' has no initializer and is not definitely assigned in the constructor.", @@ -235,9 +225,9 @@ "severity": "ERROR" }, { - "line": 65, + "line": 68, "column": 12, - "endLine": 65, + "endLine": 68, "endColumn": 16, "problem": "StrictDiagnostic", "suggest": "Property 'name' has no initializer and is not definitely assigned in the constructor.", @@ -245,9 +235,9 @@ "severity": "ERROR" }, { - "line": 66, + "line": 69, "column": 12, - "endLine": 66, + "endLine": 69, "endColumn": 14, "problem": "StrictDiagnostic", "suggest": "Property '_2' has no initializer and is not definitely assigned in the constructor.", diff --git a/ets2panda/linter/test/main/localBuilder_1.ets.autofix.json b/ets2panda/linter/test/main/localBuilder_1.ets.autofix.json index 70cdea3625..2c776ac2ff 100644 --- a/ets2panda/linter/test/main/localBuilder_1.ets.autofix.json +++ b/ets2panda/linter/test/main/localBuilder_1.ets.autofix.json @@ -45,7 +45,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n Column,\n} from '@kit.ArkUI';", "line": 29, "column": 5, "endLine": 29, @@ -66,7 +66,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n Column,\n} from '@kit.ArkUI';", "line": 29, "column": 5, "endLine": 29, @@ -87,7 +87,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n Column,\n} from '@kit.ArkUI';", "line": 29, "column": 5, "endLine": 29, @@ -108,7 +108,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n Column,\n} from '@kit.ArkUI';", "line": 29, "column": 5, "endLine": 29, @@ -129,7 +129,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n Column,\n} from '@kit.ArkUI';", "line": 29, "column": 5, "endLine": 29, @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, State, Row, Text, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n State,\n Row,\n Text,\n Column,\n} from '@kit.ArkUI';", "line": 29, "column": 5, "endLine": 29, diff --git a/ets2panda/linter/test/main/localBuilder_1.ets.migrate.ets b/ets2panda/linter/test/main/localBuilder_1.ets.migrate.ets index d9a2b55ebe..d3f6980a06 100644 --- a/ets2panda/linter/test/main/localBuilder_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/localBuilder_1.ets.migrate.ets @@ -15,7 +15,14 @@ import { Builder } from '@kit.ArkUI'; -import { Entry, Component, State, Row, Text, Column } from '@kit.ArkUI'; +import { + Entry, + Component, + State, + Row, + Text, + Column, +} from '@kit.ArkUI'; @Entry @Component diff --git a/ets2panda/linter/test/main/method_inheritance.ets b/ets2panda/linter/test/main/method_inheritance.ets index c92fa1f0d9..276a7c3aee 100644 --- a/ets2panda/linter/test/main/method_inheritance.ets +++ b/ets2panda/linter/test/main/method_inheritance.ets @@ -216,3 +216,39 @@ class Derived4 implements Base3 { return new A1(); } } + +class P { +} + +class PP extends P { + public static toString(result: number): string { // Legal + return ''; + } +} + +class RCP {} + +interface aa { + aa?: Function; +} +interface bb extends aa { + onError(res: RCP): void; +} +class CC implements bb { + onError(res: RCP): void {} // Legal + aa?: Function = () => {} +} +class Animal {} +class Dog extends Animal {} + +class Base6 { + public foo(): Animal { + console.log("base") + } +} +// extends +class Derived6 extends Base6 { + public foo(): Dog { // no error + console.log("Derived:") + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/no_sparse_array.ets b/ets2panda/linter/test/main/no_sparse_array.ets index a543274d46..eb1ba59ca1 100644 --- a/ets2panda/linter/test/main/no_sparse_array.ets +++ b/ets2panda/linter/test/main/no_sparse_array.ets @@ -15,4 +15,28 @@ let a = [1, , , 3]; let b = []; -let c:number[] = []; \ No newline at end of file +let c: number[] = []; + +let d = Promise.race([]); +let e = Promise.all([]); +let f = Promise.allSettled([]); +let g = Promise.any([]); +let h = Promise.resolve([]); + +let d1 = Promise.race([]); +let e1 = Promise.all([]); +let f1 = Promise.allSettled([]); +let g1 = Promise.any([]); +let h1 = Promise.resolve([]); + +let i = Promise.race([1.0]); +let j = Promise.all([2.0]); +let k = Promise.allSettled([3.0]); +let l = Promise.any([4.0]); +let m = Promise.resolve([5.0]); + +let i1 = Promise.race([1]); +let j1 = Promise.all([2]); +let k1 = Promise.allSettled([3]); +let l1 = Promise.any([4]); +let m1 = Promise.resolve([5]); \ No newline at end of file diff --git a/ets2panda/linter/test/main/no_sparse_array.ets.arkts2.json b/ets2panda/linter/test/main/no_sparse_array.ets.arkts2.json index edf83e80e8..103a56a139 100644 --- a/ets2panda/linter/test/main/no_sparse_array.ets.arkts2.json +++ b/ets2panda/linter/test/main/no_sparse_array.ets.arkts2.json @@ -63,6 +63,156 @@ "suggest": "", "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", "severity": "ERROR" + }, + { + "line": 20, + "column": 30, + "endLine": 20, + "endColumn": 32, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 29, + "endLine": 21, + "endColumn": 31, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 36, + "endLine": 22, + "endColumn": 38, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 29, + "endLine": 23, + "endColumn": 31, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 35, + "endLine": 24, + "endColumn": 37, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 23, + "endLine": 26, + "endColumn": 25, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 22, + "endLine": 27, + "endColumn": 24, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 29, + "endLine": 28, + "endColumn": 31, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 22, + "endLine": 29, + "endColumn": 24, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 26, + "endLine": 30, + "endColumn": 28, + "problem": "NosparseArray", + "suggest": "", + "rule": "Sparse array is not supported in ArkTS1.2 (arkts-no-sparse-array)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 24, + "endLine": 38, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 23, + "endLine": 39, + "endColumn": 24, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 30, + "endLine": 40, + "endColumn": 31, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 23, + "endLine": 41, + "endColumn": 24, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 27, + "endLine": 42, + "endColumn": 28, + "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/no_ts_like_smart_type.ets b/ets2panda/linter/test/main/no_ts_like_smart_type.ets index 65ad923c30..7a82e0fd5e 100755 --- a/ets2panda/linter/test/main/no_ts_like_smart_type.ets +++ b/ets2panda/linter/test/main/no_ts_like_smart_type.ets @@ -61,4 +61,61 @@ class AA3 { } return this.instance; // Error } +} + +function foo2(str:string){ +} +function foo22(str:number|string){ +} +function foo(spec :string|number){ + foo2(spec) // Error +} +function foo3(spec :string|number){ + if (typeof spec == "string") { + foo2(spec) // Error + } +} +function foo3(spec :string|number){ + if (typeof spec == "string") { + foo22(spec) + } +} + +const input = true; +if (typeof input === 'boolean') { +} else { + let result = input as string | number | null; // Error +} + +async function taskInfo():Promise {//nopass + for (let i:int = 0; i < 1000; i++) { + let taskpoolInfo: taskpool.TaskPoolInfo = taskpool.getTaskPoolInfo(); + hilog.info(0x0000, 'testTag-----',`getTaskPoolInfo: , ${JSON.stringify(taskpoolInfo)}`) + let tid: number = 0; + let taskIds: number[] = []; + let priority: int = 0; + let taskId: number = 0; + let state: number = 0; + let duration: number = 0; + let name: string = ""; + let threadIS: Array = Array.from(taskpoolInfo.threadInfos) + for (let threadInfo of threadIS) { + tid = threadInfo.tid; + if (threadInfo.taskIds != undefined && threadInfo.priority != undefined) { + priority = threadInfo.priority; // Error + } + hilog.info(0x0000, 'testTag-----',"getTaskPoolInfo: --tid is:" + tid + ", taskIds is:" + taskIds + ", priority is:" + priority); + } + let taskIS: Array = Array.from(taskpoolInfo.taskInfos) + for (let taskInfo of taskIS) { + taskId = taskInfo.taskId; + state = taskInfo.state; + if (taskInfo.duration != undefined) { + duration = taskInfo.duration as number; // Error + name = taskInfo.name; + } + hilog.info(0x0000, 'testTag-----',"getTaskPoolInfo: --taskId is:" + taskId + ", state is:" + state + ", duration is:" + duration + + ", name is:" + name); + } + } } \ 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 d8dd2482a1..679e8a5d6f 100755 --- 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 @@ -103,6 +103,146 @@ "suggest": "", "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" + }, + { + "line": 71, + "column": 8, + "endLine": 71, + "endColumn": 12, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 1, + "endLine": 77, + "endColumn": 2, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 10, + "endLine": 75, + "endColumn": 14, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 78, + "column": 1, + "endLine": 82, + "endColumn": 2, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 87, + "column": 16, + "endLine": 87, + "endColumn": 47, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 91, + "column": 20, + "endLine": 91, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 91, + "column": 27, + "endLine": 91, + "endColumn": 31, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 94, + "column": 23, + "endLine": 94, + "endColumn": 24, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 96, + "column": 25, + "endLine": 96, + "endColumn": 26, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 26, + "endLine": 97, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 25, + "endLine": 98, + "endColumn": 26, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 99, + "column": 28, + "endLine": 99, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 105, + "column": 8, + "endLine": 105, + "endColumn": 38, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 114, + "column": 9, + "endLine": 114, + "endColumn": 47, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json b/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json index 2c6c4de6cf..58a67b8a66 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json +++ b/ets2panda/linter/test/main/numeric_semantics.ets.autofix.json @@ -2464,7 +2464,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, @@ -2485,7 +2485,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, @@ -2506,7 +2506,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, @@ -2527,7 +2527,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, @@ -2548,7 +2548,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, @@ -2569,7 +2569,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, @@ -2590,7 +2590,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, @@ -2611,7 +2611,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, @@ -2632,7 +2632,7 @@ { "start": 738, "end": 738, - "replacementText": "\r\n\r\nimport { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI';\r\n", + "replacementText": "\r\n\r\nimport {\n Entry,\n Component,\n State,\n RelativeContainer,\n Text,\n AppStorage,\n} from '@kit.ArkUI';\r\n", "line": 155, "column": 34, "endLine": 155, diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.migrate.ets b/ets2panda/linter/test/main/numeric_semantics.ets.migrate.ets index ba4df96e9d..1013980b65 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.migrate.ets +++ b/ets2panda/linter/test/main/numeric_semantics.ets.migrate.ets @@ -16,7 +16,14 @@ // TypeScript: treats 'n' as having type number // ArkTS: treats 'n' as having type int to reach max code performance -import { Entry, Component, State, RelativeContainer, Text, AppStorage } from '@kit.ArkUI'; +import { + Entry, + Component, + State, + RelativeContainer, + Text, + AppStorage, +} from '@kit.ArkUI'; let a: number = 1.0; diff --git a/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json b/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json index 665c1dea05..29adb27a5c 100644 --- a/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json +++ b/ets2panda/linter/test/main/numeric_semantics.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 60, + "line": 67, "column": 5, - "endLine": 60, + "endLine": 67, "endColumn": 15, "problem": "DefiniteAssignmentError", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 110, + "line": 117, "column": 26, - "endLine": 110, + "endLine": 117, "endColumn": 26, "problem": "ArrayIndexExprType", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 149, + "line": 156, "column": 6, - "endLine": 149, + "endLine": 156, "endColumn": 7, "problem": "ObjectLiteralNoContextType", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 155, + "line": 162, "column": 9, - "endLine": 155, + "endLine": 162, "endColumn": 20, "problem": "ObjectLiteralProperty", "suggest": "", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 155, + "line": 162, "column": 9, - "endLine": 155, + "endLine": 162, "endColumn": 11, "problem": "InvalidIdentifier", "suggest": "", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 155, + "line": 162, "column": 12, - "endLine": 155, + "endLine": 162, "endColumn": 15, "problem": "AnyType", "suggest": "", @@ -75,9 +75,9 @@ "severity": "ERROR" }, { - "line": 189, + "line": 196, "column": 6, - "endLine": 189, + "endLine": 196, "endColumn": 13, "problem": "RuntimeArrayCheck", "suggest": "", @@ -85,9 +85,9 @@ "severity": "ERROR" }, { - "line": 203, + "line": 210, "column": 1, - "endLine": 203, + "endLine": 210, "endColumn": 40, "problem": "ImportAfterStatement", "suggest": "", @@ -95,9 +95,9 @@ "severity": "ERROR" }, { - "line": 205, + "line": 212, "column": 5, - "endLine": 205, + "endLine": 212, "endColumn": 34, "problem": "AnyType", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 205, + "line": 212, "column": 15, - "endLine": 205, + "endLine": 212, "endColumn": 24, "problem": "DynamicCtorCall", "suggest": "", @@ -115,9 +115,9 @@ "severity": "ERROR" }, { - "line": 211, + "line": 218, "column": 42, - "endLine": 211, + "endLine": 218, "endColumn": 51, "problem": "DynamicCtorCall", "suggest": "", diff --git a/ets2panda/linter/test/main/object_literals_properties.ets b/ets2panda/linter/test/main/object_literals_properties.ets index 84c1d5db86..1944ed2ef9 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets +++ b/ets2panda/linter/test/main/object_literals_properties.ets @@ -264,22 +264,34 @@ namespace X { console.log("C - 1"); } } - + export interface I { m(a: number, b: string): void; } } - + function test() { let c: X.C = { m() { console.log("C - 2"); } } - + let i: X.I = { m(): void { console.log("I"); } } -} \ No newline at end of file +} + +class FooBarBaz { + foo?: Map + bar?: string +} + +function baz(fooBar: Map) { + baz2({fooBar}); +} + +function baz2(fooBarBaz: FooBarBaz) { +} diff --git a/ets2panda/linter/test/main/object_literals_properties.ets.args.json b/ets2panda/linter/test/main/object_literals_properties.ets.args.json index f9fc1047e8..0b296788ca 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets.args.json +++ b/ets2panda/linter/test/main/object_literals_properties.ets.args.json @@ -1,21 +1,21 @@ { - "copyright": [ - "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", - "", - "http://www.apache.org/licenses/LICENSE-2.0", - "", - "Unless required by applicable law or agreed to in writing, software", - "distributed under the License is distributed on an 'AS IS' BASIS,", - "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", - "See the License for the specific language governing permissions and", - "limitations under the License." - ], - "mode": { - "arkts2": "", - "autofix": "--arkts-2", - "migrate": "--arkts-2" - } + "copyright": [ + "Copyright (c) 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", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "", + "autofix": "--arkts-2", + "migrate": "--arkts-2" + } } diff --git a/ets2panda/linter/test/main/object_literals_properties.ets.arkts2.json b/ets2panda/linter/test/main/object_literals_properties.ets.arkts2.json index 4f42a0f593..b72ff900ba 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets.arkts2.json +++ b/ets2panda/linter/test/main/object_literals_properties.ets.arkts2.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", @@ -1345,4 +1345,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/main/object_literals_properties.ets.autofix.json b/ets2panda/linter/test/main/object_literals_properties.ets.autofix.json index 04eed5c407..ccf6076bdc 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets.autofix.json +++ b/ets2panda/linter/test/main/object_literals_properties.ets.autofix.json @@ -1,6 +1,6 @@ { "copyright": [ - "Copyright (c) 2025 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", @@ -2326,8 +2326,8 @@ "problem": "ObjectLiteralProperty", "autofix": [ { - "start": 4958, - "end": 4958, + "start": 4956, + "end": 4956, "replacementText": "class GeneratedObjectLiteralClass_11 extends X.C {\n m() {\n console.log(\"C - 2\");\n }\n}\n\n", "line": 275, "column": 5, @@ -2335,8 +2335,8 @@ "endColumn": 6 }, { - "start": 4991, - "end": 5040, + "start": 4989, + "end": 5038, "replacementText": "new GeneratedObjectLiteralClass_11()", "line": 275, "column": 5, @@ -2366,8 +2366,8 @@ "problem": "ObjectLiteralProperty", "autofix": [ { - "start": 4958, - "end": 4958, + "start": 4956, + "end": 4956, "replacementText": "class GeneratedObjectLiteralClass_12 implements X.I {\n m(): void {\n console.log(\"I\");\n }\n}\n\n", "line": 281, "column": 5, @@ -2375,8 +2375,8 @@ "endColumn": 6 }, { - "start": 5058, - "end": 5109, + "start": 5055, + "end": 5106, "replacementText": "new GeneratedObjectLiteralClass_12()", "line": 281, "column": 5, @@ -2399,4 +2399,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/main/object_literals_properties.ets.migrate.ets b/ets2panda/linter/test/main/object_literals_properties.ets.migrate.ets index c2c2429650..ef4628d62a 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets.migrate.ets +++ b/ets2panda/linter/test/main/object_literals_properties.ets.migrate.ets @@ -326,12 +326,12 @@ namespace X { console.log("C - 1"); } } - + export interface I { m(a: number, b: string): void; } } - + class GeneratedObjectLiteralClass_11 extends X.C { m() { console.log("C - 2"); @@ -346,6 +346,18 @@ class GeneratedObjectLiteralClass_12 implements X.I { function test() { let c: X.C = new GeneratedObjectLiteralClass_11() - + let i: X.I = new GeneratedObjectLiteralClass_12() -} \ No newline at end of file +} + +class FooBarBaz { + foo?: Map + bar?: string +} + +function baz(fooBar: Map) { + baz2({fooBar}); +} + +function baz2(fooBarBaz: FooBarBaz) { +} diff --git a/ets2panda/linter/test/main/object_literals_properties.ets.migrate.json b/ets2panda/linter/test/main/object_literals_properties.ets.migrate.json index b652f8984b..cb49576162 100644 --- a/ets2panda/linter/test/main/object_literals_properties.ets.migrate.json +++ b/ets2panda/linter/test/main/object_literals_properties.ets.migrate.json @@ -1,6 +1,6 @@ { "copyright": [ - "Copyright (c) 2025 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", @@ -335,4 +335,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/main/oh_modules/@arkts.utils.d.ets b/ets2panda/linter/test/main/oh_modules/@arkts.utils.d.ets index df91841374..0e5d4e1ba8 100644 --- a/ets2panda/linter/test/main/oh_modules/@arkts.utils.d.ets +++ b/ets2panda/linter/test/main/oh_modules/@arkts.utils.d.ets @@ -19,4 +19,16 @@ export namespace utils { } } -export default utils; \ No newline at end of file +export default utils; + +export namespace ArkTSUtils { + export namespace locks { + export class AsyncLock { + constructor(); + } + } + + export namespace safeModule { + export function foo(): void; + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/oh_modules/@kit.ArkTS.d.ets b/ets2panda/linter/test/main/oh_modules/@kit.ArkTS.d.ets index dd994ead62..fdb4d44008 100644 --- a/ets2panda/linter/test/main/oh_modules/@kit.ArkTS.d.ets +++ b/ets2panda/linter/test/main/oh_modules/@kit.ArkTS.d.ets @@ -16,4 +16,5 @@ export { worker } from '../oh_modules/@ohos.worker'; export { collections } from '../oh_modules/@arkts.collections'; export { utils } from '../oh_modules/@arkts.utils'; -export { taskpool } from '../oh_modules/@ohos.taskpool'; \ No newline at end of file +export { taskpool } from '../oh_modules/@ohos.taskpool'; +export { ArkTSUtils } from '../oh_modules/@arkts.utils'; \ No newline at end of file diff --git a/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.autofix.json b/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.autofix.json index 7749390fd7..b96614d1d1 100644 --- a/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.autofix.json +++ b/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.autofix.json @@ -108,7 +108,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, StorageLink, LocalStorageLink } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n StorageLink,\n LocalStorageLink,\n} from '@kit.ArkUI';", "line": 32, "column": 2, "endLine": 32, @@ -129,7 +129,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, StorageLink, LocalStorageLink } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n StorageLink,\n LocalStorageLink,\n} from '@kit.ArkUI';", "line": 32, "column": 2, "endLine": 32, @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, StorageLink, LocalStorageLink } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n StorageLink,\n LocalStorageLink,\n} from '@kit.ArkUI';", "line": 32, "column": 2, "endLine": 32, @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, StorageLink, LocalStorageLink } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n StorageLink,\n LocalStorageLink,\n} from '@kit.ArkUI';", "line": 32, "column": 2, "endLine": 32, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, StorageLink, LocalStorageLink } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n StorageLink,\n LocalStorageLink,\n} from '@kit.ArkUI';", "line": 32, "column": 2, "endLine": 32, diff --git a/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.migrate.ets b/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.migrate.ets index 15f5527cbf..ca03196a93 100644 --- a/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.migrate.ets @@ -13,9 +13,18 @@ * limitations under the License. */ -import { PropRef, StoragePropRef, LocalStoragePropRef } from '@kit.ArkUI'; +import { + PropRef, + StoragePropRef, + LocalStoragePropRef, +} from '@kit.ArkUI'; -import { Entry, Component, StorageLink, LocalStorageLink } from '@kit.ArkUI'; +import { + Entry, + Component, + StorageLink, + LocalStorageLink, +} from '@kit.ArkUI'; class User { name: string = "" diff --git a/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.migrate.json b/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.migrate.json index 671d92eb76..66e9c58bab 100644 --- a/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.migrate.json +++ b/ets2panda/linter/test/main/prop_decorators_and_interfaces_1.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 28, + "line": 37, "column": 3, - "endLine": 28, + "endLine": 37, "endColumn": 11, "problem": "DecoratorsNotSupported", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 38, + "line": 47, "column": 3, - "endLine": 38, + "endLine": 47, "endColumn": 18, "problem": "DecoratorsNotSupported", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 39, + "line": 48, "column": 3, - "endLine": 39, + "endLine": 48, "endColumn": 23, "problem": "DecoratorsNotSupported", "suggest": "", diff --git a/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.autofix.json b/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.autofix.json index 2de9a369ef..9a56497197 100644 --- a/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.autofix.json +++ b/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.autofix.json @@ -222,7 +222,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -243,7 +243,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -264,7 +264,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -285,7 +285,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -306,7 +306,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -327,7 +327,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -348,7 +348,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -369,7 +369,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -390,7 +390,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -411,7 +411,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -432,7 +432,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -453,7 +453,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -474,7 +474,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -495,7 +495,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -516,7 +516,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -537,7 +537,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -558,7 +558,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -579,7 +579,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -600,7 +600,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -621,7 +621,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -642,7 +642,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -663,7 +663,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -684,7 +684,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -705,7 +705,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -726,7 +726,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -747,7 +747,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -768,7 +768,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -789,7 +789,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -810,7 +810,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, @@ -831,7 +831,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n State,\n Column,\n Text,\n Row,\n Blank,\n Button,\n} from '@kit.ArkUI';", "line": 103, "column": 7, "endLine": 103, diff --git a/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.migrate.ets b/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.migrate.ets index 7183356197..0d8773c212 100644 --- a/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.migrate.ets +++ b/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.migrate.ets @@ -15,7 +15,15 @@ import { PropRef } from '@kit.ArkUI'; -import { Component, State, Column, Text, Row, Blank, Button } from '@kit.ArkUI'; +import { + Component, + State, + Column, + Text, + Row, + Blank, + Button, +} from '@kit.ArkUI'; interface ChildComponentOptions { count: number; diff --git a/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.migrate.json b/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.migrate.json index e9031d32bc..21425e4ffe 100644 --- a/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.migrate.json +++ b/ets2panda/linter/test/main/prop_decorators_and_interfaces_4.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 62, + "line": 70, "column": 3, - "endLine": 62, + "endLine": 70, "endColumn": 11, "problem": "DecoratorsNotSupported", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 80, + "line": 88, "column": 3, - "endLine": 80, + "endLine": 88, "endColumn": 11, "problem": "DecoratorsNotSupported", "suggest": "", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 98, + "line": 106, "column": 3, - "endLine": 98, + "endLine": 106, "endColumn": 11, "problem": "DecoratorsNotSupported", "suggest": "", @@ -45,9 +45,9 @@ "severity": "ERROR" }, { - "line": 62, + "line": 70, "column": 12, - "endLine": 62, + "endLine": 70, "endColumn": 20, "problem": "StrictDiagnostic", "suggest": "Property 'options1' has no initializer and is not definitely assigned in the constructor.", @@ -55,9 +55,9 @@ "severity": "ERROR" }, { - "line": 80, + "line": 88, "column": 12, - "endLine": 80, + "endLine": 88, "endColumn": 20, "problem": "StrictDiagnostic", "suggest": "Property 'options2' has no initializer and is not definitely assigned in the constructor.", @@ -65,9 +65,9 @@ "severity": "ERROR" }, { - "line": 98, + "line": 106, "column": 12, - "endLine": 98, + "endLine": 106, "endColumn": 20, "problem": "StrictDiagnostic", "suggest": "Property 'options3' has no initializer and is not definitely assigned in the constructor.", diff --git a/ets2panda/linter/test/main/provide_annotation_1.ets.autofix.json b/ets2panda/linter/test/main/provide_annotation_1.ets.autofix.json index 16e13e0bf2..67135c7a11 100644 --- a/ets2panda/linter/test/main/provide_annotation_1.ets.autofix.json +++ b/ets2panda/linter/test/main/provide_annotation_1.ets.autofix.json @@ -1,6 +1,6 @@ { "copyright": [ - "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Copyright (c) 2023-2024 Huawei Device Co., Ltd.", "Licensed under the Apache License, Version 2.0 (the 'License');", "you may not use this file except in compliance with the License.", "You may obtain a copy of the License at", @@ -66,7 +66,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -87,7 +87,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -108,7 +108,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -129,7 +129,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -213,7 +213,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -234,7 +234,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, diff --git a/ets2panda/linter/test/main/provide_annotation_1.ets.migrate.ets b/ets2panda/linter/test/main/provide_annotation_1.ets.migrate.ets index ba3e787752..c51f5678f7 100644 --- a/ets2panda/linter/test/main/provide_annotation_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/provide_annotation_1.ets.migrate.ets @@ -13,7 +13,11 @@ * limitations under the License. */ -import { Component, Provide, Column } from '@kit.ArkUI'; +import { + Component, + Provide, + Column, +} from '@kit.ArkUI'; @Component struct Index { diff --git a/ets2panda/linter/test/main/provide_annotation_1.ets.migrate.json b/ets2panda/linter/test/main/provide_annotation_1.ets.migrate.json index 2817e72894..71463836c0 100644 --- a/ets2panda/linter/test/main/provide_annotation_1.ets.migrate.json +++ b/ets2panda/linter/test/main/provide_annotation_1.ets.migrate.json @@ -1,6 +1,6 @@ { "copyright": [ - "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Copyright (c) 2023-2024 Huawei Device Co., Ltd.", "Licensed under the Apache License, Version 2.0 (the 'License');", "you may not use this file except in compliance with the License.", "You may obtain a copy of the License at", @@ -15,9 +15,9 @@ ], "result": [ { - "line": 21, + "line": 25, "column": 3, - "endLine": 21, + "endLine": 25, "endColumn": 8, "problem": "StrictDiagnostic", "suggest": "Property 'value' has no initializer and is not definitely assigned in the constructor.", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 35, "column": 3, - "endLine": 31, + "endLine": 35, "endColumn": 8, "problem": "StrictDiagnostic", "suggest": "Property 'value' has no initializer and is not definitely assigned in the constructor.", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 41, + "line": 45, "column": 3, - "endLine": 41, + "endLine": 45, "endColumn": 8, "problem": "StrictDiagnostic", "suggest": "Property 'value' has no initializer and is not definitely assigned in the constructor.", diff --git a/ets2panda/linter/test/main/provide_annotation_2.ets.autofix.json b/ets2panda/linter/test/main/provide_annotation_2.ets.autofix.json index 8a98dfc2d8..249ef42308 100644 --- a/ets2panda/linter/test/main/provide_annotation_2.ets.autofix.json +++ b/ets2panda/linter/test/main/provide_annotation_2.ets.autofix.json @@ -24,7 +24,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -45,7 +45,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -66,7 +66,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -87,7 +87,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -108,7 +108,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -129,7 +129,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, Provide, Column } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n Provide,\n Column,\n} from '@kit.ArkUI';", "line": 41, "column": 5, "endLine": 41, diff --git a/ets2panda/linter/test/main/provide_annotation_2.ets.migrate.ets b/ets2panda/linter/test/main/provide_annotation_2.ets.migrate.ets index ba3e787752..c51f5678f7 100644 --- a/ets2panda/linter/test/main/provide_annotation_2.ets.migrate.ets +++ b/ets2panda/linter/test/main/provide_annotation_2.ets.migrate.ets @@ -13,7 +13,11 @@ * limitations under the License. */ -import { Component, Provide, Column } from '@kit.ArkUI'; +import { + Component, + Provide, + Column, +} from '@kit.ArkUI'; @Component struct Index { diff --git a/ets2panda/linter/test/main/provide_annotation_2.ets.migrate.json b/ets2panda/linter/test/main/provide_annotation_2.ets.migrate.json index 2817e72894..4a6bd5efbe 100644 --- a/ets2panda/linter/test/main/provide_annotation_2.ets.migrate.json +++ b/ets2panda/linter/test/main/provide_annotation_2.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 21, + "line": 25, "column": 3, - "endLine": 21, + "endLine": 25, "endColumn": 8, "problem": "StrictDiagnostic", "suggest": "Property 'value' has no initializer and is not definitely assigned in the constructor.", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 31, + "line": 35, "column": 3, - "endLine": 31, + "endLine": 35, "endColumn": 8, "problem": "StrictDiagnostic", "suggest": "Property 'value' has no initializer and is not definitely assigned in the constructor.", @@ -35,9 +35,9 @@ "severity": "ERROR" }, { - "line": 41, + "line": 45, "column": 3, - "endLine": 41, + "endLine": 45, "endColumn": 8, "problem": "StrictDiagnostic", "suggest": "Property 'value' has no initializer and is not definitely assigned in the constructor.", diff --git a/ets2panda/linter/test/main/runtime_array_bound.ets b/ets2panda/linter/test/main/runtime_array_bound.ets index 5540265166..093c957d7b 100644 --- a/ets2panda/linter/test/main/runtime_array_bound.ets +++ b/ets2panda/linter/test/main/runtime_array_bound.ets @@ -165,3 +165,8 @@ enum TE{ } arr1[TE.AA] = 12; +let a: string[] = []; +let b: Array = new Array(a.length); +for (let i = 0; i < a.length; i++) { + b[i]; +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/runtime_array_bound.ets.arkts2.json b/ets2panda/linter/test/main/runtime_array_bound.ets.arkts2.json index fb3f014d24..a42550c138 100644 --- a/ets2panda/linter/test/main/runtime_array_bound.ets.arkts2.json +++ b/ets2panda/linter/test/main/runtime_array_bound.ets.arkts2.json @@ -1853,6 +1853,36 @@ "suggest": "", "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" + }, + { + "line": 169, + "column": 24, + "endLine": 169, + "endColumn": 43, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 170, + "column": 10, + "endLine": 170, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 170, + "column": 14, + "endLine": 170, + "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/main/runtime_array_bound.ets.migrate.ets b/ets2panda/linter/test/main/runtime_array_bound.ets.migrate.ets index 2d4beff418..b3691dd0dd 100644 --- a/ets2panda/linter/test/main/runtime_array_bound.ets.migrate.ets +++ b/ets2panda/linter/test/main/runtime_array_bound.ets.migrate.ets @@ -165,3 +165,8 @@ enum TE{ } arr1[TE.AA] = 12.0; +let a: string[] = []; +let b: Array = new Array(a.length); +for (let i: number = 0.0; i < a.length; i++) { + b[i as int]; +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/structural_identity.ets.arkts2.json b/ets2panda/linter/test/main/structural_identity.ets.arkts2.json index 89cd070221..9c75437ef7 100644 --- a/ets2panda/linter/test/main/structural_identity.ets.arkts2.json +++ b/ets2panda/linter/test/main/structural_identity.ets.arkts2.json @@ -1234,6 +1234,16 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, + { + "line": 574, + "column": 44, + "endLine": 574, + "endColumn": 49, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, { "line": 575, "column": 44, @@ -1244,6 +1254,36 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, + { + "line": 575, + "column": 44, + "endLine": 575, + "endColumn": 49, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 576, + "column": 38, + "endLine": 576, + "endColumn": 43, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 577, + "column": 38, + "endLine": 577, + "endColumn": 43, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, { "line": 578, "column": 38, @@ -1254,6 +1294,26 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, + { + "line": 578, + "column": 38, + "endLine": 578, + "endColumn": 43, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 579, + "column": 44, + "endLine": 579, + "endColumn": 49, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, { "line": 580, "column": 44, @@ -1264,6 +1324,16 @@ "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" }, + { + "line": 580, + "column": 44, + "endLine": 580, + "endColumn": 49, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, { "line": 590, "column": 10, @@ -1613,16 +1683,6 @@ "suggest": "", "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" - }, - { - "line": 699, - "column": 14, - "endLine": 699, - "endColumn": 21, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/styles_decorator_anon_1.ets.arkts2.json b/ets2panda/linter/test/main/styles_decorator_anon_1.ets.arkts2.json index b63b7b7e89..5968dc36b9 100644 --- a/ets2panda/linter/test/main/styles_decorator_anon_1.ets.arkts2.json +++ b/ets2panda/linter/test/main/styles_decorator_anon_1.ets.arkts2.json @@ -19,9 +19,9 @@ "column": 18, "endLine": 40, "endColumn": 6, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/styles_decorator_anon_1.ets.autofix.json b/ets2panda/linter/test/main/styles_decorator_anon_1.ets.autofix.json index caa81eea0f..8dd9a34ccf 100644 --- a/ets2panda/linter/test/main/styles_decorator_anon_1.ets.autofix.json +++ b/ets2panda/linter/test/main/styles_decorator_anon_1.ets.autofix.json @@ -19,7 +19,7 @@ "column": 18, "endLine": 40, "endColumn": 6, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "autofix": [ { "start": 767, @@ -32,7 +32,7 @@ } ], "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { @@ -108,7 +108,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, BuilderParam, Require, Button, CommonMethod, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n CommonMethod,\n Color,\n} from '@kit.ArkUI';", "line": 33, "column": 26, "endLine": 33, @@ -129,7 +129,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, BuilderParam, Require, Button, CommonMethod, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n CommonMethod,\n Color,\n} from '@kit.ArkUI';", "line": 33, "column": 26, "endLine": 33, @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, BuilderParam, Require, Button, CommonMethod, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n CommonMethod,\n Color,\n} from '@kit.ArkUI';", "line": 33, "column": 26, "endLine": 33, @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, BuilderParam, Require, Button, CommonMethod, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n CommonMethod,\n Color,\n} from '@kit.ArkUI';", "line": 33, "column": 26, "endLine": 33, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, BuilderParam, Require, Button, CommonMethod, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n CommonMethod,\n Color,\n} from '@kit.ArkUI';", "line": 33, "column": 26, "endLine": 33, @@ -213,7 +213,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Entry, Component, BuilderParam, Require, Button, CommonMethod, Color } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n CommonMethod,\n Color,\n} from '@kit.ArkUI';", "line": 33, "column": 26, "endLine": 33, diff --git a/ets2panda/linter/test/main/styles_decorator_anon_1.ets.migrate.ets b/ets2panda/linter/test/main/styles_decorator_anon_1.ets.migrate.ets index a8c3964416..9df6448f87 100644 --- a/ets2panda/linter/test/main/styles_decorator_anon_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/styles_decorator_anon_1.ets.migrate.ets @@ -13,7 +13,15 @@ * limitations under the License. */ -import { Entry, Component, BuilderParam, Require, Button, CommonMethod, Color } from '@kit.ArkUI'; +import { + Entry, + Component, + BuilderParam, + Require, + Button, + CommonMethod, + Color, +} from '@kit.ArkUI'; @Entry @Component diff --git a/ets2panda/linter/test/main/styles_decorator_global_1.ets.autofix.json b/ets2panda/linter/test/main/styles_decorator_global_1.ets.autofix.json index bbd292d197..b17ed5a73a 100644 --- a/ets2panda/linter/test/main/styles_decorator_global_1.ets.autofix.json +++ b/ets2panda/linter/test/main/styles_decorator_global_1.ets.autofix.json @@ -189,7 +189,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, @@ -210,7 +210,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, @@ -231,7 +231,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, @@ -252,7 +252,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, @@ -273,7 +273,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, @@ -294,7 +294,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, @@ -315,7 +315,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, @@ -336,7 +336,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, @@ -357,7 +357,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Component,\n Column,\n Text,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 59, "column": 9, "endLine": 59, diff --git a/ets2panda/linter/test/main/styles_decorator_global_1.ets.migrate.ets b/ets2panda/linter/test/main/styles_decorator_global_1.ets.migrate.ets index b98a8816ae..9a2edff121 100644 --- a/ets2panda/linter/test/main/styles_decorator_global_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/styles_decorator_global_1.ets.migrate.ets @@ -13,7 +13,18 @@ * limitations under the License. */ -import { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI'; +import { applyStyles } from '@kit.ArkUI'; + +import { + CommonMethod, + Color, + Component, + Column, + Text, + BuilderParam, + Require, + Button, +} from '@kit.ArkUI'; const mycolor: string = "#ffff00" diff --git a/ets2panda/linter/test/main/styles_decorator_global_2.ets b/ets2panda/linter/test/main/styles_decorator_global_2.ets index fd272fd000..a6aa7a73dd 100644 --- a/ets2panda/linter/test/main/styles_decorator_global_2.ets +++ b/ets2panda/linter/test/main/styles_decorator_global_2.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +import { applyStyles } from '@kit.ArkUI'; + import { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI'; const mycolor: string = "#ffff00" @@ -20,11 +22,11 @@ const mycolor: string = "#ffff00" function cardStyle1(instance: CommonMethod): void { instance.backgroundColor(mycolor); instance.borderColor(Color.Red); - instance.borderRadius(8); - instance.padding(8); + instance.borderRadius(8.0); + instance.padding(8.0); instance.backgroundImagePosition({ - x: 0, - y: 0 + x: 0.0, + y: 0.0 }); } diff --git a/ets2panda/linter/test/main/styles_decorator_global_2.ets.arkts2.json b/ets2panda/linter/test/main/styles_decorator_global_2.ets.arkts2.json index ad6581e89d..ca88f857e9 100644 --- a/ets2panda/linter/test/main/styles_decorator_global_2.ets.arkts2.json +++ b/ets2panda/linter/test/main/styles_decorator_global_2.ets.arkts2.json @@ -13,46 +13,5 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ - { - "line": 23, - "column": 27, - "endLine": 23, - "endColumn": 28, - "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": 26, - "column": 12, - "endLine": 26, - "endColumn": 13, - "problem": "NumericSemantics", - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 27, - "column": 12, - "endLine": 27, - "endColumn": 13, - "problem": "NumericSemantics", - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - } - ] + "result": [] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/styles_decorator_global_2.ets.autofix.json b/ets2panda/linter/test/main/styles_decorator_global_2.ets.autofix.json index f06d87b1b5..ca88f857e9 100644 --- a/ets2panda/linter/test/main/styles_decorator_global_2.ets.autofix.json +++ b/ets2panda/linter/test/main/styles_decorator_global_2.ets.autofix.json @@ -13,90 +13,5 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ - { - "line": 23, - "column": 27, - "endLine": 23, - "endColumn": 28, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 901, - "end": 902, - "replacementText": "8.0", - "line": 23, - "column": 27, - "endLine": 23, - "endColumn": 28 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 22, - "endLine": 24, - "endColumn": 23, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 926, - "end": 927, - "replacementText": "8.0", - "line": 24, - "column": 22, - "endLine": 24, - "endColumn": 23 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 12, - "endLine": 26, - "endColumn": 13, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 980, - "end": 981, - "replacementText": "0.0", - "line": 26, - "column": 12, - "endLine": 26, - "endColumn": 13 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 27, - "column": 12, - "endLine": 27, - "endColumn": 13, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 994, - "end": 995, - "replacementText": "0.0", - "line": 27, - "column": 12, - "endLine": 27, - "endColumn": 13 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - } - ] + "result": [] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/styles_decorator_global_2.ets.migrate.ets b/ets2panda/linter/test/main/styles_decorator_global_2.ets.migrate.ets index b98a8816ae..a6aa7a73dd 100644 --- a/ets2panda/linter/test/main/styles_decorator_global_2.ets.migrate.ets +++ b/ets2panda/linter/test/main/styles_decorator_global_2.ets.migrate.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +import { applyStyles } from '@kit.ArkUI'; + import { CommonMethod, Color, Component, Column, Text, BuilderParam, Require, Button } from '@kit.ArkUI'; const mycolor: string = "#ffff00" diff --git a/ets2panda/linter/test/main/styles_decorator_mix_1.ets.arkts2.json b/ets2panda/linter/test/main/styles_decorator_mix_1.ets.arkts2.json index 8879e846e8..41dee5dfe6 100644 --- a/ets2panda/linter/test/main/styles_decorator_mix_1.ets.arkts2.json +++ b/ets2panda/linter/test/main/styles_decorator_mix_1.ets.arkts2.json @@ -39,9 +39,9 @@ "column": 18, "endLine": 43, "endColumn": 6, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { @@ -49,9 +49,9 @@ "column": 18, "endLine": 62, "endColumn": 6, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { @@ -59,9 +59,9 @@ "column": 20, "endLine": 76, "endColumn": 8, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { @@ -69,9 +69,9 @@ "column": 20, "endLine": 90, "endColumn": 8, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/styles_decorator_mix_1.ets.autofix.json b/ets2panda/linter/test/main/styles_decorator_mix_1.ets.autofix.json index bca7d3fc19..ed6bb9b66e 100644 --- a/ets2panda/linter/test/main/styles_decorator_mix_1.ets.autofix.json +++ b/ets2panda/linter/test/main/styles_decorator_mix_1.ets.autofix.json @@ -45,7 +45,7 @@ { "start": 765, "end": 830, - "replacementText": "PressedStyles = (instance: CommonMethod): void => {\n instance.backgroundColor(Color.Green);\n };", + "replacementText": "PressedStyles: CustomStyles = (instance: CommonMethod): void => {\n instance.backgroundColor(Color.Green);\n };", "line": 28, "column": 3, "endLine": 31, @@ -61,7 +61,7 @@ "column": 18, "endLine": 43, "endColumn": 6, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "autofix": [ { "start": 912, @@ -74,7 +74,7 @@ } ], "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { @@ -82,7 +82,7 @@ "column": 18, "endLine": 62, "endColumn": 6, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "autofix": [ { "start": 1214, @@ -95,7 +95,7 @@ } ], "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { @@ -103,7 +103,7 @@ "column": 20, "endLine": 76, "endColumn": 8, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "autofix": [ { "start": 1407, @@ -116,7 +116,7 @@ } ], "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { @@ -124,7 +124,7 @@ "column": 20, "endLine": 90, "endColumn": 8, - "problem": "StylesDecoratorNotSupported", + "problem": "StateStylesBlockNeedArrowFunc", "autofix": [ { "start": 1609, @@ -137,7 +137,7 @@ } ], "suggest": "", - "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "rule": "The code block passed to stateStyles needs to be an arrow function (arkui-statestyles-block-need-arrow-func)", "severity": "ERROR" }, { @@ -150,7 +150,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -171,7 +171,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -192,7 +192,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -213,7 +213,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -234,7 +234,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -255,7 +255,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -276,7 +276,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -297,7 +297,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -318,7 +318,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -339,7 +339,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -360,7 +360,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -381,7 +381,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -402,7 +402,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -423,7 +423,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -444,7 +444,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -465,7 +465,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -486,7 +486,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -507,7 +507,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, @@ -528,7 +528,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n CommonMethod,\n Color,\n Entry,\n Component,\n BuilderParam,\n Require,\n Button,\n} from '@kit.ArkUI';", "line": 87, "column": 28, "endLine": 87, diff --git a/ets2panda/linter/test/main/styles_decorator_mix_1.ets.migrate.ets b/ets2panda/linter/test/main/styles_decorator_mix_1.ets.migrate.ets index 4e9c2b35e0..0829910761 100644 --- a/ets2panda/linter/test/main/styles_decorator_mix_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/styles_decorator_mix_1.ets.migrate.ets @@ -13,7 +13,17 @@ * limitations under the License. */ -import { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI'; +import { CustomStyles } from '@kit.ArkUI'; + +import { + CommonMethod, + Color, + Entry, + Component, + BuilderParam, + Require, + Button, +} from '@kit.ArkUI'; function NormalStyles(instance: CommonMethod): void { instance.backgroundColor(Color.Blue); @@ -26,7 +36,7 @@ struct MyButton1 { @Require content: () => void; - PressedStyles = (instance: CommonMethod): void => { + PressedStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Green); }; diff --git a/ets2panda/linter/test/main/styles_decorator_mix_2.ets b/ets2panda/linter/test/main/styles_decorator_mix_2.ets index 4e9c2b35e0..3980b18277 100644 --- a/ets2panda/linter/test/main/styles_decorator_mix_2.ets +++ b/ets2panda/linter/test/main/styles_decorator_mix_2.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +import { CustomStyles } from '@kit.ArkUI'; + import { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI'; function NormalStyles(instance: CommonMethod): void { @@ -26,7 +28,7 @@ struct MyButton1 { @Require content: () => void; - PressedStyles = (instance: CommonMethod): void => { + PressedStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Green); }; diff --git a/ets2panda/linter/test/main/styles_decorator_mix_2.ets.migrate.ets b/ets2panda/linter/test/main/styles_decorator_mix_2.ets.migrate.ets index 4e9c2b35e0..3980b18277 100644 --- a/ets2panda/linter/test/main/styles_decorator_mix_2.ets.migrate.ets +++ b/ets2panda/linter/test/main/styles_decorator_mix_2.ets.migrate.ets @@ -13,6 +13,8 @@ * limitations under the License. */ +import { CustomStyles } from '@kit.ArkUI'; + import { CommonMethod, Color, Entry, Component, BuilderParam, Require, Button } from '@kit.ArkUI'; function NormalStyles(instance: CommonMethod): void { @@ -26,7 +28,7 @@ struct MyButton1 { @Require content: () => void; - PressedStyles = (instance: CommonMethod): void => { + PressedStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Green); }; diff --git a/ets2panda/linter/test/main/styles_decorator_struct_1.ets.autofix.json b/ets2panda/linter/test/main/styles_decorator_struct_1.ets.autofix.json index 9973d73974..e20cf62d15 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_1.ets.autofix.json +++ b/ets2panda/linter/test/main/styles_decorator_struct_1.ets.autofix.json @@ -24,7 +24,7 @@ { "start": 635, "end": 716, - "replacementText": "cardStyle1 = (instance: CommonMethod): void => {\n instance.backgroundColor('#ffffff');\n instance.borderRadius(8);\n };", + "replacementText": "cardStyle1: CustomStyles = (instance: CommonMethod): void => {\n instance.backgroundColor('#ffffff');\n instance.borderRadius(8);\n };", "line": 18, "column": 3, "endLine": 22, @@ -84,7 +84,7 @@ { "start": 870, "end": 1010, - "replacementText": "cardStyle2 = (instance: CommonMethod): void => {\n instance.border({\n color: this.getColor(),\n width: this.getWidth()\n });\n instance.backgroundColor('#ffffff');\n };", + "replacementText": "cardStyle2: CustomStyles = (instance: CommonMethod): void => {\n instance.border({\n color: this.getColor(),\n width: this.getWidth()\n });\n instance.backgroundColor('#ffffff');\n };", "line": 35, "column": 3, "endLine": 42, @@ -144,7 +144,7 @@ { "start": 1326, "end": 1388, - "replacementText": "NormalStyles = (instance: CommonMethod): void => {\n instance.backgroundColor(Color.Red);\n };", + "replacementText": "NormalStyles: CustomStyles = (instance: CommonMethod): void => {\n instance.backgroundColor(Color.Red);\n };", "line": 67, "column": 3, "endLine": 70, @@ -165,7 +165,7 @@ { "start": 1392, "end": 1457, - "replacementText": "PressedStyles = (instance: CommonMethod): void => {\n instance.backgroundColor(Color.Green);\n };", + "replacementText": "PressedStyles: CustomStyles = (instance: CommonMethod): void => {\n instance.backgroundColor(Color.Green);\n };", "line": 72, "column": 3, "endLine": 75, @@ -196,7 +196,7 @@ { "start": 1953, "end": 2449, - "replacementText": "imageStyle = (instance: CommonMethod): void => {\n instance.draggable(this.isShowLongPressMenu() && this.isPC());\n instance.onDragStart(() => {\n console.info(TAG, 'onDragStart');\n this.touchVibrate(VibrateType.DRAG);\n if (this.mediaItem?.path) {\n this.previewUri =\n this.getPreviewUri(this.mediaItem?.path, this.mediaItem?.getDateModified?.(), false, true);\n }\n return this.DragBuilder;\n });\n instance.accessibilityText(this.isOpenTouchGuide ? this.getImageItemGridAccessibilityText() : '');\n };", + "replacementText": "imageStyle: CustomStyles = (instance: CommonMethod): void => {\n instance.draggable(this.isShowLongPressMenu() && this.isPC());\n instance.onDragStart(() => {\n console.info(TAG, 'onDragStart');\n this.touchVibrate(VibrateType.DRAG);\n if (this.mediaItem?.path) {\n this.previewUri =\n this.getPreviewUri(this.mediaItem?.path, this.mediaItem?.getDateModified?.(), false, true);\n }\n return this.DragBuilder;\n });\n instance.accessibilityText(this.isOpenTouchGuide ? this.getImageItemGridAccessibilityText() : '');\n };", "line": 105, "column": 3, "endLine": 118, @@ -227,7 +227,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -248,7 +248,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -269,7 +269,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -290,7 +290,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -311,7 +311,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -332,7 +332,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -353,7 +353,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -374,7 +374,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -395,7 +395,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -416,7 +416,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -437,7 +437,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -458,7 +458,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -479,7 +479,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -500,7 +500,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -521,7 +521,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -542,7 +542,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -563,7 +563,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, @@ -584,7 +584,7 @@ { "start": 603, "end": 603, - "replacementText": "\n\nimport { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI';", + "replacementText": "\n\nimport {\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n BuilderParam,\n Require,\n Button,\n CustomBuilder,\n} from '@kit.ArkUI';", "line": 103, "column": 24, "endLine": 103, diff --git a/ets2panda/linter/test/main/styles_decorator_struct_1.ets.migrate.ets b/ets2panda/linter/test/main/styles_decorator_struct_1.ets.migrate.ets index 006f34c342..9740157644 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_1.ets.migrate.ets +++ b/ets2panda/linter/test/main/styles_decorator_struct_1.ets.migrate.ets @@ -13,11 +13,26 @@ * limitations under the License. */ -import { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI'; +import { + CustomStyles, + applyStyles, +} from '@kit.ArkUI'; + +import { + Component, + CommonMethod, + Column, + Text, + Color, + BuilderParam, + Require, + Button, + CustomBuilder, +} from '@kit.ArkUI'; @Component struct MyCard1 { - cardStyle1 = (instance: CommonMethod): void => { + cardStyle1: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor('#ffffff'); instance.borderRadius(8.0); }; @@ -33,7 +48,7 @@ struct MyCard1 { @Component struct MyCard2 { - cardStyle2 = (instance: CommonMethod): void => { + cardStyle2: CustomStyles = (instance: CommonMethod): void => { instance.border({ color: this.getColor(), width: this.getWidth() @@ -64,11 +79,11 @@ struct MyButton { @Require content: () => void; - NormalStyles = (instance: CommonMethod): void => { + NormalStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Red); }; - PressedStyles = (instance: CommonMethod): void => { + PressedStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Green); }; @@ -100,7 +115,7 @@ struct imageTest { private previewUri: string | undefined; private DragBuilder: CustomBuilder | undefined; - imageStyle = (instance: CommonMethod): void => { + imageStyle: CustomStyles = (instance: CommonMethod): void => { instance.draggable(this.isShowLongPressMenu() && this.isPC()); instance.onDragStart(() => { console.info(TAG, 'onDragStart'); diff --git a/ets2panda/linter/test/main/styles_decorator_struct_1.ets.migrate.json b/ets2panda/linter/test/main/styles_decorator_struct_1.ets.migrate.json index b0daffd23c..a860c9a7c7 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_1.ets.migrate.json +++ b/ets2panda/linter/test/main/styles_decorator_struct_1.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 101, + "line": 116, "column": 24, - "endLine": 101, + "endLine": 116, "endColumn": 37, "problem": "LimitedVoidTypeFromSdk", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 105, + "line": 120, "column": 26, - "endLine": 113, + "endLine": 128, "endColumn": 6, "problem": "LimitedReturnTypeInference", "suggest": "", diff --git a/ets2panda/linter/test/main/styles_decorator_struct_2.ets b/ets2panda/linter/test/main/styles_decorator_struct_2.ets index 31fb825cee..18cbf48fc3 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_2.ets +++ b/ets2panda/linter/test/main/styles_decorator_struct_2.ets @@ -13,13 +13,15 @@ * limitations under the License. */ +import { CustomStyles, applyStyles } from '@kit.ArkUI'; + import { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI'; @Component struct MyCard1 { - cardStyle1 = (instance: CommonMethod): void => { + cardStyle1: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor('#ffffff'); - instance.borderRadius(8); + instance.borderRadius(8.0); }; build() { @@ -33,7 +35,7 @@ struct MyCard1 { @Component struct MyCard2 { - cardStyle2 = (instance: CommonMethod): void => { + cardStyle2: CustomStyles = (instance: CommonMethod): void => { instance.border({ color: this.getColor(), width: this.getWidth() @@ -46,7 +48,7 @@ struct MyCard2 { } private getWidth(): number { - return 10 + return 10.0 } build() { @@ -64,11 +66,11 @@ struct MyButton { @Require content: () => void; - NormalStyles = (instance: CommonMethod): void => { + NormalStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Red); }; - PressedStyles = (instance: CommonMethod): void => { + PressedStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Green); }; @@ -100,7 +102,7 @@ struct imageTest { private previewUri: string | undefined; private DragBuilder: CustomBuilder | undefined; - imageStyle = (instance: CommonMethod): void => { + imageStyle: CustomStyles = (instance: CommonMethod): void => { instance.draggable(this.isShowLongPressMenu() && this.isPC()); instance.onDragStart(() => { console.info(TAG, 'onDragStart'); diff --git a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.arkts2.json b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.arkts2.json index 1e21ab6ed3..4eb3f7e164 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.arkts2.json +++ b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.arkts2.json @@ -15,29 +15,9 @@ ], "result": [ { - "line": 22, - "column": 27, - "endLine": 22, - "endColumn": 28, - "problem": "NumericSemantics", - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 49, - "column": 12, - "endLine": 49, - "endColumn": 14, - "problem": "NumericSemantics", - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 101, + "line": 103, "column": 24, - "endLine": 101, + "endLine": 103, "endColumn": 37, "problem": "LimitedVoidTypeFromSdk", "suggest": "", @@ -45,9 +25,9 @@ "severity": "ERROR" }, { - "line": 105, + "line": 107, "column": 26, - "endLine": 113, + "endLine": 115, "endColumn": 6, "problem": "LimitedReturnTypeInference", "suggest": "", diff --git a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.autofix.json b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.autofix.json index bfbd6bbec9..4eb3f7e164 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.autofix.json +++ b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.autofix.json @@ -15,51 +15,9 @@ ], "result": [ { - "line": 22, - "column": 27, - "endLine": 22, - "endColumn": 28, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 873, - "end": 874, - "replacementText": "8.0", - "line": 22, - "column": 27, - "endLine": 22, - "endColumn": 28 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 49, - "column": 12, - "endLine": 49, - "endColumn": 14, - "problem": "NumericSemantics", - "autofix": [ - { - "start": 1358, - "end": 1360, - "replacementText": "10.0", - "line": 49, - "column": 12, - "endLine": 49, - "endColumn": 14 - } - ], - "suggest": "", - "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", - "severity": "ERROR" - }, - { - "line": 101, + "line": 103, "column": 24, - "endLine": 101, + "endLine": 103, "endColumn": 37, "problem": "LimitedVoidTypeFromSdk", "suggest": "", @@ -67,9 +25,9 @@ "severity": "ERROR" }, { - "line": 105, + "line": 107, "column": 26, - "endLine": 113, + "endLine": 115, "endColumn": 6, "problem": "LimitedReturnTypeInference", "suggest": "", diff --git a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.json b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.json index 0e17a7dad5..4e818a87e4 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.json +++ b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 105, + "line": 107, "column": 26, - "endLine": 113, + "endLine": 115, "endColumn": 6, "problem": "LimitedReturnTypeInference", "suggest": "", diff --git a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.migrate.ets b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.migrate.ets index 006f34c342..18cbf48fc3 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.migrate.ets +++ b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.migrate.ets @@ -13,11 +13,13 @@ * limitations under the License. */ +import { CustomStyles, applyStyles } from '@kit.ArkUI'; + import { Component, CommonMethod, Column, Text, Color, BuilderParam, Require, Button, CustomBuilder } from '@kit.ArkUI'; @Component struct MyCard1 { - cardStyle1 = (instance: CommonMethod): void => { + cardStyle1: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor('#ffffff'); instance.borderRadius(8.0); }; @@ -33,7 +35,7 @@ struct MyCard1 { @Component struct MyCard2 { - cardStyle2 = (instance: CommonMethod): void => { + cardStyle2: CustomStyles = (instance: CommonMethod): void => { instance.border({ color: this.getColor(), width: this.getWidth() @@ -64,11 +66,11 @@ struct MyButton { @Require content: () => void; - NormalStyles = (instance: CommonMethod): void => { + NormalStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Red); }; - PressedStyles = (instance: CommonMethod): void => { + PressedStyles: CustomStyles = (instance: CommonMethod): void => { instance.backgroundColor(Color.Green); }; @@ -100,7 +102,7 @@ struct imageTest { private previewUri: string | undefined; private DragBuilder: CustomBuilder | undefined; - imageStyle = (instance: CommonMethod): void => { + imageStyle: CustomStyles = (instance: CommonMethod): void => { instance.draggable(this.isShowLongPressMenu() && this.isPC()); instance.onDragStart(() => { console.info(TAG, 'onDragStart'); diff --git a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.migrate.json b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.migrate.json index b0daffd23c..4eb3f7e164 100644 --- a/ets2panda/linter/test/main/styles_decorator_struct_2.ets.migrate.json +++ b/ets2panda/linter/test/main/styles_decorator_struct_2.ets.migrate.json @@ -15,9 +15,9 @@ ], "result": [ { - "line": 101, + "line": 103, "column": 24, - "endLine": 101, + "endLine": 103, "endColumn": 37, "problem": "LimitedVoidTypeFromSdk", "suggest": "", @@ -25,9 +25,9 @@ "severity": "ERROR" }, { - "line": 105, + "line": 107, "column": 26, - "endLine": 113, + "endLine": 115, "endColumn": 6, "problem": "LimitedReturnTypeInference", "suggest": "", diff --git a/ets2panda/linter/test/main/styles_decorator_struct_3.ets b/ets2panda/linter/test/main/styles_decorator_struct_3.ets new file mode 100644 index 0000000000..6fbf3a6408 --- /dev/null +++ b/ets2panda/linter/test/main/styles_decorator_struct_3.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. + */ + +@Entry +@Component +struct MyCard { + @Styles + private cardStyle1() { + .backgroundColor('#ffffff') + .borderRadius(8) + } + + @Styles + public cardStyle2() { + .backgroundColor('#ffffff') + .borderRadius(8) + } + + build() { + Column() { + Text('Card').cardStyle1() + } + .cardStyle2() + .backgroundColor(Color.Red) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/styles_decorator_struct_3.ets.args.json b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.args.json new file mode 100644 index 0000000000..ee0734c0fc --- /dev/null +++ b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.args.json @@ -0,0 +1,21 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "", + "autofix": "--arkts-2", + "migrate": "--arkts-2" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/styles_decorator_struct_3.ets.arkts2.json b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.arkts2.json new file mode 100644 index 0000000000..fe9239c66e --- /dev/null +++ b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.arkts2.json @@ -0,0 +1,108 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT 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": 3, + "endLine": 23, + "endColumn": 4, + "problem": "StylesDecoratorNotSupported", + "suggest": "", + "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 19, + "endLine": 22, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 3, + "endLine": 29, + "endColumn": 4, + "problem": "StylesDecoratorNotSupported", + "suggest": "", + "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 19, + "endLine": 28, + "endColumn": 20, + "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": 32, + "column": 5, + "endLine": 32, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 7, + "endLine": 33, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 22, + "endLine": 36, + "endColumn": 27, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Color\" 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/styles_decorator_struct_3.ets.autofix.json b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.autofix.json new file mode 100644 index 0000000000..63633712c0 --- /dev/null +++ b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.autofix.json @@ -0,0 +1,225 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT 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": 3, + "endLine": 23, + "endColumn": 4, + "problem": "StylesDecoratorNotSupported", + "autofix": [ + { + "start": 641, + "end": 730, + "replacementText": "private cardStyle1: CustomStyles = (instance: CommonMethod): void => {\n instance.backgroundColor('#ffffff');\n instance.borderRadius(8);\n };", + "line": 19, + "column": 3, + "endLine": 23, + "endColumn": 4 + }, + { + "start": 870, + "end": 882, + "replacementText": "applyStyles(this.cardStyle1)", + "line": 19, + "column": 3, + "endLine": 23, + "endColumn": 4 + } + ], + "suggest": "", + "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 19, + "endLine": 22, + "endColumn": 20, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 724, + "end": 725, + "replacementText": "8.0", + "line": 22, + "column": 19, + "endLine": 22, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 3, + "endLine": 29, + "endColumn": 4, + "problem": "StylesDecoratorNotSupported", + "autofix": [ + { + "start": 734, + "end": 822, + "replacementText": "public cardStyle2: CustomStyles = (instance: CommonMethod): void => {\n instance.backgroundColor('#ffffff');\n instance.borderRadius(8);\n };", + "line": 25, + "column": 3, + "endLine": 29, + "endColumn": 4 + }, + { + "start": 894, + "end": 906, + "replacementText": "applyStyles(this.cardStyle2)", + "line": 25, + "column": 3, + "endLine": 29, + "endColumn": 4 + } + ], + "suggest": "", + "rule": "\"@Styles\" decorator is not supported (arkui-no-styles-decorator)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 19, + "endLine": 28, + "endColumn": 20, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 816, + "end": 817, + "replacementText": "8.0", + "line": 28, + "column": 19, + "endLine": 28, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "autofix": [ + { + "start": 603, + "end": 603, + "replacementText": "\n\nimport {\n Entry,\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n} from '@kit.ArkUI';", + "line": 36, + "column": 22, + "endLine": 36, + "endColumn": 27 + } + ], + "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", + "autofix": [ + { + "start": 603, + "end": 603, + "replacementText": "\n\nimport {\n Entry,\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n} from '@kit.ArkUI';", + "line": 36, + "column": 22, + "endLine": 36, + "endColumn": 27 + } + ], + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 5, + "endLine": 32, + "endColumn": 11, + "problem": "UIInterfaceImport", + "autofix": [ + { + "start": 603, + "end": 603, + "replacementText": "\n\nimport {\n Entry,\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n} from '@kit.ArkUI';", + "line": 36, + "column": 22, + "endLine": 36, + "endColumn": 27 + } + ], + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 7, + "endLine": 33, + "endColumn": 11, + "problem": "UIInterfaceImport", + "autofix": [ + { + "start": 603, + "end": 603, + "replacementText": "\n\nimport {\n Entry,\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n} from '@kit.ArkUI';", + "line": 36, + "column": 22, + "endLine": 36, + "endColumn": 27 + } + ], + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 22, + "endLine": 36, + "endColumn": 27, + "problem": "UIInterfaceImport", + "autofix": [ + { + "start": 603, + "end": 603, + "replacementText": "\n\nimport {\n Entry,\n Component,\n CommonMethod,\n Column,\n Text,\n Color,\n} from '@kit.ArkUI';", + "line": 36, + "column": 22, + "endLine": 36, + "endColumn": 27 + } + ], + "suggest": "", + "rule": "The ArkUI interface \"Color\" 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/styles_decorator_struct_3.ets.json b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.json new file mode 100644 index 0000000000..ca88f857e9 --- /dev/null +++ b/ets2panda/linter/test/main/styles_decorator_struct_3.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/styles_decorator_struct_3.ets.migrate.ets b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.migrate.ets new file mode 100644 index 0000000000..4226bfdc36 --- /dev/null +++ b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.migrate.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 { + CustomStyles, + applyStyles, +} from '@kit.ArkUI'; + +import { + Entry, + Component, + CommonMethod, + Column, + Text, + Color, +} from '@kit.ArkUI'; + +@Entry +@Component +struct MyCard { + private cardStyle1: CustomStyles = (instance: CommonMethod): void => { + instance.backgroundColor('#ffffff'); + instance.borderRadius(8.0); + }; + + public cardStyle2: CustomStyles = (instance: CommonMethod): void => { + instance.backgroundColor('#ffffff'); + instance.borderRadius(8.0); + }; + + build() { + Column() { + Text('Card').applyStyles(this.cardStyle1) + } + .applyStyles(this.cardStyle2) + .backgroundColor(Color.Red) + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/styles_decorator_struct_3.ets.migrate.json b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.migrate.json new file mode 100644 index 0000000000..ca88f857e9 --- /dev/null +++ b/ets2panda/linter/test/main/styles_decorator_struct_3.ets.migrate.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/ts_overload.ets.arkts2.json b/ets2panda/linter/test/main/ts_overload.ets.arkts2.json index 625ed5b833..cf5dc0b7d0 100644 --- a/ets2panda/linter/test/main/ts_overload.ets.arkts2.json +++ b/ets2panda/linter/test/main/ts_overload.ets.arkts2.json @@ -44,26 +44,6 @@ "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", "severity": "ERROR" }, - { - "line": 20, - "column": 16, - "endLine": 20, - "endColumn": 20, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, - { - "line": 22, - "column": 16, - "endLine": 22, - "endColumn": 20, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 25, "column": 21, diff --git a/ets2panda/linter/test/rules/rule37.ets.migrate.json b/ets2panda/linter/test/rules/rule37.ets.migrate.json index 0a1c7ec097..ca88f857e9 100644 --- a/ets2panda/linter/test/rules/rule37.ets.migrate.json +++ b/ets2panda/linter/test/rules/rule37.ets.migrate.json @@ -13,16 +13,5 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ - { - "line": 59, - "column": 21, - "endLine": 59, - "endColumn": 27, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - } - ] + "result": [] } \ No newline at end of file diff --git a/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets b/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets new file mode 100644 index 0000000000..71d8cd2396 --- /dev/null +++ b/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.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 { UIAbility } 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 + 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 MyUIAbility extends UIAbility { + onDestroy() { // ❌ Error + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + return sleep(1000); + } +} diff --git a/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.args.json b/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.args.json new file mode 100644 index 0000000000..66fb88f859 --- /dev/null +++ b/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.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/sdk_ability_asynchronous_lifecycle.ets.arkts2.json b/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.arkts2.json new file mode 100644 index 0000000000..6d09991800 --- /dev/null +++ b/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.arkts2.json @@ -0,0 +1,148 @@ +{ + "copyright": [ + "Copyright (c) 2024 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT 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": 22, + "endColumn": 2, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 14, + "endLine": 19, + "endColumn": 21, + "problem": "ConstructorIfaceFromSdk", + "suggest": "", + "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", + "severity": "ERROR" + }, + { + "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": 24, + "column": 3, + "endLine": 27, + "endColumn": 4, + "problem": "LimitedVoidTypeFromSdk", + "suggest": "", + "rule": "Type \"void\" has no instances.(sdk-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 9, + "endLine": 24, + "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": 26, + "column": 12, + "endLine": 26, + "endColumn": 23, + "problem": "StructuralIdentity", + "suggest": "", + "rule": "Structural typing is not supported (arkts-no-structural-typing)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 18, + "endLine": 26, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 1, + "endLine": 35, + "endColumn": 2, + "problem": "TsOverload", + "suggest": "", + "rule": "Class TS overloading is not supported(arkts-no-ts-overload)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 14, + "endLine": 32, + "endColumn": 21, + "problem": "ConstructorIfaceFromSdk", + "suggest": "", + "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 10, + "endLine": 34, + "endColumn": 5, + "problem": "GenericCallNoTypeArgs", + "suggest": "", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 3, + "endLine": 40, + "endColumn": 4, + "problem": "LimitedVoidTypeFromSdk", + "suggest": "", + "rule": "Type \"void\" has no instances.(sdk-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 3, + "endLine": 37, + "endColumn": 12, + "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": 39, + "column": 18, + "endLine": 39, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.json b/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.ets.json new file mode 100644 index 0000000000..dd03fcf544 --- /dev/null +++ b/ets2panda/linter/test/sdk_ability_asynchronous_lifecycle.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/sdkwhite/decl_with_duplicate_name_sdk.ets b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets index 4584cafa7b..43e59da7f5 100755 --- a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets +++ b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets @@ -14,15 +14,11 @@ */ 'use static' -import { TextStyle } from './sdk/declarations/styled_string' -import { HyperlinkAttribute, HyperlinkInterface } from './sdk/declarations/hyperlink' - @Entry @Component struct Index { fontStyleAttr1: TextStyle = new TextStyle({fontColor: Color.Blue}); // Error(2) fontStyleAttr2: TextStyle; // Error - @State styleList: Array = new Array(); // Error aboutToAppear() { for (let i = 15; i < 50; i++) @@ -47,14 +43,26 @@ class TextStyleDemo2 extends TextStyle { // Error } } -let hyperlinkAttr1: HyperlinkAttribute = HyperlinkInterface; -let hyperlinkAttr2: HyperlinkAttribute = HyperlinkInterface.color(''); +let hyperlinkAttr1: HyperlinkAttribute = HyperlinkInterface; // Error +let hyperlinkAttr2: HyperlinkAttribute = HyperlinkInterface.color(''); // Error class HyperlinkTest { - prop1: HyperlinkAttribute = HyperlinkInterface; - prop2: HyperlinkAttribute = HyperlinkInterface.color(''); + prop1: HyperlinkAttribute = HyperlinkInterface; // Error + prop2: HyperlinkAttribute = HyperlinkInterface.color(''); // Error } let hyperlinkAttr3: HyperlinkAttribute; -hyperlinkAttr3 = HyperlinkInterface; -function func(x = HyperlinkInterface) { +hyperlinkAttr3 = HyperlinkInterface; // Error +function func(x = HyperlinkInterface) { // Error + +} +class A { + onBackPress: Function; + TextStyle: Function; + constructor(onBackPress: Function, TextStyle: Function) { + this.onBackPress = onBackPress; // no Error + this.TextStyle = TextStyle; // no Error + } +} +function tt(a: A) { + a.onBackPress(); } diff --git a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json index 64896441f0..d351a537bd 100644 --- a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json +++ b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.arkts2.json @@ -15,29 +15,9 @@ ], "result": [ { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 61, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 86, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 23, + "line": 20, "column": 19, - "endLine": 23, + "endLine": 20, "endColumn": 28, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -45,9 +25,9 @@ "severity": "ERROR" }, { - "line": 23, + "line": 20, "column": 35, - "endLine": 23, + "endLine": 20, "endColumn": 44, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -55,9 +35,19 @@ "severity": "ERROR" }, { - "line": 24, + "line": 20, + "column": 35, + "endLine": 20, + "endColumn": 44, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 21, "column": 19, - "endLine": 24, + "endLine": 21, "endColumn": 28, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -65,9 +55,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 22, "column": 27, - "endLine": 26, + "endLine": 22, "endColumn": 36, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -75,9 +65,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 22, "column": 40, - "endLine": 26, + "endLine": 22, "endColumn": 51, "problem": "GenericCallNoTypeArgs", "suggest": "", @@ -85,9 +75,9 @@ "severity": "ERROR" }, { - "line": 28, + "line": 24, "column": 14, - "endLine": 28, + "endLine": 24, "endColumn": 20, "problem": "NumericSemantics", "suggest": "", @@ -95,9 +85,9 @@ "severity": "ERROR" }, { - "line": 28, + "line": 24, "column": 18, - "endLine": 28, + "endLine": 24, "endColumn": 20, "problem": "NumericSemantics", "suggest": "", @@ -105,9 +95,9 @@ "severity": "ERROR" }, { - "line": 28, + "line": 24, "column": 26, - "endLine": 28, + "endLine": 24, "endColumn": 28, "problem": "NumericSemantics", "suggest": "", @@ -115,9 +105,9 @@ "severity": "ERROR" }, { - "line": 29, + "line": 25, "column": 31, - "endLine": 29, + "endLine": 25, "endColumn": 40, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -125,9 +115,19 @@ "severity": "ERROR" }, { - "line": 34, + "line": 25, + "column": 31, + "endLine": 25, + "endColumn": 40, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 30, "column": 38, - "endLine": 34, + "endLine": 30, "endColumn": 47, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -135,9 +135,9 @@ "severity": "ERROR" }, { - "line": 44, + "line": 40, "column": 30, - "endLine": 44, + "endLine": 40, "endColumn": 39, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -145,9 +145,9 @@ "severity": "ERROR" }, { - "line": 50, + "line": 46, "column": 42, - "endLine": 50, + "endLine": 46, "endColumn": 60, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -155,9 +155,9 @@ "severity": "ERROR" }, { - "line": 51, + "line": 47, "column": 42, - "endLine": 51, + "endLine": 47, "endColumn": 60, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -165,9 +165,9 @@ "severity": "ERROR" }, { - "line": 53, + "line": 49, "column": 31, - "endLine": 53, + "endLine": 49, "endColumn": 49, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -175,9 +175,9 @@ "severity": "ERROR" }, { - "line": 54, + "line": 50, "column": 31, - "endLine": 54, + "endLine": 50, "endColumn": 49, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -185,9 +185,9 @@ "severity": "ERROR" }, { - "line": 57, + "line": 53, "column": 18, - "endLine": 57, + "endLine": 53, "endColumn": 36, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -195,9 +195,19 @@ "severity": "ERROR" }, { - "line": 58, + "line": 54, + "column": 15, + "endLine": 54, + "endColumn": 37, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 54, "column": 19, - "endLine": 58, + "endLine": 54, "endColumn": 37, "problem": "DuplicateDeclNameFromSdk", "suggest": "", @@ -205,9 +215,19 @@ "severity": "ERROR" }, { - "line": 20, + "line": 67, + "column": 3, + "endLine": 67, + "endColumn": 16, + "problem": "ExplicitFunctionType", + "suggest": "", + "rule": "The function type should be explicit (arkts-no-ts-like-function-call)", + "severity": "ERROR" + }, + { + "line": 17, "column": 2, - "endLine": 20, + "endLine": 17, "endColumn": 7, "problem": "UIInterfaceImport", "suggest": "", @@ -215,9 +235,9 @@ "severity": "ERROR" }, { - "line": 21, + "line": 18, "column": 2, - "endLine": 21, + "endLine": 18, "endColumn": 11, "problem": "UIInterfaceImport", "suggest": "", @@ -225,9 +245,29 @@ "severity": "ERROR" }, { - "line": 23, + "line": 20, + "column": 19, + "endLine": 20, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 35, + "endLine": 20, + "endColumn": 44, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, "column": 57, - "endLine": 23, + "endLine": 20, "endColumn": 62, "problem": "UIInterfaceImport", "suggest": "", @@ -235,9 +275,19 @@ "severity": "ERROR" }, { - "line": 26, + "line": 21, + "column": 19, + "endLine": 21, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, "column": 4, - "endLine": 26, + "endLine": 22, "endColumn": 9, "problem": "UIInterfaceImport", "suggest": "", @@ -245,9 +295,29 @@ "severity": "ERROR" }, { - "line": 33, + "line": 22, + "column": 27, + "endLine": 22, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 31, + "endLine": 25, + "endColumn": 40, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 29, "column": 5, - "endLine": 33, + "endLine": 29, "endColumn": 9, "problem": "UIInterfaceImport", "suggest": "", @@ -255,9 +325,9 @@ "severity": "ERROR" }, { - "line": 34, + "line": 30, "column": 7, - "endLine": 34, + "endLine": 30, "endColumn": 14, "problem": "UIInterfaceImport", "suggest": "", @@ -265,9 +335,19 @@ "severity": "ERROR" }, { - "line": 35, + "line": 30, + "column": 38, + "endLine": 30, + "endColumn": 47, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, "column": 9, - "endLine": 35, + "endLine": 31, "endColumn": 17, "problem": "UIInterfaceImport", "suggest": "", @@ -275,9 +355,9 @@ "severity": "ERROR" }, { - "line": 36, + "line": 32, "column": 11, - "endLine": 36, + "endLine": 32, "endColumn": 15, "problem": "UIInterfaceImport", "suggest": "", @@ -285,13 +365,63 @@ "severity": "ERROR" }, { - "line": 24, - "column": 3, - "endLine": 24, - "endColumn": 17, - "problem": "StrictDiagnostic", - "suggest": "Property 'fontStyleAttr2' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'fontStyleAttr2' has no initializer and is not definitely assigned in the constructor.", + "line": 40, + "column": 30, + "endLine": 40, + "endColumn": 39, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextStyle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 21, + "endLine": 46, + "endColumn": 39, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"HyperlinkAttribute\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 21, + "endLine": 47, + "endColumn": 39, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"HyperlinkAttribute\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 49, + "column": 10, + "endLine": 49, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"HyperlinkAttribute\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 50, + "column": 10, + "endLine": 50, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"HyperlinkAttribute\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 21, + "endLine": 52, + "endColumn": 39, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"HyperlinkAttribute\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.json b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.json index 489a1474b5..4e18966ecf 100755 --- a/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.json +++ b/ets2panda/linter/test/sdkwhite/decl_with_duplicate_name_sdk.ets.json @@ -15,33 +15,13 @@ ], "result": [ { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 61, - "problem": "ImportAfterStatement", + "line": 54, + "column": 15, + "endLine": 54, + "endColumn": 37, + "problem": "AnyType", "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 86, - "problem": "ImportAfterStatement", - "suggest": "", - "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 3, - "endLine": 24, - "endColumn": 17, - "problem": "StrictDiagnostic", - "suggest": "Property 'fontStyleAttr2' has no initializer and is not definitely assigned in the constructor.", - "rule": "Property 'fontStyleAttr2' has no initializer and is not definitely assigned in the constructor.", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/sdkwhite/return_new_interface.ets.arkts2.json b/ets2panda/linter/test/sdkwhite/return_new_interface.ets.arkts2.json index 7b974d3450..9245dba0a1 100644 --- a/ets2panda/linter/test/sdkwhite/return_new_interface.ets.arkts2.json +++ b/ets2panda/linter/test/sdkwhite/return_new_interface.ets.arkts2.json @@ -44,16 +44,6 @@ "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, - { - "line": 26, - "column": 14, - "endLine": 26, - "endColumn": 15, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 26, "column": 14, @@ -74,16 +64,6 @@ "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, - { - "line": 30, - "column": 14, - "endLine": 30, - "endColumn": 15, - "problem": "ConstructorIfaceFromSdk", - "suggest": "", - "rule": "Construct signatures are not supported in interfaces.(sdk-ctor-signatures-iface)", - "severity": "ERROR" - }, { "line": 30, "column": 14, diff --git a/ets2panda/linter/webpack.config.js b/ets2panda/linter/webpack.config.js index 15ee37c29b..2a15b2bfd7 100644 --- a/ets2panda/linter/webpack.config.js +++ b/ets2panda/linter/webpack.config.js @@ -1,5 +1,5 @@ /* - * 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 @@ -17,7 +17,7 @@ let path = require('path'); module.exports = { mode: 'development', - target: 'node', + target: 'node', entry: './build/cli/main.js', externalsType: 'commonjs', externals: { -- Gitee