diff --git a/ets2panda/linter/package.json b/ets2panda/linter/package.json index 8005b794863ea5fcef055cbca09374af90ebd62a..a2a04e45e466398175b034b8efcd7c5d51dfff52 100644 --- a/ets2panda/linter/package.json +++ b/ets2panda/linter/package.json @@ -20,7 +20,7 @@ "pack:linter": "rimraf bundle && mkdir bundle && npm pack && mv panda-tslinter-*.tgz bundle", "pretest": " npm run fix", "test": "npm run test_all && npm run test_ts_import_ets", - "test_all": "npm run testrunner -- -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi, test/taskpool,test/sdkcommonapi", + "test_all": "npm run testrunner -- -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi, test/taskpool,test/sdkcommonapi, test/forbidden_keywords", "test_main": "npm run testrunner -- -d test/main", "test_ohmurl": "npm run testrunner -- -d test/ohmurl", "test_interop": "npm run testrunner -- -d test/interop", @@ -38,8 +38,9 @@ "test_rules_sdk": "npm run testrunner -- -d test/rules --sdk", "test_ts_import_ets": "npm run testrunner -- -d test/ts_import_ets/ts --sdk --interop-mode", "test_migration": "npm run testrunner -- -d test/migration", + "test_keyword": "npm run testrunner -- -d test/forbidden_keywords", "testrunner": "npm run compile && node build/testRunner/TestRunner.js", - "update-tests": "node scripts/update-test-results.mjs test/main test/rules test/regression test/extended_features test/ts_import_ets/ts test/migration test/ohmurl test/interop test/sdkwhite test/concurrent test/builtin test/deprecatedapi test/sdkcommonapi test/taskpool", + "update-tests": "node scripts/update-test-results.mjs test/main test/rules test/regression test/extended_features test/ts_import_ets/ts test/migration test/ohmurl test/interop test/sdkwhite test/concurrent test/builtin test/deprecatedapi test/sdkcommonapi test/taskpool test/forbidden_keywords", "eslint-check": "npx eslint .", "eslint-fix": "npm run eslint-check -- --fix", "prettier-fix": "npx prettier --write .", @@ -47,7 +48,7 @@ "coverage": "npm run coverage-prepare && npm run coverage-instrument && npm run coverage-test && npm run coverage-collect && npm run coverage-report", "coverage-prepare": "npm run build && node scripts/testRunner/coverage_prepare.js", "coverage-instrument": "nyc --compact false instrument build coverage/build_instrument", - "coverage-test": "node coverage/build_instrument/testRunner/TestRunner.js -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi,test/sdkcommonapi", + "coverage-test": "node coverage/build_instrument/testRunner/TestRunner.js -d test/main,test/rules,test/regression,test/extended_features,test/migration,test/ohmurl,test/interop,test/sdkwhite,test/concurrent,test/builtin,test/deprecatedapi,test/sdkcommonapi, test/forbidden_keywords", "coverage-collect": "node scripts/testRunner/coverage_collect.js", "coverage-report": "node scripts/testRunner/coverage_report.js" }, diff --git a/ets2panda/linter/rule-config.json b/ets2panda/linter/rule-config.json index 6d799da52a5a1fdf64e9d1fc264dc6c3fb7b187f..19400549ff9ee835afb29c8d7eeb41f5d1ff0f84 100644 --- a/ets2panda/linter/rule-config.json +++ b/ets2panda/linter/rule-config.json @@ -144,7 +144,8 @@ "sdk-no-decl-with-duplicate-name", "sdk-type-query", "sdk-ability-asynchronous-lifecycle", - "sdk-ability-lifecycle-monitor" + "sdk-ability-lifecycle-monitor", + "sdk-api-keywords-avoid" ], "concurrent": [ "arkts-no-need-stdlib-ason", diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index 403fe20db60795c4c18b790eb38118b8de8ced6e..5d02697b667f0b5a1d207205a586400ae345f9bc 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -69,7 +69,7 @@ cookBookTag[38] = cookBookTag[39] = ''; cookBookTag[40] = 'Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)'; cookBookTag[41] = ''; -cookBookTag[42] = ''; +cookBookTag[42] = 'Avoid using reserved keyword (sdk-api-keywords-avoid)'; cookBookTag[43] = 'Array literals must contain elements of only inferrable types (arkts-no-noninferrable-arr-literals)'; cookBookTag[44] = ''; cookBookTag[45] = ''; diff --git a/ets2panda/linter/src/lib/FaultAttrs.ts b/ets2panda/linter/src/lib/FaultAttrs.ts index a549c0e7019983d350b8e6261745ced0d09243c4..7da7c381b92f17ee78b386c863ca6f09c7e8f6c6 100644 --- a/ets2panda/linter/src/lib/FaultAttrs.ts +++ b/ets2panda/linter/src/lib/FaultAttrs.ts @@ -49,6 +49,7 @@ faultsAttrs[FaultID.GenericCallNoTypeArgs] = new FaultAttributes(34); faultsAttrs[FaultID.RegularExpressionLiteral] = new FaultAttributes(37); faultsAttrs[FaultID.ObjectLiteralNoContextType] = new FaultAttributes(38); faultsAttrs[FaultID.ObjectTypeLiteral] = new FaultAttributes(40); +faultsAttrs[FaultID.ForbiddenKeyword] = new FaultAttributes(42); faultsAttrs[FaultID.ArrayLiteralNoContextType] = new FaultAttributes(43); faultsAttrs[FaultID.FunctionExpression] = new FaultAttributes(46); faultsAttrs[FaultID.ClassExpression] = new FaultAttributes(50); diff --git a/ets2panda/linter/src/lib/FaultDesc.ts b/ets2panda/linter/src/lib/FaultDesc.ts index 5663736e47714d263d5af4958bf7ea8a90bcba0f..57299d9601ce79b54335b1ef430ba3094ec65524 100644 --- a/ets2panda/linter/src/lib/FaultDesc.ts +++ b/ets2panda/linter/src/lib/FaultDesc.ts @@ -50,6 +50,7 @@ faultDesc[FaultID.DestructuringDeclaration] = 'Destructuring variable declaratio faultDesc[FaultID.VarDeclaration] = '"var" declarations'; faultDesc[FaultID.CatchWithUnsupportedType] = '"catch" clause with unsupported exception type'; faultDesc[FaultID.DeleteOperator] = '"delete" operations'; +faultDesc[FaultID.ForbiddenKeyword] = 'forbiden keyword used'; faultDesc[FaultID.DeclWithDuplicateName] = 'Declarations with duplicate name'; faultDesc[FaultID.UnaryArithmNotNumber] = 'Unary arithmetics with not-numeric values'; faultDesc[FaultID.ConstructorType] = 'Constructor type'; diff --git a/ets2panda/linter/src/lib/Problems.ts b/ets2panda/linter/src/lib/Problems.ts index 55e2c3d20faaf6c5d516bb1e5739cbc9be394c9f..80db3733c8d7f3486f457d511a9f42b9e36335ce 100644 --- a/ets2panda/linter/src/lib/Problems.ts +++ b/ets2panda/linter/src/lib/Problems.ts @@ -64,6 +64,7 @@ export enum FaultID { NonDeclarationInNamespace, GeneratorFunction, FunctionContainsThis, + ForbiddenKeyword, PropertyAccessByIndex, JsxElement, EnumMemberNonConstInit, diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index cc227158ea039ecc43d91dfb6c052fe07a7f7137..a7948568b48087c36ed0cd2b5a0dba8ae69630f9 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -149,7 +149,7 @@ import { ENTRY_USE_SHARED_STORAGE } from './utils/consts/ArkuiConstants'; import { arkuiImportList } from './utils/consts/ArkuiImportList'; -import type { IdentifierAndArguments, ForbidenAPICheckResult } from './utils/consts/InteropAPI'; +import type { IdentifierAndArguments, ForbiddenAPICheckResult } from './utils/consts/InteropAPI'; import { NONE, OBJECT_LITERAL, @@ -230,6 +230,7 @@ import { cookBookMsg } from './CookBookMsg'; import { getCommonApiInfoMap } from './utils/functions/CommonApiInfo'; import { arkuiDecoratorSet } from './utils/consts/ArkuiDecorator'; import { ABILITY_LIFECYCLE, ABILITY_LIFECYCLE_CALLBACK } from './utils/consts/LifecycleMonitor'; +import { FORBIDDEN_KEYWORDS_MAP } from './utils/consts/ForbiddenKeywords'; export class TypeScriptLinter extends BaseTypeScriptLinter { supportedStdCallApiChecker: SupportedStdCallApiChecker; @@ -4769,14 +4770,10 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.reportThisKeywordsInScope(classStaticBlockDecl.body); } - private handleIdentifier(node: ts.Node): void { - if (!ts.isIdentifier(node)) { - return; - } - this.checkCollectionsSymbol(node); - this.handleInterfaceImport(node); - this.checkAsonSymbol(node); - const tsIdentifier = node; + private handleIdentifier(tsIdentifier: ts.Identifier): void { + this.checkCollectionsSymbol(tsIdentifier); + this.handleInterfaceImport(tsIdentifier); + this.checkAsonSymbol(tsIdentifier); this.handleTsInterop(tsIdentifier, () => { const parent = tsIdentifier.parent; if (ts.isImportSpecifier(parent)) { @@ -4786,6 +4783,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.checkUsageOfTsTypes(type, tsIdentifier); }); + this.handleForbiddenKeywords(tsIdentifier); + const tsIdentSym = this.tsUtils.trueSymbolAtLocation(tsIdentifier); if (!tsIdentSym) { return; @@ -4793,8 +4792,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { const isNewArkTS = this.options.arkts2; if (isNewArkTS) { - this.checkWorkerSymbol(tsIdentSym, node); - this.checkConcurrencySymbol(tsIdentSym, node); + this.checkWorkerSymbol(tsIdentSym, tsIdentifier); + this.checkConcurrencySymbol(tsIdentSym, tsIdentifier); } const isGlobalThis = tsIdentifier.text === 'globalThis'; @@ -4812,9 +4811,52 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } if (isNewArkTS && this.tsTypeChecker.isArgumentsSymbol(tsIdentSym)) { - this.incrementCounters(node, FaultID.ArgumentsObject); + this.incrementCounters(tsIdentifier, FaultID.ArgumentsObject); } - this.checkInvalidNamespaceUsage(node); + this.checkInvalidNamespaceUsage(tsIdentifier); + } + + private handleForbiddenKeywords(ident: ts.Identifier): void { + if (!this.options.arkts2) { + return; + } + + const { text, parent } = ident; + const keywordInfos = FORBIDDEN_KEYWORDS_MAP.get(text); + if (!keywordInfos) { + return; + } + + const declaration = this.tsUtils.getDeclarationNode(ident); + if (!declaration) { + return; + } + + const parentDecl = declaration.parent; + + let replacementText: undefined | string; + for (const info of keywordInfos) { + const { replacement, sdkFile, parentType } = info; + if (!declaration.getSourceFile().fileName.includes(sdkFile)) { + continue; + } + + if (ts.isClassDeclaration(parentDecl) || ts.isInterfaceDeclaration(parentDecl)) { + if (!parentDecl.name) { + continue; + } + if (parentDecl.name.text !== parentType) { + continue; + } + replacementText = replacement; + } + } + + if (!replacementText) { + return; + } + + this.incrementCounters(ident, FaultID.ForbiddenKeyword, this.autofixer?.replaceNode(ident, replacementText)); } private handlePropertyDescriptorInScenarios(node: ts.Node): void { @@ -9687,16 +9729,16 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private static containsForbiddenAPI( node: ts.FunctionDeclaration | ts.MethodDeclaration | ts.FunctionExpression - ): ForbidenAPICheckResult { + ): ForbiddenAPICheckResult { if (!node.body) { return NONE; } return TypeScriptLinter.isForbiddenUsed(node.body); } - private static isForbiddenUsed(currentNode: ts.Node): ForbidenAPICheckResult { + private static isForbiddenUsed(currentNode: ts.Node): ForbiddenAPICheckResult { if (!ts.isCallExpression(currentNode)) { - let found: ForbidenAPICheckResult = NONE; + let found: ForbiddenAPICheckResult = NONE; ts.forEachChild(currentNode, (child) => { if (found === NONE) { found = TypeScriptLinter.isForbiddenUsed(child); diff --git a/ets2panda/linter/src/lib/utils/consts/ForbiddenKeywords.ts b/ets2panda/linter/src/lib/utils/consts/ForbiddenKeywords.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5f0a270f90bf1c452fff86cb6479299bd956d43 --- /dev/null +++ b/ets2panda/linter/src/lib/utils/consts/ForbiddenKeywords.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +type ForbiddenKeywordInfo = { + replacement: string; + parentType: string; + sdkFile: string; +}; + +type Keyword = string; + +export const FORBIDDEN_KEYWORDS_MAP: Map = new Map(); + +// abstact +FORBIDDEN_KEYWORDS_MAP.set('abstract', [ + { + replacement: 'textAbstract', + parentType: 'PlainText', + sdkFile: '@ohos.data.unifiedDataChannel' + }, + { + replacement: 'textAbstract', + parentType: 'PlainText', + sdkFile: '@ohos.data.uniformDataStruct' + } +]); diff --git a/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts b/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts index 6d4e230d392679d3c8957979217b92d8b85130ea..d4a51caad9fe10f6e879411e38d4d2c56cb4f9e5 100644 --- a/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts +++ b/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts @@ -65,7 +65,7 @@ export const USE_STATIC = '\'use static\''; export const OBJECT_LITERAL = 'Object'; export const REFLECT_LITERAL = 'Reflect'; export const NONE = 'none'; -export type ForbidenAPICheckResult = 'Object' | 'Reflect' | 'none'; +export type ForbiddenAPICheckResult = 'Object' | 'Reflect' | 'none'; export const GET_PROPERTY = 'getProperty'; export const SET_PROPERTY = 'setProperty'; export const TO_NUMBER = 'toNumber'; diff --git a/ets2panda/linter/test/forbidden_keywords/abstract.ets b/ets2panda/linter/test/forbidden_keywords/abstract.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d7ebf26927c9c7b7ced4f79894252d606053779 --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/abstract.ets @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { unifiedDataChannel } from './sdk/@ohos.data.unifiedDataChannel'; +import { uniformDataStruct } from './sdk/@ohos.data.uniformDataStruct'; + + +let plainText = new unifiedDataChannel.PlainText() +plainText.abstract = "test Value" + +let plainText2 = new uniformDataStruct.PlainText() +plainText2.abstract = "test Value" diff --git a/ets2panda/linter/test/forbidden_keywords/abstract.ets.args.json b/ets2panda/linter/test/forbidden_keywords/abstract.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..6958168fef2a70000342107f7d5f2b5805c14fae --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/abstract.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/forbidden_keywords/abstract.ets.arkts2.json b/ets2panda/linter/test/forbidden_keywords/abstract.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..765a24607461c092044e4096142e524a52aa1640 --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/abstract.ets.arkts2.json @@ -0,0 +1,38 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 21, + "column": 11, + "endLine": 21, + "endColumn": 19, + "problem": "ForbiddenKeyword", + "suggest": "", + "rule": "Avoid using reserved keyword (sdk-api-keywords-avoid)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 12, + "endLine": 24, + "endColumn": 20, + "problem": "ForbiddenKeyword", + "suggest": "", + "rule": "Avoid using reserved keyword (sdk-api-keywords-avoid)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/forbidden_keywords/abstract.ets.autofix.json b/ets2panda/linter/test/forbidden_keywords/abstract.ets.autofix.json new file mode 100644 index 0000000000000000000000000000000000000000..d4488393770a47f6ca70721b8a786f26fc5d9ef2 --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/abstract.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": 21, + "column": 11, + "endLine": 21, + "endColumn": 19, + "problem": "ForbiddenKeyword", + "autofix": [ + { + "start": 814, + "end": 822, + "replacementText": "textAbstract", + "line": 21, + "column": 11, + "endLine": 21, + "endColumn": 19 + } + ], + "suggest": "", + "rule": "Avoid using reserved keyword (sdk-api-keywords-avoid)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 12, + "endLine": 24, + "endColumn": 20, + "problem": "ForbiddenKeyword", + "autofix": [ + { + "start": 901, + "end": 909, + "replacementText": "textAbstract", + "line": 24, + "column": 12, + "endLine": 24, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "Avoid using reserved keyword (sdk-api-keywords-avoid)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/forbidden_keywords/abstract.ets.json b/ets2panda/linter/test/forbidden_keywords/abstract.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/abstract.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/forbidden_keywords/abstract.ets.migrate.ets b/ets2panda/linter/test/forbidden_keywords/abstract.ets.migrate.ets new file mode 100644 index 0000000000000000000000000000000000000000..177062c9bc5e3fbb3688452868f46dfb043e3f16 --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/abstract.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. + */ + +import { unifiedDataChannel } from './sdk/@ohos.data.unifiedDataChannel'; +import { uniformDataStruct } from './sdk/@ohos.data.uniformDataStruct'; + + +let plainText = new unifiedDataChannel.PlainText() +plainText.textAbstract = "test Value" + +let plainText2 = new uniformDataStruct.PlainText() +plainText2.textAbstract = "test Value" diff --git a/ets2panda/linter/test/forbidden_keywords/abstract.ets.migrate.json b/ets2panda/linter/test/forbidden_keywords/abstract.ets.migrate.json new file mode 100644 index 0000000000000000000000000000000000000000..ca88f857e960b437dcf767c0ac40be998c8f1236 --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/abstract.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/forbidden_keywords/sdk/@ohos.data.unifiedDataChannel.d.ts b/ets2panda/linter/test/forbidden_keywords/sdk/@ohos.data.unifiedDataChannel.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6637a9e8aa452a3f3b9fc85ce95b574c97bdcf0 --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/sdk/@ohos.data.unifiedDataChannel.d.ts @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export namespace unifiedDataChannel { + class PlainText { + abstract?: string; + } +} diff --git a/ets2panda/linter/test/forbidden_keywords/sdk/@ohos.data.uniformDataStruct.d.ts b/ets2panda/linter/test/forbidden_keywords/sdk/@ohos.data.uniformDataStruct.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..763913e0bacb287383d820fc10ec67d0d144bd7b --- /dev/null +++ b/ets2panda/linter/test/forbidden_keywords/sdk/@ohos.data.uniformDataStruct.d.ts @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export namespace uniformDataStruct { + class PlainText { + abstract?: string; + } +}