diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 180f5dae35b2f69eaae0c58d20b3713b0c5a67cc..cf8d8b39d6a7d2f5f6e2ffb78a8639717703dd53 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -225,6 +225,7 @@ import { COMPONENT_DECORATOR, SELECT_IDENTIFIER, SELECT_OPTIONS, STRING_ERROR_LI import { ES_OBJECT } from './utils/consts/ESObject'; import { cookBookMsg } from './CookBookMsg'; import { getCommonApiInfoMap } from './utils/functions/CommonApiInfo'; +import { arkuiDecoratorSet } from './utils/consts/ArkuiDecorator'; export class TypeScriptLinter extends BaseTypeScriptLinter { supportedStdCallApiChecker: SupportedStdCallApiChecker; @@ -15418,6 +15419,11 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!this.options.arkts2 || !TypeScriptLinter.builtApiInfo) { return; } + + if (arkuiDecoratorSet.has(decorator.expression.getText())) { + return; + } + const type = this.tsTypeChecker.getTypeAtLocation(decorator.expression); const aliasSymbol = type.aliasSymbol; const declaration = aliasSymbol?.declarations?.[0]; diff --git a/ets2panda/linter/src/lib/utils/consts/ArkuiDecorator.ts b/ets2panda/linter/src/lib/utils/consts/ArkuiDecorator.ts new file mode 100644 index 0000000000000000000000000000000000000000..6fd2d824c53f88d5ad491009bc109e7890c19f56 --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/ArkuiDecorator.ts @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export const arkuiDecoratorSet: Set = new Set([ + 'Styles', + 'Extend', + 'Entry', + 'Preview', + 'Component', + 'Builder', + 'LocalBuilder', + 'BuilderParam', + 'AnimatableExtend', + 'Require', + 'Reusable', + 'State', + 'Prop', + 'Link', + 'Provide', + 'Consume', + 'Observed', + 'ObjectLink', + 'LocalStorageProp', + 'LocalStorageLink', + 'StorageProp', + 'StorageLink', + 'Watch', + 'Track', + 'ObservedV2', + 'Trace', + 'ComponentV2', + 'Local', + 'Param', + 'Once', + 'Event', + 'Provider', + 'Consumer', + 'Monitor', + 'Computed', + 'Type', + 'ReusableV2', + 'CustomDialog' +]);