diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index a99f72046c0ea148319576a5c3979911e5a9ed05..cdf6aed7243da31ab7973d0fd50600bcf3665b4a 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -250,8 +250,7 @@ cookBookTag[206] = '"debugger" is not supported (arkts-no-debugger)'; cookBookTag[207] = 'Special arguments object inside functions are not supported (arkts-no-arguments-obj)'; cookBookTag[208] = 'Tagged templates are not supported (arkts-no-tagged-templates)'; cookBookTag[209] = 'The index expression must be of a numeric type (arkts-array-index-expr-type)'; -cookBookTag[210] = - 'The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)'; +cookBookTag[210] = 'The switch expression type must be of type number, string or enum (arkts-switch-expr)'; cookBookTag[211] = 'No two case constant expressions have identical values.(arkts-case-expr)'; cookBookTag[212] = 'The index expression must be zero or positive value.(arkts-array-index-negative)'; cookBookTag[213] = 'Class cannot have static codeblocks. (arkts-class-lazy-import)'; diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 9a0f958dd60d3038f55a62e81d0ad1584875003d..d169eed5e9a65454665b29d04402427f851ea25d 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -7241,7 +7241,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private validateSwitchExpression(switchStatement: ts.SwitchStatement): void { const expr = switchStatement.expression; const nodeType = this.tsTypeChecker.getTypeAtLocation(expr); - const { isLiteralInitialized, isFloatLiteral, hasExplicitTypeAnnotation } = this.getDeclarationInfo(expr); + const { isLiteralInitialized, hasExplicitTypeAnnotation } = this.getDeclarationInfo(expr); const isUnionType = (nodeType.flags & ts.TypeFlags.Union) !== 0; @@ -7250,8 +7250,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return Boolean( t.flags & ts.TypeFlags.StringLike || typeText === 'String' || + typeText === 'number' || t.flags & ts.TypeFlags.NumberLike && (/^\d+$/).test(typeText) || - isLiteralInitialized && !hasExplicitTypeAnnotation && !isFloatLiteral || + isLiteralInitialized && !hasExplicitTypeAnnotation || t.flags & ts.TypeFlags.EnumLike ); }; @@ -7270,14 +7271,13 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private getDeclarationInfo(expression: ts.Expression): { isLiteralInitialized: boolean; - isFloatLiteral: boolean; hasExplicitTypeAnnotation: boolean; } { const symbol = this.tsTypeChecker.getSymbolAtLocation(expression); const declaration = symbol?.valueDeclaration; if (!declaration || !ts.isVariableDeclaration(declaration)) { - return { isLiteralInitialized: false, isFloatLiteral: false, hasExplicitTypeAnnotation: false }; + return { isLiteralInitialized: false, hasExplicitTypeAnnotation: false }; } const hasExplicitTypeAnnotation = !!declaration.type; @@ -7285,30 +7285,20 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return { isLiteralInitialized: initializerInfo.isLiteralInitialized, - isFloatLiteral: initializerInfo.isFloatLiteral, hasExplicitTypeAnnotation }; } private static getInitializerInfo(initializer?: ts.Expression): { isLiteralInitialized: boolean; - isFloatLiteral: boolean; } { if (!initializer) { - return { isLiteralInitialized: false, isFloatLiteral: false }; + return { isLiteralInitialized: false }; } const isLiteralInitialized = ts.isNumericLiteral(initializer) || ts.isStringLiteral(initializer); - let isFloatLiteral = false; - if (ts.isNumericLiteral(initializer)) { - const literalText = initializer.getText(); - if (!(/^0[xX]/).test(literalText)) { - isFloatLiteral = (/\.|e[-+]|\dE[-+]/i).test(literalText); - } - } - - return { isLiteralInitialized, isFloatLiteral }; + return { isLiteralInitialized }; } private findDuplicateCases(switchStatement: ts.SwitchStatement): ts.CaseClause[] { @@ -10193,27 +10183,16 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const symbolToUse = defaultSymbol || symbol; if (symbolToUse) { - this.tryAutoFixInterOpImportJs(importDecl, importClause, symbolToUse, defaultSymbol); + this.tryAutoFixInterOpImportJs(importDecl, symbolToUse); } } - private tryAutoFixInterOpImportJs( - importDecl: ts.ImportDeclaration, - importClause: ts.ImportClause, - symbolToUse: ts.Symbol, - defaultSymbol?: ts.Symbol - ): void { + private tryAutoFixInterOpImportJs(importDecl: ts.ImportDeclaration, symbolToUse: ts.Symbol): void { const declaration = symbolToUse.declarations?.[0]; if (declaration) { const sourceFile = declaration.getSourceFile(); if (sourceFile.fileName.endsWith(EXTNAME_JS)) { - const autofix = this.autofixer?.fixInterOpImportJs( - importDecl, - importClause, - TsUtils.removeOrReplaceQuotes(importDecl.moduleSpecifier.getText(this.sourceFile), false), - defaultSymbol - ); - this.incrementCounters(importDecl, FaultID.InterOpImportJs, autofix); + this.incrementCounters(importDecl, FaultID.InterOpImportJs); } } } diff --git a/ets2panda/linter/src/lib/autofixes/AutofixTitles.ts b/ets2panda/linter/src/lib/autofixes/AutofixTitles.ts index 375831c9a731489a8201edb6e69f1b31f35ffb47..dd3096cc61e605dc85be56b3389eefe6687626a4 100644 --- a/ets2panda/linter/src/lib/autofixes/AutofixTitles.ts +++ b/ets2panda/linter/src/lib/autofixes/AutofixTitles.ts @@ -56,7 +56,6 @@ export const cookBookRefToFixTitle: Map = new Map([ [282, '"@StorageProp" transform to "@StoragePropRef"'], [283, '"@LocalStorageProp" transform to "@LocalStoragePropRef"'], [300, 'Replace calling method of the TS-like `Function` type'], - [330, 'Convert import named objects from JS to ESValue'], [332, 'Using the ESValue interface to access properties'], [334, 'Call typeOf function'], [335, 'Call toNumber function to convert'], diff --git a/ets2panda/linter/src/lib/autofixes/Autofixer.ts b/ets2panda/linter/src/lib/autofixes/Autofixer.ts index 6c0a96ff547a2811936705f49ccca19ffc4b3383..9ab1be7f416e5c06ab75502d0ad3ed99b0bfe97e 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -47,7 +47,6 @@ import { import { ES_VALUE } from '../utils/consts/ESObject'; import type { IncrementDecrementNodeInfo } from '../utils/consts/InteropAPI'; import { - LOAD, GET_PROPERTY, SET_PROPERTY, ARE_EQUAL, @@ -4167,68 +4166,6 @@ export class Autofixer { return [{ start: pos, end: pos, replacementText: text }]; } - private static createVariableForInteropImport( - interopProperty: string, - symbolName: string, - propertyName: string - ): ts.VariableStatement { - const newVarDecl = ts.factory.createVariableStatement( - undefined, - ts.factory.createVariableDeclarationList( - [ - ts.factory.createVariableDeclaration( - ts.factory.createIdentifier(symbolName), - undefined, - undefined, - this.createVariableInitialForInteropImport(propertyName, interopProperty) - ) - ], - ts.NodeFlags.Let - ) - ); - return newVarDecl; - } - - private static createVariableInitialForInteropImport(propertyName: string, interopProperty: string): ts.Expression { - const initializer = ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression( - ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression( - ts.factory.createIdentifier(ES_VALUE), - ts.factory.createIdentifier(LOAD) - ), - undefined, - [ts.factory.createStringLiteral(interopProperty)] - ), - ts.factory.createIdentifier(GET_PROPERTY) - ), - undefined, - [ts.factory.createStringLiteral(propertyName)] - ); - return initializer; - } - - private static getOriginalNameAtSymbol(symbolName: string, symbol?: ts.Symbol): string { - if (symbol) { - const originalDeclaration = symbol.declarations?.[0]; - let originalName = ''; - if (originalDeclaration) { - const isReturnNameOnSomeCase = - ts.isFunctionDeclaration(originalDeclaration) || - ts.isClassDeclaration(originalDeclaration) || - ts.isInterfaceDeclaration(originalDeclaration) || - ts.isEnumDeclaration(originalDeclaration); - if (isReturnNameOnSomeCase) { - originalName = originalDeclaration.name?.text || symbolName; - } else if (ts.isVariableDeclaration(originalDeclaration)) { - originalName = originalDeclaration.name.getText(); - } - } - return originalName; - } - return ''; - } - private fixInterOpImportJsProcessNode(node: ts.Node): string | undefined { if (ts.isIdentifier(node)) { return node.text; @@ -4277,128 +4214,6 @@ export class Autofixer { return undefined; } - fixInterOpImportJs( - importDecl: ts.ImportDeclaration, - importClause: ts.ImportClause, - moduleSpecifier: string, - defaultSymbol?: ts.Symbol - ): Autofix[] | undefined { - if (!Autofixer.shouldTransformImport(moduleSpecifier)) { - return undefined; - } - - let statements: string[] = []; - if (importClause.name) { - const symbolName = importClause.name.text; - const originalName = Autofixer.getOriginalNameAtSymbol(symbolName, defaultSymbol); - statements = this.constructAndSaveimportDecl2Arrays( - importDecl, - moduleSpecifier, - symbolName, - originalName, - statements - ); - } - const namedBindings = importClause.namedBindings; - if (namedBindings) { - statements = this.getStatementForInterOpImportJsOnNamedBindings( - namedBindings, - importDecl, - moduleSpecifier, - statements - ); - } - - return [Autofixer.createImportDeclarationFix(importDecl), this.createInsertStatementsFix(importDecl, statements)]; - } - - private static createImportDeclarationFix(importDecl: ts.ImportDeclaration): Autofix { - return { - start: importDecl.getStart(), - end: importDecl.getEnd(), - replacementText: '' - }; - } - - private createInsertStatementsFix(importDecl: ts.ImportDeclaration, statements: string[]): Autofix { - const joinedStatements = statements.join(this.getNewLine()); - const replacementText = this.detectNeedsLeadingNewline(importDecl) ? - this.getNewLine() + joinedStatements : - joinedStatements; - - return { - start: importDecl.getEnd(), - end: importDecl.getEnd(), - replacementText - }; - } - - private static shouldTransformImport(moduleSpecifier: string): boolean { - return moduleSpecifier.endsWith('.js') || moduleSpecifier.startsWith('./') || moduleSpecifier.startsWith('../'); - } - - private detectNeedsLeadingNewline(importDecl: ts.ImportDeclaration): boolean { - const prevToken = ts.getLeadingCommentRanges(this.sourceFile.text, importDecl.getFullStart())?.[0]; - return !!prevToken && !(/^\s*$/).test(this.sourceFile.text.slice(prevToken.end, importDecl.getStart())); - } - - private getStatementForInterOpImportJsOnNamedBindings( - namedBindings: ts.NamedImportBindings, - importDecl: ts.ImportDeclaration, - moduleSpecifier: string, - statements: string[] - ): string[] { - if (ts.isNamespaceImport(namedBindings)) { - const symbolName = namedBindings.name.text; - statements = this.constructAndSaveimportDecl2Arrays( - importDecl, - moduleSpecifier, - symbolName, - symbolName, - statements - ); - } - if (ts.isNamedImports(namedBindings)) { - namedBindings.elements.map((element) => { - const symbolName = element.name.text; - const originalName = element.propertyName ? element.propertyName.text : symbolName; - statements = this.constructAndSaveimportDecl2Arrays( - importDecl, - moduleSpecifier, - symbolName, - originalName, - statements - ); - return statements; - }); - } - return statements; - } - - private constructAndSaveimportDecl2Arrays( - importDecl: ts.ImportDeclaration, - moduleSpecifier: string, - symbolName: string, - originalName: string | undefined, - statements: string[] - ): string[] { - const propertyName = originalName || symbolName; - const newVarDecl = Autofixer.createVariableForInteropImport(moduleSpecifier, symbolName, propertyName); - const text = this.printer.printNode(ts.EmitHint.Unspecified, newVarDecl, importDecl.getSourceFile()); - statements.push(TsUtils.removeOrReplaceQuotes(text, true)); - return statements; - } - - private getLastImportEnd(): number { - let lastImportEnd = 0; - this.sourceFile.statements.forEach((statement) => { - if (ts.isImportDeclaration(statement)) { - lastImportEnd = statement.getEnd(); - } - }); - return lastImportEnd; - } - fixInteropPropertyAccessExpression(express: ts.PropertyAccessExpression): Autofix[] | undefined { let text: string = ''; const statements = ts.factory.createCallExpression( diff --git a/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts b/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts index afd7fcc08737fc52d29b37f99fa38852b6417450..6d4e230d392679d3c8957979217b92d8b85130ea 100644 --- a/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts +++ b/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts @@ -66,7 +66,6 @@ export const OBJECT_LITERAL = 'Object'; export const REFLECT_LITERAL = 'Reflect'; export const NONE = 'none'; export type ForbidenAPICheckResult = 'Object' | 'Reflect' | 'none'; -export const LOAD = 'load'; export const GET_PROPERTY = 'getProperty'; export const SET_PROPERTY = 'setProperty'; export const TO_NUMBER = 'toNumber'; diff --git a/ets2panda/linter/test/deprecatedapi/UIContext.ets.json.args.json b/ets2panda/linter/test/deprecatedapi/UIContext.ets.json.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/UIContext.ets.json.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..1b80aa9e7367c4d206bb53f8fc43c77fc24045d7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } + } \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..31ebba8ac654c7c9b43334f1abcd2eefe30ddde3 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/chip_group_api.ets.arkts2.json @@ -0,0 +1,68 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 36, + "column": 3, + "endLine": 36, + "endColumn": 6, + "problem": "LimitedReturnTypeInference", + "suggest": "", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 5, + "endLine": 20, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 16, + "endLine": 35, + "endColumn": 27, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"IconOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 20, + "endLine": 39, + "endColumn": 31, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"IconOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common.ets.args.json b/ets2panda/linter/test/deprecatedapi/common.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/common.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/common.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..6d1ea8e03f14e1d015f8df6083e3fcd696729c65 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/common.ets.arkts2.json @@ -0,0 +1,438 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 20, + "column": 21, + "endLine": 20, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 21, + "endLine": 23, + "endColumn": 27, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 22, + "endLine": 28, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 28, + "endLine": 29, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 24, + "endLine": 30, + "endColumn": 25, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 29, + "endLine": 31, + "endColumn": 30, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 26, + "endLine": 38, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 36, + "endLine": 38, + "endColumn": 39, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 13, + "endLine": 41, + "endColumn": 29, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 13, + "endLine": 41, + "endColumn": 26, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 13, + "endLine": 42, + "endColumn": 29, + "problem": "PropertyAccessByIndex", + "suggest": "", + "rule": "Indexed access is not supported for fields (arkts-no-props-by-index)", + "severity": "ERROR" + }, + { + "line": 42, + "column": 13, + "endLine": 42, + "endColumn": 26, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 13, + "endLine": 47, + "endColumn": 26, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 13, + "endLine": 48, + "endColumn": 26, + "problem": "NoTsLikeSmartType", + "suggest": "", + "rule": "Smart type differences (arkts-no-ts-like-smart-type)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 21, + "endLine": 58, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 61, + "column": 20, + "endLine": 61, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 8, + "endLine": 66, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 8, + "endLine": 67, + "endColumn": 11, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 7, + "endLine": 68, + "endColumn": 10, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 7, + "endLine": 69, + "endColumn": 10, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 7, + "endLine": 70, + "endColumn": 10, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 7, + "endLine": 71, + "endColumn": 10, + "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": 20, + "column": 5, + "endLine": 20, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 7, + "endLine": 21, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 9, + "endLine": 22, + "endColumn": 14, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Image\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 21, + "endLine": 23, + "endColumn": 27, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Circle\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 9, + "endLine": 25, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 19, + "endLine": 27, + "endColumn": 33, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TransitionType\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 26, + "endLine": 34, + "endColumn": 33, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Context\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 36, + "endLine": 34, + "endColumn": 46, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"getContext\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 3, + "endLine": 38, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 27, + "endLine": 39, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TouchEvent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 27, + "endLine": 45, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ClickEvent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 26, + "endLine": 51, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"MouseEvent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 66, + "column": 1, + "endLine": 66, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"px2lpx\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 1, + "endLine": 67, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"lpx2px\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 1, + "endLine": 68, + "endColumn": 6, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"px2fp\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 1, + "endLine": 69, + "endColumn": 6, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"fp2px\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 70, + "column": 1, + "endLine": 70, + "endColumn": 6, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"px2vp\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 71, + "column": 1, + "endLine": 71, + "endColumn": 6, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"vp2px\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.args.json b/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..ab200aca98a0c25e5488380a88ae795e2ec6c751 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/componentSnapshot.ets.arkts2.json @@ -0,0 +1,158 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 25, + "column": 19, + "endLine": 25, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 16, + "endLine": 26, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 17, + "endLine": 27, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 12, + "endLine": 30, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 19, + "endLine": 41, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 4, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Builder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Flex\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 20, + "endLine": 28, + "endColumn": 29, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 5, + "endLine": 34, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 7, + "endLine": 35, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 17, + "endLine": 45, + "endColumn": 32, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"HorizontalAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/curves.ets.args.json b/ets2panda/linter/test/deprecatedapi/curves.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/curves.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SizeType.ets.json b/ets2panda/linter/test/deprecatedapi/curves.ets.arkts2.json old mode 100755 new mode 100644 similarity index 100% rename from ets2panda/linter/test/deprecatedapi/SizeType.ets.json rename to ets2panda/linter/test/deprecatedapi/curves.ets.arkts2.json diff --git a/ets2panda/linter/test/deprecatedapi/date_picker.ets.args.json b/ets2panda/linter/test/deprecatedapi/date_picker.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/date_picker.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/date_picker.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/date_picker.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..3c31119d9f80feda224ca75460f2c13228f98f0d --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/date_picker.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 24, + "column": 17, + "endLine": 24, + "endColumn": 19, + "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": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 11, + "endLine": 26, + "endColumn": 27, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DatePickerDialog\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 7, + "endLine": 32, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DatePicker\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.args.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..ce2955ca55158612f1e3169e24143b3a5dbe5d9f --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_common_utils.ets.arkts2.json @@ -0,0 +1,48 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 5, + "endLine": 27, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.args.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..33af06e3141b27c854edfb247704eea48773abab --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_prompt_action.ets.arkts2.json @@ -0,0 +1,118 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 25, + "column": 17, + "endLine": 25, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 9, + "endLine": 48, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 14, + "endLine": 48, + "endColumn": 18, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 9, + "endLine": 69, + "endColumn": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 14, + "endLine": 69, + "endColumn": 18, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 36, + "endLine": 72, + "endColumn": 37, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 76, + "column": 44, + "endLine": 76, + "endColumn": 63, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DismissDialogAction\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 5, + "endLine": 82, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.args.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..1af038e5b70c2a49a22760284383fc43921a23fa --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_time_picker.ets.arkts2.json @@ -0,0 +1,68 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TimePickerDialog\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TimePickerDialog\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 5, + "endLine": 26, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/dragController.ets.args.json b/ets2panda/linter/test/deprecatedapi/dragController.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/dragController.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/dragController.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/dragController.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..353facd04ad8d3e162743403e88474a6e2766a0b --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/dragController.ets.arkts2.json @@ -0,0 +1,308 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 29, + "column": 19, + "endLine": 29, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 12, + "endLine": 31, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 13, + "endLine": 32, + "endColumn": 16, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 19, + "endLine": 40, + "endColumn": 21, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 12, + "endLine": 43, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 13, + "endLine": 44, + "endColumn": 15, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 33, + "endLine": 48, + "endColumn": 46, + "problem": "LimitedVoidTypeFromSdk", + "suggest": "", + "rule": "Type \"void\" has no instances.(sdk-limited-void-type)", + "severity": "ERROR" + }, + { + "line": 53, + "column": 17, + "endLine": 53, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 26, + "endLine": 60, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 27, + "endLine": 67, + "endColumn": 30, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 32, + "endLine": 67, + "endColumn": 35, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 2, + "endLine": 20, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 4, + "endLine": 22, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 4, + "endLine": 24, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Builder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 5, + "endLine": 26, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 7, + "endLine": 27, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 20, + "endLine": 28, + "endColumn": 25, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Color\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 22, + "endLine": 33, + "endColumn": 27, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Color\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 4, + "endLine": 36, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Builder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 5, + "endLine": 38, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 7, + "endLine": 39, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 20, + "endLine": 41, + "endColumn": 25, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Color\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 22, + "endLine": 45, + "endColumn": 27, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Color\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 33, + "endLine": 48, + "endColumn": 46, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"CustomBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 48, + "column": 49, + "endLine": 48, + "endColumn": 61, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DragItemInfo\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 5, + "endLine": 51, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 7, + "endLine": 52, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 27, + "endLine": 57, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TouchEvent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/enums.ets.args.json b/ets2panda/linter/test/deprecatedapi/enums.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/enums.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/enums.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/enums.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..7be47bbee3b08773bf7e42d846b2c7547e1b8afe --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/enums.ets.arkts2.json @@ -0,0 +1,308 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT 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": 28, + "endLine": 19, + "endColumn": 36, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 28, + "endLine": 20, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 31, + "endLine": 20, + "endColumn": 32, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 34, + "endLine": 20, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 37, + "endLine": 20, + "endColumn": 38, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 40, + "endLine": 20, + "endColumn": 41, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 43, + "endLine": 20, + "endColumn": 44, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 46, + "endLine": 20, + "endColumn": 47, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 49, + "endLine": 20, + "endColumn": 50, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 52, + "endLine": 20, + "endColumn": 53, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 55, + "endLine": 20, + "endColumn": 56, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 24, + "endLine": 37, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 35, + "endLine": 37, + "endColumn": 37, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 24, + "endLine": 43, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 35, + "endLine": 43, + "endColumn": 37, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 13, + "endLine": 19, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroller\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 28, + "endLine": 19, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroller\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Stack\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 27, + "endLine": 23, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Alignment\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 7, + "endLine": 24, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Scroll\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 9, + "endLine": 25, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 11, + "endLine": 26, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 13, + "endLine": 27, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 7, + "endLine": 32, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 36, + "endLine": 35, + "endColumn": 40, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Edge\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 7, + "endLine": 38, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 36, + "endLine": 41, + "endColumn": 40, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Edge\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/image_animator.ets.args.json b/ets2panda/linter/test/deprecatedapi/image_animator.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/image_animator.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/image_animator.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/image_animator.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..5dba08427fc25db0e2685528623ab4dd5c785369 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/image_animator.ets.arkts2.json @@ -0,0 +1,78 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 21, + "column": 21, + "endLine": 21, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 20, + "endLine": 23, + "endColumn": 21, + "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": 21, + "column": 5, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 7, + "endLine": 22, + "endColumn": 20, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ImageAnimator\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/inspector.ets.args.json b/ets2panda/linter/test/deprecatedapi/inspector.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/inspector.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/SizeType.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/inspector.ets.arkts2.json old mode 100755 new mode 100644 similarity index 63% rename from ets2panda/linter/test/deprecatedapi/SizeType.ets.arkts2.json rename to ets2panda/linter/test/deprecatedapi/inspector.ets.arkts2.json index b0bd84bb5e8299499e1d08466994c432fe8cbfb6..769f51d93cd1acce266b31204b3636d9e9ffc8da --- a/ets2panda/linter/test/deprecatedapi/SizeType.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/inspector.ets.arkts2.json @@ -15,30 +15,30 @@ ], "result": [ { - "line": 20, - "column": 31, - "endLine": 20, - "endColumn": 39, - "problem": "NoDeprecatedApi", + "line": 24, + "column": 22, + "endLine": 24, + "endColumn": 23, + "problem": "NumericSemantics", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 23, - "column": 21, - "endLine": 23, - "endColumn": 22, + "line": 26, + "column": 20, + "endLine": 26, + "endColumn": 23, "problem": "NumericSemantics", "suggest": "", "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 24, - "column": 66, - "endLine": 24, - "endColumn": 67, + "line": 27, + "column": 21, + "endLine": 27, + "endColumn": 24, "problem": "NumericSemantics", "suggest": "", "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", @@ -46,58 +46,58 @@ }, { "line": 28, - "column": 29, + "column": 30, "endLine": 28, - "endColumn": 37, - "problem": "NoDeprecatedApi", + "endColumn": 31, + "problem": "NumericSemantics", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { "line": 32, - "column": 29, + "column": 14, "endLine": 32, - "endColumn": 37, - "problem": "NoDeprecatedApi", + "endColumn": 17, + "problem": "NumericSemantics", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 36, - "column": 29, - "endLine": 36, - "endColumn": 37, - "problem": "NoDeprecatedApi", + "line": 32, + "column": 25, + "endLine": 32, + "endColumn": 28, + "problem": "NumericSemantics", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 40, - "column": 29, - "endLine": 40, - "endColumn": 37, - "problem": "NoDeprecatedApi", + "line": 32, + "column": 47, + "endLine": 32, + "endColumn": 49, + "problem": "NumericSemantics", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 43, - "column": 35, - "endLine": 43, - "endColumn": 36, + "line": 32, + "column": 56, + "endLine": 32, + "endColumn": 58, "problem": "NumericSemantics", "suggest": "", "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 17, + "line": 18, "column": 2, - "endLine": 17, + "endLine": 18, "endColumn": 7, "problem": "UIInterfaceImport", "suggest": "", @@ -105,9 +105,9 @@ "severity": "ERROR" }, { - "line": 18, + "line": 19, "column": 2, - "endLine": 18, + "endLine": 19, "endColumn": 11, "problem": "UIInterfaceImport", "suggest": "", @@ -115,19 +115,9 @@ "severity": "ERROR" }, { - "line": 20, - "column": 4, - "endLine": 20, - "endColumn": 9, - "problem": "UIInterfaceImport", - "suggest": "", - "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", - "severity": "ERROR" - }, - { - "line": 23, + "line": 22, "column": 5, - "endLine": 23, + "endLine": 22, "endColumn": 11, "problem": "UIInterfaceImport", "suggest": "", @@ -135,63 +125,63 @@ "severity": "ERROR" }, { - "line": 24, + "line": 23, "column": 7, - "endLine": 24, + "endLine": 23, "endColumn": 11, "problem": "UIInterfaceImport", "suggest": "", - "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "rule": "The ArkUI interface \"Flex\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, { - "line": 25, - "column": 7, - "endLine": 25, - "endColumn": 10, + "line": 23, + "column": 25, + "endLine": 23, + "endColumn": 38, "problem": "UIInterfaceImport", "suggest": "", - "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "rule": "The ArkUI interface \"FlexDirection\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, { - "line": 26, - "column": 9, - "endLine": 26, - "endColumn": 15, + "line": 23, + "column": 39, + "endLine": 23, + "endColumn": 45, "problem": "UIInterfaceImport", "suggest": "", - "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, { - "line": 30, - "column": 9, - "endLine": 30, - "endColumn": 15, + "line": 23, + "column": 59, + "endLine": 23, + "endColumn": 68, "problem": "UIInterfaceImport", "suggest": "", - "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "rule": "The ArkUI interface \"ItemAlign\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, { - "line": 34, + "line": 24, "column": 9, - "endLine": 34, - "endColumn": 15, + "endLine": 24, + "endColumn": 12, "problem": "UIInterfaceImport", "suggest": "", - "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, { - "line": 38, - "column": 9, - "endLine": 38, - "endColumn": 15, + "line": 25, + "column": 11, + "endLine": 25, + "endColumn": 16, "problem": "UIInterfaceImport", "suggest": "", - "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "rule": "The ArkUI interface \"Image\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.args.json b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..d1068b2c6c902dc7da3ae85965b941d3d3f0aeea --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/lazy_for_each.ets.arkts2.json @@ -0,0 +1,298 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 21, + "column": 12, + "endLine": 21, + "endColumn": 13, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 33, + "endLine": 25, + "endColumn": 38, + "problem": "ArrayIndexExprType", + "suggest": "", + "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 44, + "endLine": 29, + "endColumn": 45, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 11, + "endLine": 36, + "endColumn": 49, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 16, + "endLine": 37, + "endColumn": 17, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 34, + "endLine": 39, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 27, + "endLine": 82, + "endColumn": 32, + "problem": "ArrayIndexExprType", + "suggest": "", + "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", + "severity": "ERROR" + }, + { + "line": 86, + "column": 34, + "endLine": 86, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 92, + "column": 48, + "endLine": 92, + "endColumn": 49, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 102, + "column": 14, + "endLine": 102, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 102, + "column": 18, + "endLine": 102, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 102, + "column": 26, + "endLine": 102, + "endColumn": 28, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 108, + "column": 19, + "endLine": 108, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 112, + "column": 33, + "endLine": 112, + "endColumn": 35, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 28, + "endLine": 116, + "endColumn": 30, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 116, + "column": 39, + "endLine": 116, + "endColumn": 41, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 119, + "column": 19, + "endLine": 119, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 34, + "endLine": 16, + "endColumn": 45, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"IDataSource\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 22, + "endLine": 17, + "endColumn": 40, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DataChangeListener\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 40, + "endLine": 28, + "endColumn": 58, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DataChangeListener\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 42, + "endLine": 35, + "endColumn": 60, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"DataChangeListener\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 96, + "column": 2, + "endLine": 96, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 2, + "endLine": 97, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 108, + "column": 5, + "endLine": 108, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"List\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 109, + "column": 7, + "endLine": 109, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"LazyForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 110, + "column": 9, + "endLine": 110, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ListItem\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 111, + "column": 11, + "endLine": 111, + "endColumn": 14, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 112, + "column": 13, + "endLine": 112, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/measure.ets.args.json b/ets2panda/linter/test/deprecatedapi/measure.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/measure.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/measure.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/measure.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..a52ce66124292611d03e23134bd8d79db201d134 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/measure.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 13, + "endLine": 21, + "endColumn": 24, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"SizeOptions\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 4, + "endLine": 25, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 5, + "endLine": 31, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 7, + "endLine": 32, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 9, + "endLine": 33, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 9, + "endLine": 34, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/mediaquery.ets.args.json b/ets2panda/linter/test/deprecatedapi/mediaquery.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/mediaquery.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/mediaquery.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/mediaquery.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..da87e06462d7ba4ac3d6d827f41c71376652f0a7 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/mediaquery.ets.arkts2.json @@ -0,0 +1,128 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 47, + "column": 32, + "endLine": 47, + "endColumn": 34, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 2, + "endLine": 19, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 4, + "endLine": 21, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 4, + "endLine": 22, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 5, + "endLine": 46, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Flex\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 23, + "endLine": 46, + "endColumn": 36, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexDirection\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 37, + "endLine": 46, + "endColumn": 43, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 57, + "endLine": 46, + "endColumn": 66, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ItemAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 91, + "endLine": 46, + "endColumn": 100, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"FlexAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 7, + "endLine": 47, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navigation.ets.args.json b/ets2panda/linter/test/deprecatedapi/navigation.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navigation.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navigation.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/navigation.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..3fe72f3f5a600ecead4a4dc985397f74e927b46e --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/navigation.ets.arkts2.json @@ -0,0 +1,98 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 20, + "column": 21, + "endLine": 20, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 21, + "endLine": 26, + "endColumn": 23, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 20, + "endLine": 29, + "endColumn": 22, + "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": 20, + "column": 5, + "endLine": 20, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 7, + "endLine": 21, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 9, + "endLine": 22, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Navigation\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/refresh.ets.args.json b/ets2panda/linter/test/deprecatedapi/refresh.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/refresh.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/refresh.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/refresh.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..9a3dd460846c069c65f1b3e56256bb73acce6543 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/refresh.ets.arkts2.json @@ -0,0 +1,248 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 26, + "column": 29, + "endLine": 26, + "endColumn": 48, + "problem": "DoubleDollarBindingNotSupported", + "suggest": "", + "rule": "\"$$\" for bidirectional data binding is not supported (arkui-no-$$-bidirectional-data-binding)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 58, + "endLine": 26, + "endColumn": 59, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 25, + "endLine": 32, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 27, + "endLine": 33, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 25, + "endLine": 34, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 36, + "column": 31, + "endLine": 36, + "endColumn": 33, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 51, + "column": 22, + "endLine": 51, + "endColumn": 24, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 61, + "column": 12, + "endLine": 61, + "endColumn": 16, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 4, + "endLine": 19, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 4, + "endLine": 20, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 4, + "endLine": 21, + "endColumn": 9, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"State\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 5, + "endLine": 25, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 7, + "endLine": 26, + "endColumn": 14, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Refresh\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 9, + "endLine": 27, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"List\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 11, + "endLine": 28, + "endColumn": 18, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ForEach\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 13, + "endLine": 29, + "endColumn": 21, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ListItem\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 15, + "endLine": 30, + "endColumn": 19, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Text\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 28, + "endLine": 35, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 24, + "endLine": 46, + "endColumn": 37, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"ListItemAlign\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 47, + "column": 20, + "endLine": 47, + "endColumn": 28, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"BarState\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 38, + "endLine": 52, + "endColumn": 51, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"RefreshStatus\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/slider_api.ets.args.json b/ets2panda/linter/test/deprecatedapi/slider_api.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/slider_api.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/slider_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/slider_api.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..811b3fa6edb311680f99de72c56efc371290d6cc --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/slider_api.ets.arkts2.json @@ -0,0 +1,78 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 21, + "column": 21, + "endLine": 21, + "endColumn": 22, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 2, + "endLine": 18, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 7, + "endLine": 22, + "endColumn": 10, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 9, + "endLine": 23, + "endColumn": 15, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Slider\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/text_input.ets.args.json b/ets2panda/linter/test/deprecatedapi/text_input.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/text_input.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/text_input.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/text_input.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..dd029d72759d079651eeae7e5aef81800af40361 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/text_input.ets.arkts2.json @@ -0,0 +1,88 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 19, + "column": 41, + "endLine": 19, + "endColumn": 60, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 15, + "endLine": 19, + "endColumn": 34, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextInputController\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 41, + "endLine": 19, + "endColumn": 60, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextInputController\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 7, + "endLine": 23, + "endColumn": 16, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextInput\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/text_picker.ets.args.json b/ets2panda/linter/test/deprecatedapi/text_picker.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/text_picker.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/text_picker.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/text_picker.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..0579213c3c729ce6593b6816cc446f8cf5493058 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/text_picker.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": 28, + "endLine": 19, + "endColumn": 29, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 17, + "endLine": 26, + "endColumn": 19, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 34, + "column": 28, + "endLine": 34, + "endColumn": 39, + "problem": "ArrayIndexExprType", + "suggest": "", + "rule": "The index expression must be of a numeric type (arkts-array-index-expr-type)", + "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": 24, + "column": 5, + "endLine": 24, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Column\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 7, + "endLine": 25, + "endColumn": 13, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Button\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 11, + "endLine": 28, + "endColumn": 27, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextPickerDialog\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 7, + "endLine": 31, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"TextPicker\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/xcomponent.ets.args.json b/ets2panda/linter/test/deprecatedapi/xcomponent.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..4acc088d1da62353e56ced57f16b342de413cb78 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/xcomponent.ets.args.json @@ -0,0 +1,19 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "mode": { + "arkts2": "" + } +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/xcomponent.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/xcomponent.ets.arkts2.json new file mode 100644 index 0000000000000000000000000000000000000000..0e998f08269e40119b64bda69f1b01fb3ee2f528 --- /dev/null +++ b/ets2panda/linter/test/deprecatedapi/xcomponent.ets.arkts2.json @@ -0,0 +1,148 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 19, + "column": 52, + "endLine": 19, + "endColumn": 72, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 76, + "endLine": 28, + "endColumn": 80, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 95, + "endLine": 28, + "endColumn": 99, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 6, + "endLine": 32, + "endColumn": 14, + "problem": "SdkTypeQuery", + "suggest": "", + "rule": "Using typeof as a type is not allowed in this API (sdk-type-query)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 19, + "endLine": 32, + "endColumn": 20, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 25, + "endLine": 32, + "endColumn": 27, + "problem": "NumericSemantics", + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 16, + "column": 2, + "endLine": 16, + "endColumn": 7, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Entry\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 11, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Component\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 25, + "endLine": 19, + "endColumn": 45, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"XComponentController\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 52, + "endLine": 19, + "endColumn": 72, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"XComponentController\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 8, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"Row\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 7, + "endLine": 22, + "endColumn": 17, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"XComponent\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 22, + "endLine": 31, + "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/interop/binary_operation_js_obj.ets.autofix.json b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.autofix.json index b66ee99fd1e2138ce303809ce29f899724b7fd03..950dead5c234a56c680131b73543475d20a7ba6c 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 @@ -20,26 +20,6 @@ "endLine": 15, "endColumn": 53, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 604, - "end": 656, - "replacementText": "", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 53 - }, - { - "start": 656, - "end": 656, - "replacementText": "let foo = ESValue.load('./binary_operation_js_obj_js').getProperty('foo');\nlet m = ESValue.load('./binary_operation_js_obj_js').getProperty('m');\nlet n = ESValue.load('./binary_operation_js_obj_js').getProperty('n');", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 53 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 b22867f793c806789f4c788301cdd18f0cffb154..5c4f835784d72e4a0bf720da6d48d176852e4ad1 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 @@ -12,9 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -let foo = ESValue.load('./binary_operation_js_obj_js').getProperty('foo'); -let m = ESValue.load('./binary_operation_js_obj_js').getProperty('m'); -let n = ESValue.load('./binary_operation_js_obj_js').getProperty('n'); +import {foo,m,n} from "./binary_operation_js_obj_js" let a = foo.getProperty("a") let b = foo.getProperty("b") a + b diff --git a/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.json b/ets2panda/linter/test/interop/binary_operation_js_obj.ets.migrate.json index eba74eaf8742dbcfe30b877eb998a622f3a83a4a..0f7384dffa2b6c6d565e67310f0736f6dfa48252 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 @@ -16,19 +16,19 @@ "result": [ { "line": 15, - "column": 5, + "column": 1, "endLine": 15, - "endColumn": 74, - "problem": "AnyType", + "endColumn": 53, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 16, "column": 5, "endLine": 16, - "endColumn": 70, + "endColumn": 29, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,26 +38,6 @@ "line": 17, "column": 5, "endLine": 17, - "endColumn": 70, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 29, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 5, - "endLine": 19, "endColumn": 29, "problem": "AnyType", "suggest": "", @@ -65,9 +45,9 @@ "severity": "ERROR" }, { - "line": 25, + "line": 23, "column": 1, - "endLine": 25, + "endLine": 23, "endColumn": 15, "problem": "MathPow", "suggest": "", @@ -75,9 +55,9 @@ "severity": "ERROR" }, { - "line": 29, + "line": 27, "column": 1, - "endLine": 29, + "endLine": 27, "endColumn": 37, "problem": "MathPow", "suggest": "", @@ -85,9 +65,9 @@ "severity": "ERROR" }, { - "line": 35, + "line": 33, "column": 1, - "endLine": 35, + "endLine": 33, "endColumn": 15, "problem": "MathPow", "suggest": "", @@ -95,9 +75,9 @@ "severity": "ERROR" }, { - "line": 47, + "line": 45, "column": 1, - "endLine": 47, + "endLine": 45, "endColumn": 17, "problem": "MathPow", "suggest": "", diff --git a/ets2panda/linter/test/interop/call_function.ets.autofix.json b/ets2panda/linter/test/interop/call_function.ets.autofix.json index b1910efb3d5a91a376022ee75a391ec36a5cae32..206be26dd22cf08430da8f0425958201401b8c50 100644 --- a/ets2panda/linter/test/interop/call_function.ets.autofix.json +++ b/ets2panda/linter/test/interop/call_function.ets.autofix.json @@ -20,26 +20,6 @@ "endLine": 15, "endColumn": 43, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 604, - "end": 646, - "replacementText": "", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 43 - }, - { - "start": 646, - "end": 646, - "replacementText": "let foo = ESValue.load('./call_function_js').getProperty('foo');\nlet bar = ESValue.load('./call_function_js').getProperty('bar');", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 43 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -50,26 +30,6 @@ "endLine": 16, "endColumn": 39, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 647, - "end": 685, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 39 - }, - { - "start": 685, - "end": 685, - "replacementText": "let a = ESValue.load('./call_function_js').getProperty('a');\nlet b = ESValue.load('./call_function_js').getProperty('b');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 39 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" diff --git a/ets2panda/linter/test/interop/call_function.ets.migrate.ets b/ets2panda/linter/test/interop/call_function.ets.migrate.ets index dfacfa530a2a15d81bfb991440298883f59da1ba..488924d012ea7a6c533ed9be6340ea7676f57123 100644 --- a/ets2panda/linter/test/interop/call_function.ets.migrate.ets +++ b/ets2panda/linter/test/interop/call_function.ets.migrate.ets @@ -12,10 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -let foo = ESValue.load('./call_function_js').getProperty('foo'); -let bar = ESValue.load('./call_function_js').getProperty('bar'); -let a = ESValue.load('./call_function_js').getProperty('a'); -let b = ESValue.load('./call_function_js').getProperty('b'); +import {foo,bar} from "./call_function_js" +import {a,b} from "./call_function_js" foo.invoke() bar.invoke(ESValue.wrap(123.0)) diff --git a/ets2panda/linter/test/interop/call_function.ets.migrate.json b/ets2panda/linter/test/interop/call_function.ets.migrate.json index 2ca11b5859e69c41117613fd5c92d56af705b129..c9ca5e0d96fd9c8b231049bc0b25fc487020c4e1 100644 --- a/ets2panda/linter/test/interop/call_function.ets.migrate.json +++ b/ets2panda/linter/test/interop/call_function.ets.migrate.json @@ -16,42 +16,22 @@ "result": [ { "line": 15, - "column": 5, + "column": 1, "endLine": 15, - "endColumn": 64, - "problem": "AnyType", + "endColumn": 43, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 16, - "column": 5, + "column": 1, "endLine": 16, - "endColumn": 64, - "problem": "AnyType", + "endColumn": 39, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 5, - "endLine": 17, - "endColumn": 60, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 60, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" } ] 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 00cdf6a59e5ec307ff6745fc7a892f1468ce27c7..afc8eb134a088f606ce6dcbacd6b0be75281bac7 100644 --- a/ets2panda/linter/test/interop/call_object_methods.ets.autofix.json +++ b/ets2panda/linter/test/interop/call_object_methods.ets.autofix.json @@ -20,26 +20,6 @@ "endLine": 15, "endColumn": 47, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 604, - "end": 650, - "replacementText": "", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 47 - }, - { - "start": 650, - "end": 650, - "replacementText": "let foo = ESValue.load('./call_object_methods_js').getProperty('foo');", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 47 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 c92ae9f532301f757cb685d7d746ea3f91203579..d18b4715365f3f292433fc55b19e04d98c724535 100644 --- a/ets2panda/linter/test/interop/call_object_methods.ets.migrate.ets +++ b/ets2panda/linter/test/interop/call_object_methods.ets.migrate.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -let foo = ESValue.load('./call_object_methods_js').getProperty('foo'); +import { foo } from "./call_object_methods_js" 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 149a43f6f592beed295eb162f2eb5adb2f8c0e1c..94a7c680a7bed414b3aac1b4c0da3972817f96d1 100644 --- a/ets2panda/linter/test/interop/call_object_methods.ets.migrate.json +++ b/ets2panda/linter/test/interop/call_object_methods.ets.migrate.json @@ -16,12 +16,12 @@ "result": [ { "line": 15, - "column": 5, + "column": 1, "endLine": 15, - "endColumn": 70, - "problem": "AnyType", + "endColumn": 47, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" } ] 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 465ba2da807da1e35435da6a6f7b6a33016d2af3..e9af2d47b12258b4f93b91f9aae002c4d6acbca4 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 @@ -20,26 +20,6 @@ "endLine": 15, "endColumn": 52, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 604, - "end": 655, - "replacementText": "", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 52 - }, - { - "start": 655, - "end": 655, - "replacementText": "let foo = ESValue.load('./increases_decreases_js_obj_js').getProperty('foo');", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 52 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -402,4 +382,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file 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 1cd740b7b56eff7959389116baf2e35e3b15c86c..cde3dfacf9603ad8b8b0311c8fa27026fa5e7616 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 @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -let foo = ESValue.load('./increases_decreases_js_obj_js').getProperty('foo'); +import {foo} from "./increases_decreases_js_obj_js" let a: number =0.0 a = foo.getProperty("num").toNumber() foo.setProperty(num, a + 1.0) diff --git a/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.json b/ets2panda/linter/test/interop/increases_decreases_js_obj.ets.migrate.json index f9906637d18ef0f43d5e7e4e13cef33aad5184fe..c1eebeb25c56ef572edb41bc0480ef0fb51e8bab 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 @@ -16,12 +16,12 @@ "result": [ { "line": 15, - "column": 5, + "column": 1, "endLine": 15, - "endColumn": 77, - "problem": "AnyType", + "endColumn": 52, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { @@ -65,4 +65,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file 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 d00f4ee0da5ca1764dd8f2f81533ce6f14c0af62..a0da97f1f6ab56d0e9be78800c3a59ed8d78d18c 100644 --- a/ets2panda/linter/test/interop/instantiated_js_obj.ets.autofix.json +++ b/ets2panda/linter/test/interop/instantiated_js_obj.ets.autofix.json @@ -20,26 +20,6 @@ "endLine": 16, "endColumn": 51, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 605, - "end": 655, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 51 - }, - { - "start": 655, - "end": 655, - "replacementText": "let Foo = ESValue.load('./instantiated_js_obj_js').getProperty('Foo');\nlet Foo1 = ESValue.load('./instantiated_js_obj_js').getProperty('Foo1');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 51 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 5ad9c490c7a58acadc8886b9f09523ed64f8e8ad..c41c16e387b95fdbf4bf38b976b4b7a0e0aece46 100644 --- a/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.ets +++ b/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.ets @@ -13,8 +13,7 @@ * limitations under the License. */ -let Foo = ESValue.load('./instantiated_js_obj_js').getProperty('Foo'); -let Foo1 = ESValue.load('./instantiated_js_obj_js').getProperty('Foo1'); +import {Foo, Foo1} from "./instantiated_js_obj_js" class A { num: number = 1.0; constructor() { 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 a1be17f7a40899eb98b78b56687678a26cf3b3fd..8ae4b51b2e860913274a052ebd930922bdafa5cc 100644 --- a/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.json +++ b/ets2panda/linter/test/interop/instantiated_js_obj.ets.migrate.json @@ -16,22 +16,12 @@ "result": [ { "line": 16, - "column": 5, + "column": 1, "endLine": 16, - "endColumn": 70, - "problem": "AnyType", + "endColumn": 51, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 5, - "endLine": 17, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" } ] 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 8f8b73e3cdbb7c0e0f2a2cfd2c00ea33fe9881d9..e90ddfedb1e2b6569ca3a200c81a31019f672661 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.autofix.json @@ -30,26 +30,6 @@ "endLine": 17, "endColumn": 106, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 636, - "end": 740, - "replacementText": "", - "line": 17, - "column": 2, - "endLine": 17, - "endColumn": 106 - }, - { - "start": 740, - "end": 740, - "replacementText": "let foo = ESValue.load('./interop_convert_import_js.js').getProperty('foo');\r\nlet foo2 = ESValue.load('./interop_convert_import_js.js').getProperty('foo2');\r\nlet foo3 = ESValue.load('./interop_convert_import_js.js').getProperty('foo3');\r\nlet foo4 = ESValue.load('./interop_convert_import_js.js').getProperty('foo4');\r\nlet array_val = ESValue.load('./interop_convert_import_js.js').getProperty('array_val');\r\nlet null_val = ESValue.load('./interop_convert_import_js.js').getProperty('null_val');\r\nlet undefined_val = ESValue.load('./interop_convert_import_js.js').getProperty('undefined_val');", - "line": 17, - "column": 2, - "endLine": 17, - "endColumn": 106 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 2b727d66126cbe57d0abd8e2b63ea341b63ab076..a04503ccc23347821ab0beb697e7db0205ad8ada 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.ets @@ -14,13 +14,7 @@ */ 'use static' - let foo = ESValue.load('./interop_convert_import_js.js').getProperty('foo'); -let foo2 = ESValue.load('./interop_convert_import_js.js').getProperty('foo2'); -let foo3 = ESValue.load('./interop_convert_import_js.js').getProperty('foo3'); -let foo4 = ESValue.load('./interop_convert_import_js.js').getProperty('foo4'); -let array_val = ESValue.load('./interop_convert_import_js.js').getProperty('array_val'); -let null_val = ESValue.load('./interop_convert_import_js.js').getProperty('null_val'); -let undefined_val = ESValue.load('./interop_convert_import_js.js').getProperty('undefined_val'); + import {foo, foo2, foo3, foo4, array_val, null_val, undefined_val} from "./interop_convert_import_js.js" let a: number = foo.getProperty("num").toNumber() let a1: boolean = foo2.getProperty("bool").toBoolean() 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 169c0b6ce01c22d2aac5a7fd59241d93a5b78c79..477162ca035537626a2cdf2e2a5e633a98b9b8ba 100644 --- a/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_convert_import.ets.migrate.json @@ -16,89 +16,69 @@ "result": [ { "line": 17, - "column": 6, + "column": 2, "endLine": 17, - "endColumn": 77, - "problem": "AnyType", + "endColumn": 106, + "problem": "ImportAfterStatement", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", "severity": "ERROR" }, { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 78, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 5, - "endLine": 19, - "endColumn": 78, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 78, - "problem": "AnyType", + "line": 17, + "column": 2, + "endLine": 17, + "endColumn": 106, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { - "line": 21, - "column": 5, - "endLine": 21, - "endColumn": 88, - "problem": "AnyType", + "line": 25, + "column": 9, + "endLine": 25, + "endColumn": 27, + "problem": "InterOpConvertImport", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, { - "line": 22, - "column": 5, - "endLine": 22, - "endColumn": 86, - "problem": "AnyType", + "line": 25, + "column": 44, + "endLine": 25, + "endColumn": 68, + "problem": "GenericCallNoTypeArgs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", "severity": "ERROR" }, { - "line": 23, - "column": 5, - "endLine": 23, - "endColumn": 96, - "problem": "AnyType", + "line": 30, + "column": 9, + "endLine": 30, + "endColumn": 30, + "problem": "InterOpConvertImport", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, { - "line": 31, - "column": 44, - "endLine": 31, - "endColumn": 68, - "problem": "GenericCallNoTypeArgs", + "line": 35, + "column": 8, + "endLine": 35, + "endColumn": 24, + "problem": "InterOpConvertImport", "suggest": "", - "rule": "Type inference in case of generic function calls is limited (arkts-no-inferred-generic-params)", + "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", "severity": "ERROR" }, { - "line": 41, + "line": 40, "column": 8, - "endLine": 41, - "endColumn": 24, + "endLine": 40, + "endColumn": 34, "problem": "InterOpConvertImport", "suggest": "", "rule": "Casting interop JS objects to primitive types is not allowed (arkts-interop-js2s-convert-js-type)", 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 3203f645acdc0de2bb729cf49897e7bb51653af4..73d6eea5c8064980fd5c71ce5995ccb80999269c 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json @@ -14,32 +14,12 @@ "limitations under the License." ], "result": [ - { + { "line": 16, "column": 1, "endLine": 16, "endColumn": 58, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 605, - "end": 662, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 58 - }, - { - "start": 662, - "end": 662, - "replacementText": "let a = ESValue.load('./interop_equality_judgment_js').getProperty('a');\nlet b = ESValue.load('./interop_equality_judgment_js').getProperty('b');\nlet c = ESValue.load('./interop_equality_judgment_js').getProperty('c');\nlet d = ESValue.load('./interop_equality_judgment_js').getProperty('d');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 58 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -380,5 +360,5 @@ "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "severity": "ERROR" } - ] -} + ] +} \ No newline at end of file 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 97c56d0dda0f930edb5db48d1f6fd0b9810fae45..f0bdc4e3ea0e54767723b86fac1a5582629d621b 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets @@ -13,10 +13,7 @@ * limitations under the License. */ -let a = ESValue.load('./interop_equality_judgment_js').getProperty('a'); -let b = ESValue.load('./interop_equality_judgment_js').getProperty('b'); -let c = ESValue.load('./interop_equality_judgment_js').getProperty('c'); -let d = ESValue.load('./interop_equality_judgment_js').getProperty('d'); +import {a, b, c, d} from "./interop_equality_judgment_js" a.areEqual(b) !a.areEqual(b) a.areStrictlyEqual(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 165b58c9e802e1c4e81e049eee1043ed8a65cff9..1f0874db0ddfe681b007ec3fd09c2c1d15cab099 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json @@ -13,46 +13,56 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ - { - "line": 16, - "column": 5, - "endLine": 16, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 5, - "endLine": 17, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 5, - "endLine": 19, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - } - ] -} + "result": [ + { + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 58, + "problem": "InterOpImportJs", + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 12, + "endLine": 17, + "endColumn": 13, + "problem": "InteropJsObjectExpandStaticInstance", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 13, + "endLine": 18, + "endColumn": 14, + "problem": "InteropJsObjectExpandStaticInstance", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 20, + "endLine": 19, + "endColumn": 21, + "problem": "InteropJsObjectExpandStaticInstance", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 21, + "endLine": 20, + "endColumn": 22, + "problem": "InteropJsObjectExpandStaticInstance", + "suggest": "", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", + "severity": "ERROR" + } + ] +} \ No newline at end of file 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 968a9c014ed5b655e79bef8a1209714677507427..f8dbfb7b6c507c635f7e41fd8c93a7b1ee20432a 100755 --- a/ets2panda/linter/test/interop/interop_import_js.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js.ets.autofix.json @@ -20,26 +20,6 @@ "endLine": 16, "endColumn": 38, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 606, - "end": 643, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 38 - }, - { - "start": 643, - "end": 643, - "replacementText": "let Cjs = ESValue.load('../main/js_lib').getProperty('Cjs');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 38 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -50,26 +30,6 @@ "endLine": 17, "endColumn": 38, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 644, - "end": 681, - "replacementText": "", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 38 - }, - { - "start": 681, - "end": 681, - "replacementText": "let fjs = ESValue.load('../main/js_lib').getProperty('fjs');", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 38 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -80,26 +40,6 @@ "endLine": 18, "endColumn": 64, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 682, - "end": 745, - "replacementText": "", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 64 - }, - { - "start": 745, - "end": 745, - "replacementText": "let CPreview = ESValue.load('./jsfiles/preview_import_js').getProperty('CPreview');\nlet bar = ESValue.load('./jsfiles/preview_import_js').getProperty('bar');\nlet foo = ESValue.load('./jsfiles/preview_import_js').getProperty('foo');", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 64 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -110,26 +50,6 @@ "endLine": 19, "endColumn": 44, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 746, - "end": 789, - "replacementText": "", - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 44 - }, - { - "start": 789, - "end": 789, - "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');", - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 44 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -140,26 +60,6 @@ "endLine": 20, "endColumn": 57, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 790, - "end": 846, - "replacementText": "", - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 57 - }, - { - "start": 846, - "end": 846, - "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');\nlet ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA');\nlet Dog = ESValue.load('./interop_import_js_js').getProperty('Dog');", - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 57 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -170,26 +70,6 @@ "endLine": 21, "endColumn": 47, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 847, - "end": 893, - "replacementText": "", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 47 - }, - { - "start": 893, - "end": 893, - "replacementText": "let tjs = ESValue.load('./interop_import_js_js').getProperty('tjs');", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 47 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -200,26 +80,6 @@ "endLine": 22, "endColumn": 59, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 894, - "end": 952, - "replacementText": "", - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 59 - }, - { - "start": 952, - "end": 952, - "replacementText": "let Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');\nlet Doge = ESValue.load('./interop_import_js_js').getProperty('Dog');", - "line": 22, - "column": 1, - "endLine": 22, - "endColumn": 59 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 8a7215433eb02d96fc996ea94e32321d41b25965..a4c0b8fea69eeb2c1cb904f44aac79c764e47804 100644 --- a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.ets @@ -13,15 +13,10 @@ * limitations under the License. */ -let Cjs = ESValue.load('../main/js_lib').getProperty('Cjs'); -let fjs = ESValue.load('../main/js_lib').getProperty('fjs'); -let CPreview = ESValue.load('./jsfiles/preview_import_js').getProperty('CPreview'); -let bar = ESValue.load('./jsfiles/preview_import_js').getProperty('bar'); -let foo = ESValue.load('./jsfiles/preview_import_js').getProperty('foo'); -let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa'); -let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa'); -let ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA'); -let Dog = ESValue.load('./interop_import_js_js').getProperty('Dog'); -let tjs = ESValue.load('./interop_import_js_js').getProperty('tjs'); -let Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki'); -let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog'); \ No newline at end of file +import { Cjs } from '../main/js_lib'; +import { fjs } from '../main/js_lib'; +import { CPreview,bar,foo } from "./jsfiles/preview_import_js"; +import myAaa from "./interop_import_js_js"; +import myAaa,{ClassA,Dog} from "./interop_import_js_js"; +import * as tjs from "./interop_import_js_js"; +import { Wiki, Dog as Doge } from './interop_import_js_js' \ No newline at end of file diff --git a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json index d20b189b4f292fa53920f6579a542b3f8c2651aa..f8dbfb7b6c507c635f7e41fd8c93a7b1ee20432a 100644 --- a/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_import_js.ets.migrate.json @@ -16,122 +16,72 @@ "result": [ { "line": 16, - "column": 5, + "column": 1, "endLine": 16, - "endColumn": 60, - "problem": "AnyType", + "endColumn": 38, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 17, - "column": 5, + "column": 1, "endLine": 17, - "endColumn": 60, - "problem": "AnyType", + "endColumn": 38, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 18, - "column": 5, + "column": 1, "endLine": 18, - "endColumn": 83, - "problem": "AnyType", + "endColumn": 64, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 19, - "column": 5, + "column": 1, "endLine": 19, - "endColumn": 73, - "problem": "AnyType", + "endColumn": 44, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 20, - "column": 5, + "column": 1, "endLine": 20, - "endColumn": 73, - "problem": "AnyType", + "endColumn": 57, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 21, - "column": 5, + "column": 1, "endLine": 21, - "endColumn": 70, - "problem": "AnyType", + "endColumn": 47, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 22, - "column": 5, + "column": 1, "endLine": 22, - "endColumn": 70, - "problem": "AnyType", + "endColumn": 59, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 23, - "column": 5, - "endLine": 23, - "endColumn": 74, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 24, - "column": 5, - "endLine": 24, - "endColumn": 68, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 25, - "column": 5, - "endLine": 25, - "endColumn": 68, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 26, - "column": 5, - "endLine": 26, - "endColumn": 70, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 27, - "column": 5, - "endLine": 27, - "endColumn": 69, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" } ] 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 d54c3071e70236a7f8a86ae847bce7285d7d6636..5c02835f89f300921d0236a6432c6b48207cf51b 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 @@ -20,26 +20,6 @@ "endLine": 17, "endColumn": 57, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 607, - "end": 663, - "replacementText": "", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 57 - }, - { - "start": 663, - "end": 663, - "replacementText": "let foo = ESValue.load('./interop_import_js_compare_js').getProperty('foo');\nlet m = ESValue.load('./interop_import_js_compare_js').getProperty('m');\nlet n = ESValue.load('./interop_import_js_compare_js').getProperty('n');", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 57 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 e9bab633c586092ecb5e0e4e11d6a1e4cefe7ff9..51e820d9092d3e093223e832564114cfdb140f9f 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 @@ -14,9 +14,7 @@ */ -let foo = ESValue.load('./interop_import_js_compare_js').getProperty('foo'); -let m = ESValue.load('./interop_import_js_compare_js').getProperty('m'); -let n = ESValue.load('./interop_import_js_compare_js').getProperty('n'); +import {foo, m, n} from "./interop_import_js_compare_js" let a = foo.getProperty("a") let b = foo.getProperty("b") a > b diff --git a/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.json b/ets2panda/linter/test/interop/interop_import_js_compare.ets.migrate.json index 69216fdae77b5bc16727b2286af5d86722cf4e9e..27f3d3c0d454d71d6ad5c5d374f723aa58558f6b 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 @@ -16,19 +16,19 @@ "result": [ { "line": 17, - "column": 5, + "column": 1, "endLine": 17, - "endColumn": 76, - "problem": "AnyType", + "endColumn": 57, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 18, "column": 5, "endLine": 18, - "endColumn": 72, + "endColumn": 29, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", @@ -38,26 +38,6 @@ "line": 19, "column": 5, "endLine": 19, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 29, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 5, - "endLine": 21, "endColumn": 29, "problem": "AnyType", "suggest": "", diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_index.ets.autofix.json index f837b56a6af8c56a76cbff4a72278f1cfa20851f..7467f08a68d90b50ad957c56000c7aae7be57a42 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 @@ -20,26 +20,6 @@ "endLine": 15, "endColumn": 51, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 604, - "end": 654, - "replacementText": "", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 51 - }, - { - "start": 654, - "end": 654, - "replacementText": "let ff3 = ESValue.load('./interop_import_js_rules_js').getProperty('ff3');", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 51 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -50,26 +30,6 @@ "endLine": 16, "endColumn": 49, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 655, - "end": 703, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 49 - }, - { - "start": 703, - "end": 703, - "replacementText": "let foo = ESValue.load('./interop_import_js_index_js').getProperty('foo');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 49 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.ets b/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.ets index 60b5b30251ea5240c208b64bac57a2d6bffd5ed3..11371d2a4f49baf5a939dd632fed067c61dbbf43 100644 --- a/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.ets @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -let ff3 = ESValue.load('./interop_import_js_rules_js').getProperty('ff3'); -let foo = ESValue.load('./interop_import_js_index_js').getProperty('foo'); +import { ff3 } from "./interop_import_js_rules_js" +import {foo} from "./interop_import_js_index_js" let arr = foo.getProperty("arr") arr.getProperty(1.0) arr.setProperty(3.0, ESValue.wrap(4.0)) diff --git a/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.json b/ets2panda/linter/test/interop/interop_import_js_index.ets.migrate.json index 191b2c2b9ec307fab46144da63bef106269577e4..bc5a9efda1c70321cd41c703b92a3ef695e946bd 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 @@ -16,22 +16,22 @@ "result": [ { "line": 15, - "column": 5, + "column": 1, "endLine": 15, - "endColumn": 74, - "problem": "AnyType", + "endColumn": 51, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 16, - "column": 5, + "column": 1, "endLine": 16, - "endColumn": 74, - "problem": "AnyType", + "endColumn": 49, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { @@ -65,4 +65,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file 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 702bfa960162802ac8bdef528ddf783aa0079d7d..4fb8162057de9a0e0273f80d9e0c6b97b87758b3 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 @@ -30,26 +30,6 @@ "endLine": 17, "endColumn": 51, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 619, - "end": 669, - "replacementText": "", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 51 - }, - { - "start": 669, - "end": 669, - "replacementText": "let foo = ESValue.load('./interop_import_js_rules_js').getProperty('foo');", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 51 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -70,26 +50,6 @@ "endLine": 18, "endColumn": 56, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 670, - "end": 725, - "replacementText": "", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 56 - }, - { - "start": 725, - "end": 725, - "replacementText": "let ff1 = ESValue.load('./interop_import_js_rules_js').getProperty('ff1');\nlet ff2 = ESValue.load('./interop_import_js_rules_js').getProperty('ff2');", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 56 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -110,26 +70,6 @@ "endLine": 20, "endColumn": 49, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 727, - "end": 775, - "replacementText": "", - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 49 - }, - { - "start": 775, - "end": 775, - "replacementText": "let A = ESValue.load('./interop_import_js_rules_js').getProperty('A');", - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 49 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -150,26 +90,6 @@ "endLine": 21, "endColumn": 49, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 776, - "end": 824, - "replacementText": "", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 49 - }, - { - "start": 824, - "end": 824, - "replacementText": "let C = ESValue.load('./interop_import_js_rules_js').getProperty('C');", - "line": 21, - "column": 1, - "endLine": 21, - "endColumn": 49 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -190,26 +110,6 @@ "endLine": 23, "endColumn": 51, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 826, - "end": 876, - "replacementText": "", - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 51 - }, - { - "start": 876, - "end": 876, - "replacementText": "let ff3 = ESValue.load('./interop_import_js_rules_js').getProperty('ff3');", - "line": 23, - "column": 1, - "endLine": 23, - "endColumn": 51 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -230,26 +130,6 @@ "endLine": 25, "endColumn": 51, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 878, - "end": 928, - "replacementText": "", - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 51 - }, - { - "start": 928, - "end": 928, - "replacementText": "let ff4 = ESValue.load('./interop_import_js_rules_js').getProperty('ff4');", - "line": 25, - "column": 1, - "endLine": 25, - "endColumn": 51 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -270,26 +150,6 @@ "endLine": 27, "endColumn": 54, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 930, - "end": 983, - "replacementText": "", - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 54 - }, - { - "start": 983, - "end": 983, - "replacementText": "let handle = ESValue.load('./interop_import_js_rules_js').getProperty('handle');", - "line": 27, - "column": 1, - "endLine": 27, - "endColumn": 54 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -310,26 +170,6 @@ "endLine": 29, "endColumn": 54, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 985, - "end": 1038, - "replacementText": "", - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 54 - }, - { - "start": 1038, - "end": 1038, - "replacementText": "let expand = ESValue.load('./interop_import_js_rules_js').getProperty('expand');", - "line": 29, - "column": 1, - "endLine": 29, - "endColumn": 54 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -350,26 +190,6 @@ "endLine": 30, "endColumn": 54, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 1039, - "end": 1092, - "replacementText": "", - "line": 30, - "column": 1, - "endLine": 30, - "endColumn": 54 - }, - { - "start": 1092, - "end": 1092, - "replacementText": "let orange = ESValue.load('./interop_import_js_rules_js').getProperty('orange');", - "line": 30, - "column": 1, - "endLine": 30, - "endColumn": 54 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" diff --git a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.autofix.json index 616283816bbf0bb6f611360a8277ff27d8543a91..d6958993db88cdda9b601cc2e835179fcfc763f6 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 @@ -20,26 +20,6 @@ "endLine": 16, "endColumn": 69, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 606, - "end": 674, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 69 - }, - { - "start": 674, - "end": 674, - "replacementText": "let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa');\nlet ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA');\nlet Dog = ESValue.load('./interop_import_js_js').getProperty('Dog');\nlet Person = ESValue.load('./interop_import_js_js').getProperty('Person');\nlet Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 69 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -50,26 +30,6 @@ "endLine": 17, "endColumn": 54, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 675, - "end": 728, - "replacementText": "", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 54 - }, - { - "start": 728, - "end": 728, - "replacementText": "let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog');", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 54 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -80,26 +40,6 @@ "endLine": 18, "endColumn": 55, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 729, - "end": 783, - "replacementText": "", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 55 - }, - { - "start": 783, - "end": 783, - "replacementText": "let wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki');", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 55 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 e50da4c9173f7bfd0f2eed73da25c765aa50da14..59105c01fa7da01ef0d7bdf25e9cdbcbfc26ab63 100644 --- a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.ets @@ -13,13 +13,9 @@ * limitations under the License. */ -let myAaa = ESValue.load('./interop_import_js_js').getProperty('aaa'); -let ClassA = ESValue.load('./interop_import_js_js').getProperty('ClassA'); -let Dog = ESValue.load('./interop_import_js_js').getProperty('Dog'); -let Person = ESValue.load('./interop_import_js_js').getProperty('Person'); -let Wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki'); -let Doge = ESValue.load('./interop_import_js_js').getProperty('Dog'); -let wiki = ESValue.load('./interop_import_js_js').getProperty('Wiki'); +import myAaa,{ClassA,Dog,Person,Wiki} from "./interop_import_js_js"; +import { Dog as Doge } from './interop_import_js_js'; +import { Wiki as wiki } from './interop_import_js_js'; myAaa.invoke().typeOf(); //error let fun = myAaa.invoke(); diff --git a/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.json b/ets2panda/linter/test/interop/interop_import_typeof_js.ets.migrate.json index 5c235089d9987874d5bcaceb721be697c9149d90..b0154468d307ea51471633e2abd2216c3399b3dd 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 @@ -16,118 +16,98 @@ "result": [ { "line": 16, - "column": 5, + "column": 1, "endLine": 16, - "endColumn": 70, - "problem": "AnyType", + "endColumn": 69, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 17, - "column": 5, + "column": 1, "endLine": 17, - "endColumn": 74, - "problem": "AnyType", + "endColumn": 54, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 18, - "column": 5, + "column": 1, "endLine": 18, - "endColumn": 68, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 5, - "endLine": 19, - "endColumn": 74, - "problem": "AnyType", + "endColumn": 55, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 70, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 21, "column": 5, "endLine": 21, - "endColumn": 69, + "endColumn": 25, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 22, + "line": 29, "column": 5, - "endLine": 22, - "endColumn": 70, + "endLine": 29, + "endColumn": 35, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 25, + "line": 35, "column": 5, - "endLine": 25, - "endColumn": 25, + "endLine": 35, + "endColumn": 37, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 33, + "line": 36, "column": 5, - "endLine": 33, - "endColumn": 35, + "endLine": 36, + "endColumn": 42, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 39, - "column": 5, - "endLine": 39, - "endColumn": 37, - "problem": "AnyType", + "line": 42, + "column": 10, + "endLine": 42, + "endColumn": 30, + "problem": "LimitedVoidType", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, { - "line": 40, - "column": 5, - "endLine": 40, - "endColumn": 42, - "problem": "AnyType", + "line": 47, + "column": 21, + "endLine": 47, + "endColumn": 41, + "problem": "LimitedVoidType", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, { - "line": 53, + "line": 49, "column": 7, - "endLine": 53, + "endLine": 49, "endColumn": 13, "problem": "InvalidIdentifier", "suggest": "", diff --git a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json index 3947650ebf6cea8ecc00ecee25461b05543d600b..66925f8b56c90b9336082f29d62d500a01d2bfd9 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 @@ -30,26 +30,6 @@ "endLine": 17, "endColumn": 106, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 618, - "end": 723, - "replacementText": "", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 106 - }, - { - "start": 723, - "end": 723, - "replacementText": "let foo = ESValue.load('./interop_not_have_property_js').getProperty('foo');\nlet person = ESValue.load('./interop_not_have_property_js').getProperty('person');\nlet TestHelper = ESValue.load('./interop_not_have_property_js').getProperty('TestHelper');\nlet Machine = ESValue.load('./interop_not_have_property_js').getProperty('Machine');\nlet User = ESValue.load('./interop_not_have_property_js').getProperty('User');\nlet Person = ESValue.load('./interop_not_have_property_js').getProperty('Person');\nlet Employee = ESValue.load('./interop_not_have_property_js').getProperty('Employee');", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 106 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -1031,4 +1011,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file 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 6320fe717df369223c3167f10f2ccae5a26d767d..f289defb389042127ad4212664ce9509ee694de9 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 @@ -14,13 +14,7 @@ */ 'use static' -let foo = ESValue.load('./interop_not_have_property_js').getProperty('foo'); -let person = ESValue.load('./interop_not_have_property_js').getProperty('person'); -let TestHelper = ESValue.load('./interop_not_have_property_js').getProperty('TestHelper'); -let Machine = ESValue.load('./interop_not_have_property_js').getProperty('Machine'); -let User = ESValue.load('./interop_not_have_property_js').getProperty('User'); -let Person = ESValue.load('./interop_not_have_property_js').getProperty('Person'); -let Employee = ESValue.load('./interop_not_have_property_js').getProperty('Employee'); +import { foo, person, TestHelper, Machine, User, Person, Employee } from "./interop_not_have_property_js" foo.getProperty("name") foo.setProperty("name", ESValue.wrap("456")) @@ -34,36 +28,36 @@ a.setProperty("age", ESValue.wrap(12.0)) let test_helper = TestHelper.instantiate(ESValue.wrap("TEST_INSTANTIATE_JS_OBJECT")); test_helper.invokeMethod("test", ESValue.wrap(() => { - let machine = new Machine(); - return machine.name === "machine"; // arkts-interop-js2s-access-js-prop + let machine = Machine.instantiate(); + return machine.getProperty("name").areStrictlyEqual("machine"); // arkts-interop-js2s-access-js-prop }), ESValue.wrap("machine.name === 'machine'")); test_helper.invokeMethod("test", ESValue.wrap(() => { - let user = new User("Bob"); - return user.id === "Bob"; // arkts-interop-js2s-access-js-prop + let user = User.instantiate(ESValue.wrap("Bob")); + return user.getProperty("id").areStrictlyEqual("Bob"); // arkts-interop-js2s-access-js-prop }), ESValue.wrap("user.id === 'Bob'")); test_helper.invokeMethod("test", ESValue.wrap(() => { -let user = new User(10.0); -return user.id === 10.0;// arkts-interop-js2s-access-js-prop +let user = User.instantiate(ESValue.wrap(10.0)); +return user.getProperty("id").areStrictlyEqual(10.0);// arkts-interop-js2s-access-js-prop }), ESValue.wrap("user.id === 10")); test_helper.invokeMethod("test", ESValue.wrap(() => { - let user = new User(123n); - return user.id === 123n; // arkts-interop-js2s-access-js-prop + let user = User.instantiate(ESValue.wrap(123n)); + return user.getProperty("id").areStrictlyEqual(123n); // arkts-interop-js2s-access-js-prop }), ESValue.wrap("user.id === 123n")); test_helper.invokeMethod("test", ESValue.wrap(() => { - let user = new User(true); - return user.id === true;// arkts-interop-js2s-access-js-prop + let user = User.instantiate(ESValue.wrap(true)); + return user.getProperty("id").areStrictlyEqual(true);// arkts-interop-js2s-access-js-prop }), ESValue.wrap("user.id === true")); test_helper.invokeMethod("test", ESValue.wrap(() => { - let machine = new Person("John", 10.0); - return machine.name === "machine"; // arkts-interop-js2s-access-js-prop + let machine = Person.instantiate(ESValue.wrap("John"), ESValue.wrap(10.0)); + return machine.getProperty("name").areStrictlyEqual("machine"); // arkts-interop-js2s-access-js-prop }), ESValue.wrap("machine.name === 'machine'")); test_helper.invokeMethod("test", ESValue.wrap(() => { - let employee = new Employee(); - return employee.name === "employee"; // arkts-interop-js2s-access-js-prop + let employee = Employee.instantiate(); + return employee.getProperty("name").areStrictlyEqual("employee"); // arkts-interop-js2s-access-js-prop }), ESValue.wrap("employee.name === 'employee'")); \ No newline at end of file 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 02a85bc4f7389ef43420da02e57155643a3600ec..65c441a16bebab818412e967fc266a3ca72cc2e6 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 @@ -16,233 +16,183 @@ "result": [ { "line": 17, - "column": 5, + "column": 1, "endLine": 17, - "endColumn": 76, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 82, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 5, - "endLine": 19, - "endColumn": 90, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 84, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 21, - "column": 5, - "endLine": 21, - "endColumn": 78, - "problem": "AnyType", + "endColumn": 106, + "problem": "ImportAfterStatement", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", "severity": "ERROR" }, { - "line": 22, - "column": 5, - "endLine": 22, - "endColumn": 82, - "problem": "AnyType", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 106, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { - "line": 23, + "line": 26, "column": 5, - "endLine": 23, - "endColumn": 86, + "endLine": 26, + "endColumn": 26, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 32, + "line": 29, "column": 5, - "endLine": 32, - "endColumn": 26, + "endLine": 29, + "endColumn": 85, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 35, - "column": 5, - "endLine": 35, - "endColumn": 85, - "problem": "AnyType", + "line": 30, + "column": 47, + "endLine": 33, + "endColumn": 2, + "problem": "LimitedReturnTypeInference", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, { - "line": 37, + "line": 31, "column": 9, - "endLine": 37, - "endColumn": 32, + "endLine": 31, + "endColumn": 40, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 37, - "column": 23, - "endLine": 37, - "endColumn": 30, - "problem": "DynamicCtorCall", + "line": 35, + "column": 47, + "endLine": 38, + "endColumn": 2, + "problem": "LimitedReturnTypeInference", "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, { - "line": 42, + "line": 36, "column": 9, - "endLine": 42, - "endColumn": 31, + "endLine": 36, + "endColumn": 53, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 42, - "column": 20, - "endLine": 42, - "endColumn": 24, - "problem": "DynamicCtorCall", + "line": 40, + "column": 47, + "endLine": 43, + "endColumn": 2, + "problem": "LimitedReturnTypeInference", "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, { - "line": 47, + "line": 41, "column": 5, - "endLine": 47, - "endColumn": 26, + "endLine": 41, + "endColumn": 48, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 47, - "column": 16, - "endLine": 47, - "endColumn": 20, - "problem": "DynamicCtorCall", + "line": 45, + "column": 47, + "endLine": 48, + "endColumn": 2, + "problem": "LimitedReturnTypeInference", "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, { - "line": 52, + "line": 46, "column": 9, - "endLine": 52, - "endColumn": 30, + "endLine": 46, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 52, - "column": 20, - "endLine": 52, - "endColumn": 24, - "problem": "DynamicCtorCall", + "line": 50, + "column": 47, + "endLine": 53, + "endColumn": 2, + "problem": "LimitedReturnTypeInference", "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, { - "line": 57, + "line": 51, "column": 9, - "endLine": 57, - "endColumn": 30, + "endLine": 51, + "endColumn": 52, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 57, - "column": 20, - "endLine": 57, - "endColumn": 24, - "problem": "DynamicCtorCall", + "line": 55, + "column": 47, + "endLine": 58, + "endColumn": 2, + "problem": "LimitedReturnTypeInference", "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, { - "line": 62, + "line": 56, "column": 9, - "endLine": 62, - "endColumn": 43, + "endLine": 56, + "endColumn": 79, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" }, { - "line": 62, - "column": 23, - "endLine": 62, - "endColumn": 29, - "problem": "DynamicCtorCall", + "line": 60, + "column": 47, + "endLine": 63, + "endColumn": 2, + "problem": "LimitedReturnTypeInference", "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, { - "line": 67, + "line": 61, "column": 9, - "endLine": 67, - "endColumn": 34, + "endLine": 61, + "endColumn": 42, "problem": "AnyType", "suggest": "", "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", "severity": "ERROR" - }, - { - "line": 67, - "column": 24, - "endLine": 67, - "endColumn": 32, - "problem": "DynamicCtorCall", - "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", - "severity": "ERROR" } ] } \ No newline at end of file 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 25cdadbfd4c2e3743b117d209932ef636e18c2c3..5a00e93e85d4b302625e82ef5b3bfe8a8e648fe2 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 @@ -20,26 +20,6 @@ "endLine": 16, "endColumn": 46, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 605, - "end": 650, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 46 - }, - { - "start": 650, - "end": 650, - "replacementText": "let foo = ESValue.load('./interop_property_num_js').getProperty('foo');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 46 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 90055be46b6d01d93842863a922186d8022e2efa..397d49f4e68017f85604eb52118a48973d74f8f1 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 @@ -13,7 +13,7 @@ * limitations under the License. */ -let foo = ESValue.load('./interop_property_num_js').getProperty('foo'); +import {foo} from "./interop_property_num_js" +foo.getProperty("num").toNumber(); -foo.getProperty("num").toNumber(); diff --git a/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.json b/ets2panda/linter/test/interop/interop_not_have_property_num_arkts2.ets.migrate.json index 8e9afac340f76cb36ff554e32f871a46d7f06406..923652a6ed843e53643967940e9a49e35e5e2616 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 @@ -16,12 +16,12 @@ "result": [ { "line": 16, - "column": 5, + "column": 1, "endLine": 16, - "endColumn": 71, - "problem": "AnyType", + "endColumn": 46, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { 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 84a00a559c9d9f6d6f93195bd855662ab88891d1..10055bdbb3c857fb01df06afa1e8b1b764f15480 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 @@ -20,26 +20,6 @@ "endLine": 16, "endColumn": 89, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 605, - "end": 693, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 89 - }, - { - "start": 693, - "end": 693, - "replacementText": "let p = ESValue.load('./no_await_js_promise_export').getProperty('p');\nlet foo = ESValue.load('./no_await_js_promise_export').getProperty('foo');\nlet pFuncCall = ESValue.load('./no_await_js_promise_export').getProperty('pFuncCall');\nlet arrowFunc = ESValue.load('./no_await_js_promise_export').getProperty('arrowFunc');\nlet pArrowCall = ESValue.load('./no_await_js_promise_export').getProperty('pArrowCall');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 89 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 4454b4727ac15368882bf9900140174ed1ed5c8e..63fd6e25e811a3538b264edb96e5d30366412a2c 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 @@ -13,11 +13,7 @@ * limitations under the License. */ -let p = ESValue.load('./no_await_js_promise_export').getProperty('p'); -let foo = ESValue.load('./no_await_js_promise_export').getProperty('foo'); -let pFuncCall = ESValue.load('./no_await_js_promise_export').getProperty('pFuncCall'); -let arrowFunc = ESValue.load('./no_await_js_promise_export').getProperty('arrowFunc'); -let pArrowCall = ESValue.load('./no_await_js_promise_export').getProperty('pArrowCall'); +import { p, foo, pFuncCall, arrowFunc, pArrowCall } from "./no_await_js_promise_export"; async function awaitPromise() { return await p.toPromise(); @@ -60,7 +56,7 @@ const exampleObj = { }; (async () => { - console.log("IIFE result:", await p); + console.log("IIFE result:", await p.toPromise()); })(); (async () => { 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 908d63c7c2200bdaaad08d4e0b3920a051552bf1..e83601dd74cdf19e93132d4109945addda867301 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 @@ -16,58 +16,18 @@ "result": [ { "line": 16, - "column": 5, + "column": 1, "endLine": 16, - "endColumn": 70, - "problem": "AnyType", + "endColumn": 89, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 5, - "endLine": 17, - "endColumn": 74, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 86, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 5, - "endLine": 19, - "endColumn": 86, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 88, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 22, "column": 16, - "endLine": 22, + "endLine": 18, "endColumn": 28, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -75,9 +35,9 @@ "severity": "ERROR" }, { - "line": 26, + "line": 22, "column": 16, - "endLine": 26, + "endLine": 22, "endColumn": 33, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -85,9 +45,9 @@ "severity": "ERROR" }, { - "line": 30, + "line": 26, "column": 16, - "endLine": 30, + "endLine": 26, "endColumn": 31, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -98,16 +58,6 @@ "line": 34, "column": 16, "endLine": 34, - "endColumn": 30, - "problem": "LimitedReturnTypeInference", - "suggest": "", - "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", - "severity": "ERROR" - }, - { - "line": 38, - "column": 16, - "endLine": 38, "endColumn": 32, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -115,9 +65,9 @@ "severity": "ERROR" }, { - "line": 43, + "line": 39, "column": 9, - "endLine": 43, + "endLine": 39, "endColumn": 20, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -125,9 +75,9 @@ "severity": "ERROR" }, { - "line": 47, + "line": 43, "column": 13, - "endLine": 49, + "endLine": 45, "endColumn": 4, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -135,9 +85,9 @@ "severity": "ERROR" }, { - "line": 52, + "line": 48, "column": 20, - "endLine": 52, + "endLine": 48, "endColumn": 21, "problem": "ObjectLiteralNoContextType", "suggest": "", @@ -145,9 +95,9 @@ "severity": "ERROR" }, { - "line": 53, + "line": 49, "column": 3, - "endLine": 55, + "endLine": 51, "endColumn": 4, "problem": "ObjectLiteralProperty", "suggest": "", @@ -155,9 +105,9 @@ "severity": "ERROR" }, { - "line": 53, + "line": 49, "column": 9, - "endLine": 53, + "endLine": 49, "endColumn": 18, "problem": "LimitedReturnTypeInference", "suggest": "", @@ -165,9 +115,9 @@ "severity": "ERROR" }, { - "line": 57, + "line": 53, "column": 17, - "endLine": 59, + "endLine": 55, "endColumn": 4, "problem": "LimitedReturnTypeInference", "suggest": "", diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json b/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json index 5f8e3d35ed8db01159f4d98d96c6dcdadc0ce492..eaa20eba2386671ee333872a2868b8c5553fcb23 100644 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json @@ -20,26 +20,6 @@ "endLine": 16, "endColumn": 88, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 605, - "end": 692, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 88 - }, - { - "start": 692, - "end": 692, - "replacementText": "let Foo = ESValue.load('./no_js_instanceof_file.js').getProperty('Foo');\nlet foo = ESValue.load('./no_js_instanceof_file.js').getProperty('foo');\nlet CreatePerson = ESValue.load('./no_js_instanceof_file.js').getProperty('CreatePerson');\nlet a = ESValue.load('./no_js_instanceof_file.js').getProperty('a');\nlet b = ESValue.load('./no_js_instanceof_file.js').getProperty('b');\nlet MyNamespace = ESValue.load('./no_js_instanceof_file.js').getProperty('MyNamespace');", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 88 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" @@ -391,4 +371,4 @@ "severity": "ERROR" } ] -} +} \ No newline at end of file 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 514aa17d73fad1ecf96ea84c512d62f579b4b841..be46340ed8446bf6875928a2076f5ce47394f8d5 100644 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets @@ -13,12 +13,7 @@ * limitations under the License. */ -let Foo = ESValue.load('./no_js_instanceof_file.js').getProperty('Foo'); -let foo = ESValue.load('./no_js_instanceof_file.js').getProperty('foo'); -let CreatePerson = ESValue.load('./no_js_instanceof_file.js').getProperty('CreatePerson'); -let a = ESValue.load('./no_js_instanceof_file.js').getProperty('a'); -let b = ESValue.load('./no_js_instanceof_file.js').getProperty('b'); -let MyNamespace = ESValue.load('./no_js_instanceof_file.js').getProperty('MyNamespace'); +import { Foo, foo, CreatePerson, a , b, MyNamespace } from "./no_js_instanceof_file.js" class Foo1 {} @@ -70,12 +65,12 @@ if(a.isInstanceOf(Array)) { } -if(b().isInstanceOf(Array)) { +if(b.invoke().isInstanceOf(Array)) { } -const myDog: MyNamespace.Dog = new MyNamespace.getProperty("Dog")('Buddy'); +const myDog: MyNamespace.Dog = new MyNamespace.getProperty("getProperty")("getProperty")("getProperty")("getProperty")("getProperty")("getProperty")("getProperty")("getProperty")("getProperty")("Dog")('Buddy'); -if (myDog.isInstanceOf(MyNamespace.Dog)) { +if (myDog.isInstanceOf(MyNamespace.getProperty("Dog"))) { console.log("This is a Dog!"); } \ No newline at end of file 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 e84613a98b0ffcea08f2166fca6dd43a8c79448b..614491fbff0302bbd0e855eec4d722ef2d6c5c68 100644 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json @@ -16,93 +16,73 @@ "result": [ { "line": 16, - "column": 5, + "column": 1, "endLine": 16, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 5, - "endLine": 17, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 5, - "endLine": 18, - "endColumn": 90, - "problem": "AnyType", + "endColumn": 88, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { - "line": 19, - "column": 5, - "endLine": 19, - "endColumn": 68, - "problem": "AnyType", + "line": 64, + "column": 19, + "endLine": 64, + "endColumn": 24, + "problem": "InteropJsObjectExpandStaticInstance", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", "severity": "ERROR" }, { - "line": 20, - "column": 5, - "endLine": 20, - "endColumn": 68, - "problem": "AnyType", + "line": 64, + "column": 19, + "endLine": 64, + "endColumn": 24, + "problem": "ClassAsObjectError", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", "severity": "ERROR" }, { - "line": 21, - "column": 5, - "endLine": 21, - "endColumn": 88, - "problem": "AnyType", + "line": 68, + "column": 28, + "endLine": 68, + "endColumn": 33, + "problem": "InteropJsObjectExpandStaticInstance", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Direct usage of interop JS functions is not supported (arkts-interop-js2s-js-expand-static-instance)", "severity": "ERROR" }, { - "line": 69, - "column": 19, - "endLine": 69, - "endColumn": 24, + "line": 68, + "column": 28, + "endLine": 68, + "endColumn": 33, "problem": "ClassAsObjectError", "suggest": "", "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", "severity": "ERROR" }, { - "line": 73, - "column": 21, - "endLine": 73, - "endColumn": 26, - "problem": "ClassAsObjectError", + "line": 72, + "column": 36, + "endLine": 72, + "endColumn": 59, + "problem": "DynamicCtorCall", "suggest": "", - "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", "severity": "ERROR" }, { - "line": 77, + "line": 72, "column": 36, - "endLine": 77, + "endLine": 72, "endColumn": 59, - "problem": "DynamicCtorCall", + "problem": "InteropObjectProperty", "suggest": "", - "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", "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 1639c66b412dc43d47a5a1f6c9ffe703bc258160..a619d83610fe29ef5e2427badbd66e433ea96bcf 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 @@ -20,26 +20,6 @@ "endLine": 15, "endColumn": 51, "problem": "InterOpImportJs", - "autofix": [ - { - "start": 604, - "end": 654, - "replacementText": "", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 51 - }, - { - "start": 654, - "end": 654, - "replacementText": "let foo = ESValue.load('./unary_operation_js_obj_js.js').getProperty('foo');", - "line": 15, - "column": 1, - "endLine": 15, - "endColumn": 51 - } - ], "suggest": "", "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" 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 2f5119402182c7fb7dd3ff4188c3ced36f307a0f..7fef071bd036dd04adf66fec6acb429e207bbd37 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 @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -let foo = ESValue.load('./unary_operation_js_obj_js.js').getProperty('foo'); +import {foo} from "./unary_operation_js_obj_js.js" +foo.getProperty("num").toNumber(); -foo.getProperty("num").toNumber(); diff --git a/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.json b/ets2panda/linter/test/interop/unary_operation_js_obj.ets.migrate.json index 8ebd88e3904eb9a6a65cbed9738408e716e0f904..0a055b7965f1bf8ab53fa19829d87d9a4e8491bc 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 @@ -16,12 +16,12 @@ "result": [ { "line": 15, - "column": 5, + "column": 1, "endLine": 15, - "endColumn": 76, - "problem": "AnyType", + "endColumn": 51, + "problem": "InterOpImportJs", "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/case_expr.ets.arkts2.json b/ets2panda/linter/test/main/case_expr.ets.arkts2.json index abc2f67950850ae0e8ee1634cee91d1c7cc073f1..44cd6542b5ef56b30ed8d9d729d7a9549071304a 100755 --- a/ets2panda/linter/test/main/case_expr.ets.arkts2.json +++ b/ets2panda/linter/test/main/case_expr.ets.arkts2.json @@ -121,7 +121,7 @@ "endColumn": 12, "problem": "SwitchExpression", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "The switch expression type must be of type number, string or enum (arkts-switch-expr)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/class_as_object.ets.arkts2.json b/ets2panda/linter/test/main/class_as_object.ets.arkts2.json index 461137accaf6240bf2fdf90a6d49561d3c968c57..44a60b85bb81f801a67c7fe752b4a1521a07c780 100644 --- a/ets2panda/linter/test/main/class_as_object.ets.arkts2.json +++ b/ets2panda/linter/test/main/class_as_object.ets.arkts2.json @@ -881,7 +881,7 @@ "endColumn": 12, "problem": "SwitchExpression", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "The switch expression type must be of type number, string or enum (arkts-switch-expr)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/invalid_identifier.ets.arkts2.json b/ets2panda/linter/test/main/invalid_identifier.ets.arkts2.json index 26b266ff8c62d21c13f89816f7c6c37d3b0f7490..5362d5eaba8a5429488bcaec6e3f7478363d9b11 100644 --- a/ets2panda/linter/test/main/invalid_identifier.ets.arkts2.json +++ b/ets2panda/linter/test/main/invalid_identifier.ets.arkts2.json @@ -91,7 +91,7 @@ "endColumn": 13, "problem": "SwitchExpression", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "The switch expression type must be of type number, string or enum (arkts-switch-expr)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/limit_void_type.ets.arkts2.json b/ets2panda/linter/test/main/limit_void_type.ets.arkts2.json index d5851681b3cbccba32d5112080bd44cc294ca6e8..77cf362c1527086e6780739896b50bcf4d9fb6dc 100644 --- a/ets2panda/linter/test/main/limit_void_type.ets.arkts2.json +++ b/ets2panda/linter/test/main/limit_void_type.ets.arkts2.json @@ -1374,16 +1374,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 251, - "column": 11, - "endLine": 251, - "endColumn": 15, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, { "line": 252, "column": 10, diff --git a/ets2panda/linter/test/main/limit_void_type.ets.autofix.json b/ets2panda/linter/test/main/limit_void_type.ets.autofix.json index 60cf6b289814a5d50e03aad0eb99b9634cc3fa9f..d80964b3403d86d70caba07f981713790f4387b4 100644 --- a/ets2panda/linter/test/main/limit_void_type.ets.autofix.json +++ b/ets2panda/linter/test/main/limit_void_type.ets.autofix.json @@ -1715,16 +1715,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 251, - "column": 11, - "endLine": 251, - "endColumn": 15, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, { "line": 252, "column": 10, diff --git a/ets2panda/linter/test/main/limit_void_type.ets.migrate.json b/ets2panda/linter/test/main/limit_void_type.ets.migrate.json index 3644453e029b1f234d75a59250d1cd1efbf4ea60..45016261114b25295b9fbc45da97c51d76361c93 100644 --- a/ets2panda/linter/test/main/limit_void_type.ets.migrate.json +++ b/ets2panda/linter/test/main/limit_void_type.ets.migrate.json @@ -1074,16 +1074,6 @@ "rule": "Type \"void\" has no instances.(arkts-limited-void-type)", "severity": "ERROR" }, - { - "line": 262, - "column": 11, - "endLine": 262, - "endColumn": 15, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, { "line": 263, "column": 10, diff --git a/ets2panda/linter/test/main/swicth_expr.ets b/ets2panda/linter/test/main/swicth_expr.ets index 45055cf2effb98cfa502ee3854ea24d1305b1372..f44ab3e8e278572230b170104e0cbdd99d03e9c1 100755 --- a/ets2panda/linter/test/main/swicth_expr.ets +++ b/ets2panda/linter/test/main/swicth_expr.ets @@ -193,7 +193,6 @@ switch (num1) { console.log('Other number'); } -1.0 let num111 = 1.0; switch (num111) { case 1.0: @@ -230,7 +229,7 @@ switch (isnum1) { default: console.log('F'); } -// 整型 5.2fail + type sw1 = number function FunSw4(): sw1 { @@ -245,7 +244,6 @@ switch (FunSw4()) { console.log('F'); } -// 浮点 5.2fail type sw2 = number | string function FunSw5(): sw2 { @@ -299,7 +297,6 @@ switch (FunSw2()) { console.log('F'); } -// 正无穷 let number4 = Infinity; switch (number4) { case Infinity: @@ -309,7 +306,6 @@ switch (number4) { console.log("Default case"); } -// 负无穷 let number5 = -Infinity; switch (number5) { case -Infinity: @@ -319,7 +315,6 @@ switch (number5) { console.log("Default case"); } -// NaN let number6 = NaN; switch (number6) { case NaN: @@ -338,7 +333,6 @@ switch (num111) { console.log('Other number'); } -// let声明整型,case浮点 let number33: number = 1; switch (number33) { case 1.1: @@ -354,7 +348,6 @@ switch (number33) { console.log("Default case"); } -// const声明,整型number,有类型 const num11: number = 2; switch (num11) { case 1: { @@ -367,7 +360,6 @@ switch (num11) { } } -// let声明,整型number,有类型 let num00: number = 2; switch (num00) { case 1: { @@ -380,7 +372,6 @@ switch (num00) { } } - enum Direction1 { North, South, @@ -390,7 +381,7 @@ enum Direction1 { function funSE() : string | Direction1 { return 'aaa' } -switch (funSE()) { // 误报 +switch (funSE()) { case 'aaa': console.log('aaa'); break; @@ -401,14 +392,20 @@ switch (funSE()) { // 误报 console.log('F'); } - enum H { RED, BLUE } -function foo11(e: H) { // 误报 +function foo11(e: H) { switch (e) { case H.RED: } } +function foo(index: number) { + switch (index) { + case 0: + break; + } +} + diff --git a/ets2panda/linter/test/main/swicth_expr.ets.arkts2.json b/ets2panda/linter/test/main/swicth_expr.ets.arkts2.json index 207e0d7ebf74d0b53f12ef7ce8e7538c45e99f3e..3fbbc5b9b538f022d1af56aaa7a7b92d148f2579 100755 --- a/ets2panda/linter/test/main/swicth_expr.ets.arkts2.json +++ b/ets2panda/linter/test/main/swicth_expr.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 15, "problem": "SwitchExpression", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "The switch expression type must be of type number, string or enum (arkts-switch-expr)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 17, "problem": "SwitchExpression", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "The switch expression type must be of type number, string or enum (arkts-switch-expr)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 19, "problem": "SwitchExpression", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "The switch expression type must be of type number, string or enum (arkts-switch-expr)", "severity": "ERROR" }, { @@ -221,7 +221,7 @@ "endColumn": 16, "problem": "SwitchExpression", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "The switch expression type must be of type number, string or enum (arkts-switch-expr)", "severity": "ERROR" }, { @@ -244,16 +244,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 91, - "column": 9, - "endLine": 91, - "endColumn": 16, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, { "line": 95, "column": 8, @@ -274,16 +264,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 101, - "column": 9, - "endLine": 101, - "endColumn": 16, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, { "line": 105, "column": 8, @@ -311,7 +291,7 @@ "endColumn": 12, "problem": "SwitchExpression", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "The switch expression type must be of type number, string or enum (arkts-switch-expr)", "severity": "ERROR" }, { @@ -394,16 +374,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 140, - "column": 11, - "endLine": 140, - "endColumn": 19, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, { "line": 141, "column": 10, @@ -434,16 +404,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 152, - "column": 9, - "endLine": 152, - "endColumn": 14, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, { "line": 153, "column": 8, @@ -514,16 +474,6 @@ "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, - { - "line": 176, - "column": 9, - "endLine": 176, - "endColumn": 14, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, { "line": 177, "column": 8, @@ -575,9 +525,9 @@ "severity": "ERROR" }, { - "line": 197, + "line": 196, "column": 5, - "endLine": 197, + "endLine": 196, "endColumn": 17, "problem": "NumericSemantics", "suggest": "", @@ -585,19 +535,9 @@ "severity": "ERROR" }, { - "line": 198, - "column": 9, - "endLine": 198, - "endColumn": 15, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 206, + "line": 205, "column": 7, - "endLine": 206, + "endLine": 205, "endColumn": 22, "problem": "NumericSemantics", "suggest": "", @@ -605,9 +545,9 @@ "severity": "ERROR" }, { - "line": 206, + "line": 205, "column": 19, - "endLine": 206, + "endLine": 205, "endColumn": 22, "problem": "NumericSemantics", "suggest": "", @@ -615,9 +555,9 @@ "severity": "ERROR" }, { - "line": 208, + "line": 207, "column": 8, - "endLine": 208, + "endLine": 207, "endColumn": 9, "problem": "NumericSemantics", "suggest": "", @@ -625,9 +565,9 @@ "severity": "ERROR" }, { - "line": 211, + "line": 210, "column": 8, - "endLine": 211, + "endLine": 210, "endColumn": 9, "problem": "NumericSemantics", "suggest": "", @@ -635,9 +575,9 @@ "severity": "ERROR" }, { - "line": 216, + "line": 215, "column": 13, - "endLine": 216, + "endLine": 215, "endColumn": 32, "problem": "CreatingPrimitiveTypes", "suggest": "", @@ -645,9 +585,9 @@ "severity": "ERROR" }, { - "line": 225, + "line": 224, "column": 31, - "endLine": 225, + "endLine": 224, "endColumn": 32, "problem": "NumericSemantics", "suggest": "", @@ -655,19 +595,9 @@ "severity": "ERROR" }, { - "line": 226, - "column": 9, - "endLine": 226, - "endColumn": 15, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 237, + "line": 236, "column": 10, - "endLine": 237, + "endLine": 236, "endColumn": 11, "problem": "NumericSemantics", "suggest": "", @@ -676,18 +606,8 @@ }, { "line": 240, - "column": 9, - "endLine": 240, - "endColumn": 17, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 241, "column": 8, - "endLine": 241, + "endLine": 240, "endColumn": 9, "problem": "NumericSemantics", "suggest": "", @@ -695,19 +615,9 @@ "severity": "ERROR" }, { - "line": 255, - "column": 9, - "endLine": 255, - "endColumn": 17, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 263, + "line": 261, "column": 5, - "endLine": 263, + "endLine": 261, "endColumn": 30, "problem": "NumericSemantics", "suggest": "", @@ -715,29 +625,9 @@ "severity": "ERROR" }, { - "line": 264, - "column": 9, - "endLine": 264, - "endColumn": 16, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 271, + "line": 269, "column": 9, - "endLine": 271, - "endColumn": 17, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 271, - "column": 9, - "endLine": 271, + "endLine": 269, "endColumn": 11, "problem": "NumericSemantics", "suggest": "", @@ -745,9 +635,9 @@ "severity": "ERROR" }, { - "line": 279, + "line": 277, "column": 7, - "endLine": 279, + "endLine": 277, "endColumn": 27, "problem": "NumericSemantics", "suggest": "", @@ -755,9 +645,9 @@ "severity": "ERROR" }, { - "line": 279, + "line": 277, "column": 21, - "endLine": 279, + "endLine": 277, "endColumn": 23, "problem": "NumericSemantics", "suggest": "", @@ -765,9 +655,9 @@ "severity": "ERROR" }, { - "line": 279, + "line": 277, "column": 25, - "endLine": 279, + "endLine": 277, "endColumn": 26, "problem": "NumericSemantics", "suggest": "", @@ -775,19 +665,9 @@ "severity": "ERROR" }, { - "line": 280, - "column": 9, - "endLine": 280, - "endColumn": 16, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 281, + "line": 279, "column": 8, - "endLine": 281, + "endLine": 279, "endColumn": 10, "problem": "NumericSemantics", "suggest": "", @@ -795,9 +675,9 @@ "severity": "ERROR" }, { - "line": 284, + "line": 282, "column": 8, - "endLine": 284, + "endLine": 282, "endColumn": 10, "problem": "NumericSemantics", "suggest": "", @@ -805,19 +685,9 @@ "severity": "ERROR" }, { - "line": 294, - "column": 9, - "endLine": 294, - "endColumn": 17, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 303, + "line": 300, "column": 5, - "endLine": 303, + "endLine": 300, "endColumn": 23, "problem": "NumericSemantics", "suggest": "", @@ -825,19 +695,9 @@ "severity": "ERROR" }, { - "line": 304, - "column": 9, - "endLine": 304, - "endColumn": 16, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 313, + "line": 309, "column": 5, - "endLine": 313, + "endLine": 309, "endColumn": 24, "problem": "NumericSemantics", "suggest": "", @@ -845,19 +705,9 @@ "severity": "ERROR" }, { - "line": 314, - "column": 9, - "endLine": 314, - "endColumn": 16, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 323, + "line": 318, "column": 5, - "endLine": 323, + "endLine": 318, "endColumn": 18, "problem": "NumericSemantics", "suggest": "", @@ -865,19 +715,9 @@ "severity": "ERROR" }, { - "line": 324, - "column": 9, - "endLine": 324, - "endColumn": 16, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 332, + "line": 327, "column": 5, - "endLine": 332, + "endLine": 327, "endColumn": 17, "problem": "NumericSemantics", "suggest": "", @@ -885,19 +725,9 @@ "severity": "ERROR" }, { - "line": 333, - "column": 9, - "endLine": 333, - "endColumn": 15, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 342, + "line": 336, "column": 24, - "endLine": 342, + "endLine": 336, "endColumn": 25, "problem": "NumericSemantics", "suggest": "", @@ -905,19 +735,9 @@ "severity": "ERROR" }, { - "line": 343, - "column": 9, - "endLine": 343, - "endColumn": 17, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 347, + "line": 341, "column": 8, - "endLine": 347, + "endLine": 341, "endColumn": 9, "problem": "NumericSemantics", "suggest": "", @@ -925,9 +745,9 @@ "severity": "ERROR" }, { - "line": 350, + "line": 344, "column": 8, - "endLine": 350, + "endLine": 344, "endColumn": 9, "problem": "NumericSemantics", "suggest": "", @@ -935,9 +755,9 @@ "severity": "ERROR" }, { - "line": 358, + "line": 351, "column": 23, - "endLine": 358, + "endLine": 351, "endColumn": 24, "problem": "NumericSemantics", "suggest": "", @@ -945,19 +765,9 @@ "severity": "ERROR" }, { - "line": 359, - "column": 9, - "endLine": 359, - "endColumn": 14, - "problem": "SwitchExpression", - "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", - "severity": "ERROR" - }, - { - "line": 360, + "line": 353, "column": 8, - "endLine": 360, + "endLine": 353, "endColumn": 9, "problem": "NumericSemantics", "suggest": "", @@ -965,9 +775,9 @@ "severity": "ERROR" }, { - "line": 364, + "line": 357, "column": 8, - "endLine": 364, + "endLine": 357, "endColumn": 9, "problem": "NumericSemantics", "suggest": "", @@ -975,9 +785,9 @@ "severity": "ERROR" }, { - "line": 371, + "line": 363, "column": 21, - "endLine": 371, + "endLine": 363, "endColumn": 22, "problem": "NumericSemantics", "suggest": "", @@ -985,19 +795,19 @@ "severity": "ERROR" }, { - "line": 372, - "column": 9, - "endLine": 372, - "endColumn": 14, - "problem": "SwitchExpression", + "line": 365, + "column": 8, + "endLine": 365, + "endColumn": 9, + "problem": "NumericSemantics", "suggest": "", - "rule": "The switch expression type must be of type char, byte, short, int, long, string or enum (arkts-switch-expr)", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", "severity": "ERROR" }, { - "line": 373, + "line": 369, "column": 8, - "endLine": 373, + "endLine": 369, "endColumn": 9, "problem": "NumericSemantics", "suggest": "", @@ -1005,10 +815,10 @@ "severity": "ERROR" }, { - "line": 377, - "column": 8, - "endLine": 377, - "endColumn": 9, + "line": 407, + "column": 10, + "endLine": 407, + "endColumn": 11, "problem": "NumericSemantics", "suggest": "", "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)",