diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 6b8010a45d5bde99cd24576b3b2dc12bb04d2776..88ff119f47168436a96177cd5bc43455096ee05a 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -1828,61 +1828,48 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!this.options.arkts2) { return; } + + // Safeguard: only process the outermost property access, not nested chains + if (ts.isPropertyAccessExpression(propertyAccessNode.parent)) { + return; + } + const baseExprType = this.tsTypeChecker.getTypeAtLocation(propertyAccessNode.expression); const baseExprSym = baseExprType.aliasSymbol || baseExprType.getSymbol(); const symbolName = baseExprSym ? baseExprSym.name : this.tsTypeChecker.typeToString(baseExprType); + if (!baseExprType.isUnion() || COMMON_UNION_MEMBER_ACCESS_WHITELIST.has(symbolName)) { return; } - const allType = baseExprType.types; - const commonPropertyType = allType.filter((type) => { - return this.tsUtils.findProperty(type, propertyAccessNode.name.getText()) !== undefined; + + const allTypes = baseExprType.types; + const propName = propertyAccessNode.name.getText(); + + // Only keep union members that have the property + const typesWithProp = allTypes.filter((type) => { + return this.tsUtils.findProperty(type, propName) !== undefined; }); - const typeMap = new Map(); - if (commonPropertyType.length === allType.length) { - allType.forEach((type) => { - this.handleTypeMember(type, propertyAccessNode.name.getText(), typeMap); - }); - if (typeMap.size > 1) { - this.incrementCounters(propertyAccessNode, FaultID.AvoidUnionTypes); - } - } - } - private handleTypeMember( - type: ts.Type, - memberName: string, - typeMap: Map - ): void { - const propertySymbol = this.tsUtils.findProperty(type, memberName); - if (!propertySymbol?.declarations) { - return; - } - const propertyType = this.tsTypeChecker.getTypeOfSymbolAtLocation(propertySymbol, propertySymbol.declarations[0]); - const symbol = propertySymbol.valueDeclaration; - if (!symbol) { + if (typesWithProp.length !== allTypes.length) { + // Not all members have this property, nothing to check return; } - if (ts.isMethodDeclaration(symbol)) { - const returnType = this.getMethodReturnType(propertySymbol); - typeMap.set(returnType, memberName); - } else { - typeMap.set(propertyType, memberName); - } - } - private getMethodReturnType(symbol: ts.Symbol): string | undefined { - const declaration = symbol.valueDeclaration ?? (symbol.declarations?.[0] as ts.Node | undefined); - if (!declaration) { - return undefined; + // Extract the type of the property for each member + const propTypes: string[] = []; + for (const t of typesWithProp) { + const propSym = this.tsUtils.findProperty(t, propName); + if (propSym) { + const propType = this.tsTypeChecker.getTypeOfSymbolAtLocation(propSym, propertyAccessNode); + propTypes.push(this.tsTypeChecker.typeToString(propType)); + } } - const methodType = this.tsTypeChecker.getTypeOfSymbolAtLocation(symbol, declaration); - const signatures = methodType.getCallSignatures(); - if (signatures.length === 0) { - return 'void'; + + // If there's more than one distinct property type signature, flag it + const distinctPropTypes = new Set(propTypes); + if (distinctPropTypes.size > 1) { + this.incrementCounters(propertyAccessNode, FaultID.AvoidUnionTypes); } - const returnType = signatures[0].getReturnType(); - return this.tsTypeChecker.typeToString(returnType); } private handleLiteralAsPropertyName(node: ts.PropertyDeclaration | ts.PropertySignature): void { @@ -6283,6 +6270,66 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.checkAssignmentMatching(tsArg, tsParamType, tsArg); } } + this.checkOnClickCallback(tsCallOrNewExpr); + } + +private checkOnClickCallback(tsCallOrNewExpr: ts.CallExpression | ts.NewExpression): void { + if (!tsCallOrNewExpr.arguments || tsCallOrNewExpr.arguments.length === 0 && this.options.arkts2) { + return; + } + + const isOnClick = + ts.isPropertyAccessExpression(tsCallOrNewExpr.expression) && tsCallOrNewExpr.expression.name.text === 'onClick'; + if (!isOnClick) { + return; + } + + const objType = this.tsTypeChecker.getTypeAtLocation(tsCallOrNewExpr.expression.expression); + const declNode = TsUtils.getDeclaration(objType.getSymbol()); + if (declNode) { + const fileName = declNode.getSourceFile().fileName; + if (!fileName.includes('@ohos/')) { + return; + } + } + + const callback = tsCallOrNewExpr.arguments[0]; + if (!ts.isArrowFunction(callback)) { + return; + } + + this.checkAsyncOrPromiseFunction(callback); + } + + private checkAsyncOrPromiseFunction(callback: ts.ArrowFunction): void { + const returnsPromise = this.checkReturnsPromise(callback); + const isAsync = callback.modifiers?.some((m) => { + return m.kind === ts.SyntaxKind.AsyncKeyword; + }); + + if (isAsync || returnsPromise) { + const startPos = callback.modifiers?.[0]?.getStart() ?? callback.getStart(); + const endPos = callback.body.getEnd(); + + const errorNode = { + getStart: () => { return startPos; }, + getEnd: () => { return endPos; }, + getSourceFile: () => { return callback.getSourceFile(); } + } as ts.Node; + + this.incrementCounters(errorNode, FaultID.IncompationbleFunctionType); + } + } + + private checkReturnsPromise(callback: ts.ArrowFunction): boolean { + const callbackType = this.tsTypeChecker.getTypeAtLocation(callback); + const signatures = this.tsTypeChecker.getSignaturesOfType(callbackType, ts.SignatureKind.Call); + if (signatures.length === 0) { + return false; + } + + const returnType = this.tsTypeChecker.getReturnTypeOfSignature(signatures[0]); + return !!returnType.getProperty('then'); } private static readonly LimitedApis = new Map | null; fault: FaultID }>([ @@ -11135,6 +11182,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { errorMsg = `The "${name}" in SDK is no longer supported.(sdk-method-not-supported)`; } else if (faultID === FaultID.SdkCommonApiBehaviorChange) { errorMsg = `The "${name}" in SDK has been changed.(sdk-method-changed)`; + } else if (faultID === FaultID.NoDeprecatedApi) { + errorMsg = `The ArkUI interface "${name}" is deprecated (arkui-deprecated-interface)`; } return errorMsg; } @@ -11960,11 +12009,8 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private isTargetStorageType(storage: ts.Identifier, targetTypes: string[]): boolean { const decl = this.tsUtils.getDeclarationNode(storage); - if (!decl) { - if (targetTypes.includes(storage.getText())) { - return true; - } - return false; + if (!decl || decl.getSourceFile() !== storage.getSourceFile()) { + return targetTypes.includes(storage.getText()); } if (!ts.isVariableDeclaration(decl)) { @@ -14131,7 +14177,9 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { name, faultID, isSdkCommon || apiType === BUILTIN_TYPE ? undefined : autofix, - isSdkCommon ? TypeScriptLinter.getErrorMsgForSdkCommonApi(name.text, faultID) : undefined + isSdkCommon || apiType === undefined ? + TypeScriptLinter.getErrorMsgForSdkCommonApi(name.text, faultID) : + undefined ); } } @@ -14222,7 +14270,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } if (paramMatch) { - this.incrementCounters(expression, FaultID.NoDeprecatedApi); + this.incrementCounters( + expression, + FaultID.NoDeprecatedApi, + undefined, + TypeScriptLinter.getErrorMsgForSdkCommonApi(expression.getText(), FaultID.NoDeprecatedApi) + ); return; } } @@ -14487,7 +14540,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { errorNode, faultID, isSdkCommon || apiType === BUILTIN_TYPE ? undefined : autofix, - isSdkCommon ? TypeScriptLinter.getErrorMsgForSdkCommonApi(apiName, faultID) : undefined + isSdkCommon || apiType === undefined ? TypeScriptLinter.getErrorMsgForSdkCommonApi(apiName, faultID) : undefined ); } } diff --git a/ets2panda/linter/src/lib/autofixes/Autofixer.ts b/ets2panda/linter/src/lib/autofixes/Autofixer.ts index 179b43b46c84ac046e5922a81d4e29bc2c4fb8b5..8fec7929155ac0f77718d1d8be18ce7ddb29172c 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -209,7 +209,6 @@ export class Autofixer { * @param variableDeclarationMap - Map of property names to variable names. * @param newObjectName - Name of the new object to destructure. * @param declarationFlags - Flags for the variable declaration. - * @param printer - TypeScript printer instance. * @param sourceFile - Source file from which the nodes are taken. * @returns The generated destructuring text. */ @@ -217,7 +216,6 @@ export class Autofixer { variableDeclarationMap: Map, newObjectName: string, declarationFlags: ts.NodeFlags, - printer: ts.Printer, sourceFile: ts.SourceFile ): string { let destructElementText: string = ''; @@ -244,7 +242,7 @@ export class Autofixer { ); // Print the variable statement to text and append it - const text = printer.printNode(ts.EmitHint.Unspecified, variableStatement, sourceFile); + const text = this.printer.printNode(ts.EmitHint.Unspecified, variableStatement, sourceFile); destructElementText += text + this.getNewLine(); }); @@ -260,7 +258,7 @@ export class Autofixer { */ private genAutofixForObjDecls( variableDeclaration: ts.VariableDeclaration, - newObjectName: string | undefined, + newObjectName: string, destructElementText: string, isIdentifier: boolean ): Autofix[] | undefined { @@ -279,7 +277,7 @@ export class Autofixer { } else { // Create autofix suggestions for both variable name and destructuring variableNameReplaceText = { - replacementText: newObjectName as string, + replacementText: newObjectName, start: variableDeclaration.name.getStart(), end: variableDeclaration.name.getEnd() }; @@ -301,18 +299,18 @@ export class Autofixer { * @param variableDeclaration - The variable or parameter declaration to check for boundary conditions. * @returns A boolean indicating if the declaration passes the boundary checks. */ - private static passBoundaryCheckForObjDecls(variableDeclaration: ts.VariableDeclaration): boolean { + private static passBoundaryCheckForObjDecls(bindingPattern: ts.BindingPattern, intializer: ts.Expression): boolean { // Check if the fault ID is for a destructuring parameter or if the declaration has a spread operator if ( - TsUtils.destructuringDeclarationHasSpreadOperator(variableDeclaration.name as ts.BindingPattern) || - TsUtils.destructuringDeclarationHasDefaultValue(variableDeclaration.name as ts.BindingPattern) + TsUtils.destructuringDeclarationHasSpreadOperator(bindingPattern) || + TsUtils.destructuringDeclarationHasDefaultValue(bindingPattern) ) { return false; } // If the initializer is an object literal expression, check its properties - if (ts.isObjectLiteralExpression(variableDeclaration.initializer as ts.Node)) { - const len = (variableDeclaration.initializer as ts.ObjectLiteralExpression).properties.length; + if (ts.isObjectLiteralExpression(intializer)) { + const len = intializer.properties.length; if (len === 0) { // Return false if there are no properties return false; @@ -330,24 +328,32 @@ export class Autofixer { * @returns Array of autofix suggestions or undefined. */ fixObjectBindingPatternDeclarations(variableDeclaration: ts.VariableDeclaration): Autofix[] | undefined { - if (!Autofixer.passBoundaryCheckForObjDecls(variableDeclaration)) { + if (!ts.isObjectBindingPattern(variableDeclaration.name) || !variableDeclaration.initializer) { + return undefined; + } + + if (!Autofixer.passBoundaryCheckForObjDecls(variableDeclaration.name, variableDeclaration.initializer)) { return undefined; } + // Map to hold variable names and their corresponding property names const variableDeclarationMap: Map = new Map(); - // If the declaration is an object binding pattern, extract names - if (ts.isObjectBindingPattern(variableDeclaration.name)) { - variableDeclaration.name.elements.forEach((element) => { - if (!element.propertyName) { - variableDeclarationMap.set(element.name.getText(), element.name.getText()); - } else { - variableDeclarationMap.set((element.propertyName as ts.Identifier).text, element.name.getText()); + + // Extract property names + for (const element of variableDeclaration.name.elements) { + if (!element.propertyName) { + variableDeclarationMap.set(element.name.getText(), element.name.getText()); + } else { + if (!ts.isIdentifier(element.propertyName)) { + return undefined; } - }); + variableDeclarationMap.set(element.propertyName.text, element.name.getText()); + } } const sourceFile = variableDeclaration.getSourceFile(); let newObjectName: string | undefined; - const isIdentifier = ts.isIdentifier(variableDeclaration.initializer as ts.Node); + const isIdentifier = ts.isIdentifier(variableDeclaration.initializer); + // If it is identifer, use its text as the new object name; otherwise, generate a unique name if (isIdentifier) { newObjectName = variableDeclaration.initializer?.getText(); @@ -362,7 +368,6 @@ export class Autofixer { variableDeclarationMap, newObjectName, declarationFlags, - this.printer, sourceFile ); @@ -375,7 +380,6 @@ export class Autofixer { * @param variableNames - Array of variable names corresponding to array elements. * @param newArrayName - Name of the new array to destructure. * @param declarationFlags - Flags for the variable declaration. - * @param printer - TypeScript printer instance. * @param sourceFile - Source file from which the nodes are taken. * @returns The generated destructuring text. */ @@ -383,7 +387,6 @@ export class Autofixer { variableNames: string[], newArrayName: string, declarationFlags: ts.NodeFlags, - printer: ts.Printer, sourceFile: ts.SourceFile ): string { let destructElementText: string = ''; @@ -414,7 +417,7 @@ export class Autofixer { ); // Print the variable statement to text and append it - const text = printer.printNode(ts.EmitHint.Unspecified, variableStatement, sourceFile); + const text = this.printer.printNode(ts.EmitHint.Unspecified, variableStatement, sourceFile); destructElementText += text + this.getNewLine(); } @@ -430,7 +433,7 @@ export class Autofixer { */ private genAutofixForArrayDecls( variableDeclaration: ts.VariableDeclaration, - newArrayName: string | undefined, + newArrayName: string, destructElementText: string, isIdentifierOrElementAccess: boolean ): Autofix[] { @@ -449,7 +452,7 @@ export class Autofixer { } else { // Create autofix suggestions for both variable name and destructuring variableNameReplaceText = { - replacementText: newArrayName as string, + replacementText: newArrayName, start: variableDeclaration.name.getStart(), end: variableDeclaration.name.getEnd() }; @@ -472,27 +475,28 @@ export class Autofixer { * @returns A boolean indicating if the declaration passes the boundary checks. */ private static passBoundaryCheckForArrayDecls( - variableDeclaration: ts.VariableDeclaration, + bindingPattern: ts.ArrayBindingPattern, + initializer: ts.Expression, isArrayOrTuple: boolean ): boolean { // If it's not an array/tuple or the declaration has a spread operator in destructuring if ( !isArrayOrTuple || - TsUtils.destructuringDeclarationHasSpreadOperator(variableDeclaration.name as ts.BindingPattern) || - TsUtils.destructuringDeclarationHasDefaultValue(variableDeclaration.name as ts.BindingPattern) + TsUtils.destructuringDeclarationHasSpreadOperator(bindingPattern) || + TsUtils.destructuringDeclarationHasDefaultValue(bindingPattern) ) { // Return false if it fails the boundary check return false; } // Check if the array binding pattern has any empty elements - if (TsUtils.checkArrayBindingHasEmptyElement(variableDeclaration.name as ts.ArrayBindingPattern)) { + if (TsUtils.checkArrayBindingHasEmptyElement(bindingPattern)) { // Return false if it contains empty elements return false; } // Check if the initializer has the same dimension as expected - if (!TsUtils.isSameDimension(variableDeclaration.initializer as ts.Node)) { + if (!TsUtils.isSameDimension(initializer)) { return false; } @@ -511,28 +515,29 @@ export class Autofixer { variableDeclaration: ts.VariableDeclaration, isArrayOrTuple: boolean ): Autofix[] | undefined { - if (!Autofixer.passBoundaryCheckForArrayDecls(variableDeclaration, isArrayOrTuple)) { + if (!ts.isArrayBindingPattern(variableDeclaration.name) || !variableDeclaration.initializer) { return undefined; } - const variableNames: string[] = []; - // If the declaration is an array binding pattern, extract variable names - if (ts.isArrayBindingPattern(variableDeclaration.name)) { - variableDeclaration.name.elements.forEach((element) => { - variableNames.push(element.getText()); - }); + if ( + !Autofixer.passBoundaryCheckForArrayDecls( + variableDeclaration.name, + variableDeclaration.initializer, + isArrayOrTuple + ) + ) { + return undefined; } + const variableNames: string[] = Autofixer.getVarNamesFromArrayBindingPattern(variableDeclaration.name); - const sourceFile = variableDeclaration.getSourceFile(); let newArrayName: string | undefined = ''; // Check if the initializer is either an identifier or an element access expression const isIdentifierOrElementAccess = - ts.isIdentifier(variableDeclaration.initializer as ts.Node) || - ts.isElementAccessExpression(variableDeclaration.initializer as ts.Node); + ts.isIdentifier(variableDeclaration.initializer) || ts.isElementAccessExpression(variableDeclaration.initializer); // If it is, use its text as the new array name; otherwise, generate a unique name if (isIdentifierOrElementAccess) { - newArrayName = variableDeclaration.initializer?.getText(); + newArrayName = variableDeclaration.initializer.getText(); } else { - newArrayName = TsUtils.generateUniqueName(this.destructArrayNameGenerator, sourceFile); + newArrayName = TsUtils.generateUniqueName(this.destructArrayNameGenerator, variableDeclaration.getSourceFile()); } if (!newArrayName) { return undefined; @@ -545,8 +550,7 @@ export class Autofixer { variableNames, newArrayName, declarationFlags, - this.printer, - sourceFile + variableDeclaration.getSourceFile() ); // Generate and return autofix suggestions for the array declarations @@ -558,18 +562,26 @@ export class Autofixer { ); } + private static getVarNamesFromArrayBindingPattern(bindingPattern: ts.ArrayBindingPattern): string[] { + const variableNames: string[] = []; + if (ts.isArrayBindingPattern(bindingPattern)) { + bindingPattern.elements.forEach((element) => { + variableNames.push(element.getText()); + }); + } + return variableNames; + } + /** * Generates the text representation for destructuring assignments in an array. * @param variableNames - Array of variable names corresponding to array elements. * @param newArrayName - Name of the new array to use for destructuring. - * @param printer - TypeScript printer instance. * @param sourceFile - Source file from which the nodes are taken. * @returns The generated destructuring assignment text. */ private genDestructElementTextForArrayAssignment( variableNames: string[], - newArrayName: string | undefined, - printer: ts.Printer, + newArrayName: string, sourceFile: ts.SourceFile ): string { let destructElementText: string = ''; @@ -581,7 +593,7 @@ export class Autofixer { // Create an element access expression for the new array const elementAccessExpr = ts.factory.createElementAccessExpression( - ts.factory.createIdentifier(newArrayName as string), + ts.factory.createIdentifier(newArrayName), ts.factory.createNumericLiteral(i) ); @@ -596,7 +608,7 @@ export class Autofixer { const expressionStatement = ts.factory.createExpressionStatement(assignmentExpr); // Print the expression statement to text and append it - const text = printer.printNode(ts.EmitHint.Unspecified, expressionStatement, sourceFile); + const text = this.printer.printNode(ts.EmitHint.Unspecified, expressionStatement, sourceFile); destructElementText += text + this.getNewLine(); } @@ -612,7 +624,7 @@ export class Autofixer { */ private genAutofixForArrayAssignment( assignmentExpr: ts.BinaryExpression, - newArrayName: string | undefined, + newArrayName: string, destructElementText: string, isIdentifierOrElementAccess: boolean ): Autofix[] { @@ -659,21 +671,21 @@ export class Autofixer { isArrayOrTuple: boolean ): boolean { // Return false if the assignment is not for an array or tuple - if (!isArrayOrTuple) { + if (!isArrayOrTuple || !ts.isArrayLiteralExpression(assignmentExpr.left)) { return false; } // Check if the left side of the assignment is an array literal expression with a spread operator - if (TsUtils.destructuringAssignmentHasSpreadOperator(assignmentExpr.left as ts.ArrayLiteralExpression)) { + if (TsUtils.destructuringAssignmentHasSpreadOperator(assignmentExpr.left)) { return false; } - if (TsUtils.destructuringAssignmentHasDefaultValue(assignmentExpr.left as ts.ArrayLiteralExpression)) { + if (TsUtils.destructuringAssignmentHasDefaultValue(assignmentExpr.left)) { return false; } // Check if the left side of the assignment has an empty element - if (TsUtils.checkArrayLiteralHasEmptyElement(assignmentExpr.left as ts.ArrayLiteralExpression)) { + if (TsUtils.checkArrayLiteralHasEmptyElement(assignmentExpr.left)) { return false; } @@ -710,7 +722,7 @@ export class Autofixer { const sourceFile = assignmentExpr.getSourceFile(); let newArrayName: string | undefined = ''; const isIdentifierOrElementAccess = - ts.isIdentifier(assignmentExpr.right) || ts.isElementAccessExpression(assignmentExpr.right as ts.Node); + ts.isIdentifier(assignmentExpr.right) || ts.isElementAccessExpression(assignmentExpr.right); if (isIdentifierOrElementAccess) { newArrayName = assignmentExpr.right.getText(); } else { @@ -721,12 +733,7 @@ export class Autofixer { } // Generate the text for destructuring assignments - const destructElementText = this.genDestructElementTextForArrayAssignment( - variableNames, - newArrayName, - this.printer, - sourceFile - ); + const destructElementText = this.genDestructElementTextForArrayAssignment(variableNames, newArrayName, sourceFile); return this.genAutofixForArrayAssignment( assignmentExpr, @@ -741,25 +748,29 @@ export class Autofixer { * @param binaryExpr - The binary expression containing the object literal. * @returns An object containing the variable declaration map and needParentheses indicating if property initializers are object literals. */ - private static genTsVarDeclMapAndFlags(binaryExpr: ts.BinaryExpression): { - tsVarDeclMap: Map; - needParentheses: boolean[]; - } { + private static genTsVarDeclMapAndFlags(objLiteralExpr: ts.ObjectLiteralExpression): + | { + tsVarDeclMap: Map; + needParentheses: boolean[]; + } + | undefined { const tsVarDeclMap: Map = new Map(); const needParentheses: boolean[] = []; - // Check if the left side of the binary expression is an object literal - if (ts.isObjectLiteralExpression(binaryExpr.left)) { - binaryExpr.left.properties.forEach((property) => { - // Handle property assignments with initializer - if (ts.isPropertyAssignment(property)) { - tsVarDeclMap.set(property.name?.getText(), property.initializer.getText()); - needParentheses.push(ts.isObjectLiteralExpression(property.initializer)); - } else if (ts.isShorthandPropertyAssignment(property)) { - tsVarDeclMap.set(property.name?.getText(), property.name.getText()); - needParentheses.push(false); - } - }); + for (const property of objLiteralExpr.properties) { + // Handle property assignments with initializer + if (!property.name || !ts.isIdentifier(property.name)) { + return undefined; + } + if (ts.isPropertyAssignment(property)) { + tsVarDeclMap.set(property.name.getText(), property.initializer.getText()); + needParentheses.push(ts.isObjectLiteralExpression(property.initializer)); + } else if (ts.isShorthandPropertyAssignment(property)) { + tsVarDeclMap.set(property.name.getText(), property.name.getText()); + needParentheses.push(false); + } else { + return undefined; + } } return { tsVarDeclMap, needParentheses }; @@ -771,15 +782,13 @@ export class Autofixer { * @param needParentheses - Array of needParentheses indicating if property initializers are object literals. * @param newObjName - The name of the new object to use for destructuring. * @param binaryExpr - The binary expression representing the destructuring. - * @param printer - TypeScript printer instance for printing nodes. * @returns The generated text for destructuring assignments. */ private genDestructElementTextForObjAssignment( tsVarDeclMap: Map, needParentheses: boolean[], newObjName: string, - binaryExpr: ts.BinaryExpression, - printer: ts.Printer + binaryExpr: ts.BinaryExpression ): string { let destructElementText: string = ''; let index: number = 0; @@ -804,7 +813,7 @@ export class Autofixer { // Append the generated text for the destructuring assignment destructElementText += - printer.printNode(ts.EmitHint.Unspecified, statement, binaryExpr.getSourceFile()) + this.getNewLine(); + this.printer.printNode(ts.EmitHint.Unspecified, statement, binaryExpr.getSourceFile()) + this.getNewLine(); index++; }); @@ -816,14 +825,9 @@ export class Autofixer { * Creates the replacement text for the variable declaration name. * @param binaryExpr - The binary expression containing the object literal or call expression. * @param newObjName - The new object name to be used in the replacement. - * @param printer - TypeScript printer instance for printing nodes. * @returns The replacement text for the variable declaration name. */ - private static genDeclNameReplaceTextForObjAssignment( - binaryExpr: ts.BinaryExpression, - newObjName: string, - printer: ts.Printer - ): string { + private genDeclNameReplaceTextForObjAssignment(binaryExpr: ts.BinaryExpression, newObjName: string): string { let declNameReplaceText = ''; // create variableDeclList and get declNameReplaceText text @@ -834,7 +838,7 @@ export class Autofixer { binaryExpr.right ); const variableDeclList = ts.factory.createVariableDeclarationList([variableDecl], ts.NodeFlags.Let); - declNameReplaceText = printer.printNode(ts.EmitHint.Unspecified, variableDeclList, binaryExpr.getSourceFile()); + declNameReplaceText = this.printer.printNode(ts.EmitHint.Unspecified, variableDeclList, binaryExpr.getSourceFile()); return declNameReplaceText; } @@ -888,12 +892,16 @@ export class Autofixer { * @returns A boolean indicating if the assignment passes the boundary checks. */ private static passBoundaryCheckForObjAssignment(binaryExpr: ts.BinaryExpression): boolean { + if (!ts.isObjectLiteralExpression(binaryExpr.left)) { + return false; + } + // Check for spread operator in destructuring assignment on the left side - if (TsUtils.destructuringAssignmentHasSpreadOperator(binaryExpr.left as ts.ObjectLiteralExpression)) { + if (TsUtils.destructuringAssignmentHasSpreadOperator(binaryExpr.left)) { return false; } - if (TsUtils.destructuringAssignmentHasDefaultValue(binaryExpr.left as ts.ObjectLiteralExpression)) { + if (TsUtils.destructuringAssignmentHasDefaultValue(binaryExpr.left)) { return false; } @@ -915,8 +923,18 @@ export class Autofixer { if (!Autofixer.passBoundaryCheckForObjAssignment(binaryExpr)) { return undefined; } + + // Check if the left side of the binary expression is an object literal + if (!ts.isObjectLiteralExpression(binaryExpr.left)) { + return undefined; + } + // Create a mapping of variable declarations and needParentheses - const { tsVarDeclMap, needParentheses } = Autofixer.genTsVarDeclMapAndFlags(binaryExpr); + const varDeclMapFlags = Autofixer.genTsVarDeclMapAndFlags(binaryExpr.left); + if (!varDeclMapFlags) { + return undefined; + } + const { tsVarDeclMap, needParentheses } = varDeclMapFlags; const sourceFile = binaryExpr.getSourceFile(); let newObjName: string | undefined = ''; @@ -935,12 +953,11 @@ export class Autofixer { tsVarDeclMap, needParentheses, newObjName, - binaryExpr, - this.printer + binaryExpr ); // Create the replacement text for the variable declaration name - const declNameReplaceText = Autofixer.genDeclNameReplaceTextForObjAssignment(binaryExpr, newObjName, this.printer); + const declNameReplaceText = this.genDeclNameReplaceTextForObjAssignment(binaryExpr, newObjName); // Generate autofix suggestions return this.createAutofixForObjAssignment(binaryExpr, declNameReplaceText, destructElementText, isIdentifier); diff --git a/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts b/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts index f95f5d338f6a74f4e4c750f916f458696f96dfc3..d4b3959341982d60c6aa5132d6a326adefb2495c 100644 --- a/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts +++ b/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts @@ -1596,6 +1596,7 @@ export const arkuiImportList: Set = new Set([ 'WithThemeOptions', 'WordBreak', 'WorkStateStyle', + 'wrapBuilder', 'WrappedBuilder', 'XComponent', 'XComponentAttribute', diff --git a/ets2panda/linter/src/testRunner/LintTest.ts b/ets2panda/linter/src/testRunner/LintTest.ts index 8661ed7c746ddf2b97345282a0142f07d8e7b1db..a1095833f1cb375a290149dd0c6cc7946bb07dbc 100644 --- a/ets2panda/linter/src/testRunner/LintTest.ts +++ b/ets2panda/linter/src/testRunner/LintTest.ts @@ -61,7 +61,7 @@ export class LintTest { // Get actual test results. const fileProblems = actualLinterResult.problemsInfos.get(path.normalize(this.cmdOptions.inputFiles[0])); if (fileProblems === undefined) { - return true; + return false; } const actualResult = transformProblemInfos(fileProblems, this.testModeProps.mode); diff --git a/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.arkts2.json index 93d213bafa8e0723470f292ac2f5a1f71e6173f4..06b2a341bf7163b7bf8e00222c40cd2842b81e5e 100755 --- a/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/COMPONENT.ets.arkts2.json @@ -31,7 +31,7 @@ "endColumn": 39, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"COMPONENT\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.arkts2.json index ad1e3864f573f4b56f2a05dbed170ca5c1ce596b..b2dbe822307a6b71fd6c0a72ef02539b4c864b9f 100755 --- a/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/EnableAlertBeforeBackPageOptions_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 37, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"enableAlertBeforeBackPage\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/SM.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/SM.ets.arkts2.json index 33ab839a5dd8313a87f7f81654ac162d9f514ace..646dee383ab3576f67433b45f8efef23db9a01f4 100755 --- a/ets2panda/linter/test/deprecatedapi/SM.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/SM.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 39, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 42, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"XS\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 62, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 65, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SM\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json index 16b900fecb275857815e2044bc30597a38856edb..be8eddb1ac5b03715219b01a3dd8d794dc0e43ae 100644 --- a/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/action_sheet.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"show\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.arkts2.json index 3d1c55b24e271445d69594b7aecaa7d67abfae61..f2ee34f04565bd0ef3424458ddaf798c470a3eb2 100644 --- a/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/alert_dialog.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"show\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/animator.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/animator.ets.arkts2.json index 601d9cf1f7e6b6059cdc7d74985aa46b12c7c684..9cc4016ef79548fa28dc05a8907fa2ee20d6ab5b 100644 --- a/ets2panda/linter/test/deprecatedapi/animator.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/animator.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 16, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"create\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.arkts2.json index 5b5712b92bf626b5d87ccd66d963766b6e55a8a6..cc96bf0126b11d0e3e2035e1ccb6d760760bdeaf 100755 --- a/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/appStorageIsMutable_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 40, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"IsMutable\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 35, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Get\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 36, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Clear\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 39, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Delete\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 36, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Size\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json index ab3b8aff134d2166a37a1dbd982dfa6ac5c34a80..1c07495231aef8eb2c4571e13a740802c7474223 100755 --- a/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/appscreenOnVisible_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 24, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"screenOnVisible\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/buttons.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/buttons.ets.arkts2.json index 30ea0fb4ec6c620e25e414e862fa3fbc88bf1fde..ffbd574589f2bc3c8827dab63e3233993effd021 100644 --- a/ets2panda/linter/test/deprecatedapi/buttons.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/buttons.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 18, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"showDialog\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 8, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"title\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 10, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"message\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json index 9c39cd8ef41d7e1f72259701507095a3b222868c..477f1080b2c1d43ffaf34a277a37d8a6e339d5b1 100644 --- a/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/common_api.ets.arkts2.json @@ -31,7 +31,7 @@ "endColumn": 26, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getX\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 46, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 82, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutBorderInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 112, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutChild\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 31, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -91,7 +91,7 @@ "endColumn": 44, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutBorderInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 34, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutChild\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -111,7 +111,7 @@ "endColumn": 24, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutChild\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -121,7 +121,7 @@ "endColumn": 31, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -131,7 +131,7 @@ "endColumn": 54, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutBorderInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -141,7 +141,7 @@ "endColumn": 72, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"TransitionOptions\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -151,7 +151,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -161,7 +161,7 @@ "endColumn": 42, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"TransitionOptions\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -201,7 +201,7 @@ "endColumn": 11, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"onLayout\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -211,7 +211,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutChild\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -221,7 +221,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutChild\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -251,7 +251,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"onMeasure\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -261,7 +261,7 @@ "endColumn": 34, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutChild\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -281,7 +281,7 @@ "endColumn": 30, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getX\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -291,7 +291,7 @@ "endColumn": 38, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getY\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -311,7 +311,7 @@ "endColumn": 38, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getY\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -321,7 +321,7 @@ "endColumn": 46, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getY\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -341,7 +341,7 @@ "endColumn": 32, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getX\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -351,7 +351,7 @@ "endColumn": 32, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getY\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -381,7 +381,7 @@ "endColumn": 39, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutChild\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -401,7 +401,7 @@ "endColumn": 47, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LayoutBorderInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.arkts2.json index 555d6690d418d64cd855d7837922bc925c0a88aa..73c734b101ff3b97d044ac4ea32218757e67bd84 100644 --- a/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/common_ts_ets_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 40, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getShared\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.arkts2.json index 0a1fb129d6c53deb03dc937329239d8e0ce9a082..7adf5115af630830722e70fef7249a45633787b4 100755 --- a/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/curvesInit_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"init\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json index a57cc4ca007a717c3187339280a457e970aa2ea2..57081a47c2217e4f25a90699423436d4601ad758 100755 --- a/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/custom_api.ets.arkts2.json @@ -13,7 +13,7 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ + "result": [ { "line": 17, "column": 1, @@ -31,7 +31,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PanelType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 29, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"CUSTOM\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -94,5 +94,5 @@ "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" } - ] -} + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json index 38f8794a0f4157e6fcb09e20aded87e6ea6145a4..6b41b86aa510caf626c626da085527ef05ff78a9 100644 --- a/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_font.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 48, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getFontByName\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"registerFont\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 46, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getFontByName\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 49, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getSystemFontList\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 28, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"registerFont\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.arkts2.json index 8759d20f2084cd8a75d1fd512b4e5a8235c0d5eb..3ed0edea9e804fc1d347a454938e3db7e1922898 100755 --- a/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/deprecated_api_router.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 37, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"enableAlertBeforeBackPage\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 17, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"clear\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.arkts2.json index 55aa23cb17ccc8da1522a8bbe65c63451179533f..e7d32ce03d923653ccef1f66aa18b722903d6c7d 100755 --- a/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/environmentEnvProp_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 20, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"EnvProp\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 43, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Keys\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 21, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"EnvProps\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json index 9ecb29181d94fbbfb051715976d110dbef378032..272fe50def471bbabb32a1bf52a4a284ea93ea1b 100755 --- a/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/foldable_api.ets.arkts2.json @@ -13,7 +13,7 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ + "result": [ { "line": 17, "column": 1, @@ -31,7 +31,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PanelType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 31, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Foldable\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -94,5 +94,5 @@ "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" } - ] -} + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/listitem_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/listitem_api.ets.arkts2.json index 8dc40943635be1ca1b0deaacbf30e75b16adf13d..bc005af887f5478332049bcd25dfcb26498f07ef 100755 --- a/ets2panda/linter/test/deprecatedapi/listitem_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/listitem_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Sticky\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 31, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"EditMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.arkts2.json index 2f8cfb118ff3b1ff653a98ded47d738e3ff34d22..7eaba6bdbb881c0bb98b8a76b31a7e032de7dcef 100755 --- a/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/matrix4Rotate_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 35, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"rotate\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"copy\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 38, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"translate\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json index 54931525a0ddd30f0a0e2c2ae2d1a8f9808892e3..c6074fab7b1f09c089ea282b9938c4b649a92181 100755 --- a/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/minibar_api.ets.arkts2.json @@ -13,7 +13,7 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ + "result": [ { "line": 17, "column": 1, @@ -31,7 +31,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PanelType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 30, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Minibar\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -94,5 +94,5 @@ "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" } - ] -} + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json index 4694d18e5bbb513d4ee2afaf7c78e40cc4c7a613..d89f2a2fbfd985b33e98eb47ee0b06f973e70d9f 100755 --- a/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/navigator_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 34, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavigatorAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 36, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavigatorAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 18, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"active\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavigatorAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 16, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Navigator\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 44, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavigatorAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -81,7 +81,7 @@ "endColumn": 20, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"target\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 31, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"active\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.arkts2.json index bbfdaf93fa58ed13e4e485222fdb3018bd1a809d..57e21154938a7df953c23043da19152c49d91ca2 100755 --- a/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/navrouter_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 14, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"mode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 16, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouter\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouteMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 46, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PUSH_WITH_RECREATE\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 23, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"onStateChange\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 14, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"mode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -81,7 +81,7 @@ "endColumn": 16, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouter\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -91,7 +91,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"name\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 31, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"param\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -111,7 +111,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouteMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -121,7 +121,7 @@ "endColumn": 46, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PUSH_WITH_RECREATE\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -131,7 +131,7 @@ "endColumn": 35, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouteMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -141,7 +141,7 @@ "endColumn": 43, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"REPLACE\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -151,7 +151,7 @@ "endColumn": 46, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouterAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -161,7 +161,7 @@ "endColumn": 20, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"mode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -171,7 +171,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouteMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -181,7 +181,7 @@ "endColumn": 38, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PUSH\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -191,7 +191,7 @@ "endColumn": 29, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"mode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -201,7 +201,7 @@ "endColumn": 42, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouteMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -211,7 +211,7 @@ "endColumn": 50, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"REPLACE\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -221,7 +221,7 @@ "endColumn": 41, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouterInterface\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -251,7 +251,7 @@ "endColumn": 32, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouterAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -281,7 +281,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"RouteInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -291,7 +291,7 @@ "endColumn": 48, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouterAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -331,7 +331,7 @@ "endColumn": 28, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"RouteInfo\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -351,7 +351,7 @@ "endColumn": 49, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouterAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -361,7 +361,7 @@ "endColumn": 40, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouterAttribute\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -371,7 +371,7 @@ "endColumn": 42, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NavRouterInterface\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/node_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/node_api.ets.arkts2.json index e2ed9c2a93b7bcf0b68f02b1f142c3305662a9a1..def7da8f2c60645bd2886b05b83bcf743e98ac33 100755 --- a/ets2panda/linter/test/deprecatedapi/node_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/node_api.ets.arkts2.json @@ -13,7 +13,7 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ + "result": [ { "line": 21, "column": 33, @@ -21,7 +21,7 @@ "endColumn": 37, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"NODE\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -64,5 +64,5 @@ "rule": "The ArkUI interface \"XComponent\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" } - ] -} + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json index 14b1f5d64ed0337c3e6cf82d87d38534c143dd7d..ef40455b9ca93add729f1161ae55b785aa6a5fd9 100755 --- a/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/panelModePanelMode_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PanelMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Mini\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PanelMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Half\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PanelMode\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Full\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.arkts2.json index 61e8ea37dee70895b1bd001f176eee32fac878c5..561f0d678b154d1fde55286eec533cfcb4d76ddc 100755 --- a/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/persistentStoragePersistProps_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 31, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PersistProps\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 23, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Keys\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/prompts_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/prompts_api.ets.arkts2.json index 9e241a57f70231f96bafb12e59c8b117d0921d72..53b184dcb966ec450771389dd29ba611f0d9032f 100755 --- a/ets2panda/linter/test/deprecatedapi/prompts_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/prompts_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 17, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"showToast\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 10, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"message\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 11, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"duration\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 9, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"bottom\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 18, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"showDialog\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 8, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"title\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -81,7 +81,7 @@ "endColumn": 10, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"message\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -91,7 +91,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"showActionMenu\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -111,7 +111,7 @@ "endColumn": 10, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"buttons\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -121,7 +121,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -131,7 +131,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -161,7 +161,7 @@ "endColumn": 18, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"showDialog\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -171,7 +171,7 @@ "endColumn": 8, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"title\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -181,7 +181,7 @@ "endColumn": 10, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"message\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -191,7 +191,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -201,7 +201,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.arkts2.json index 09884303b52f5cf0de482cc38402cd9032d67284..13f2b04663178be67bde27ca94747c32f2bdb666 100755 --- a/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/routerDisableAlertBeforeBackPage_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 38, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"disableAlertBeforeBackPage\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 14, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"success\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 15, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"complete\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 19, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"replace\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 10, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"uri\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 13, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"params\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -81,7 +81,7 @@ "endColumn": 17, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"clear\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.arkts2.json index e5042c31377525a8963469dde8bafa81a3bf65a3..75f13d829815cbb41452b9ed7b8e43405ed67919 100755 --- a/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/routerPush_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"push\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/scroll_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/scroll_api.ets.arkts2.json index f32e2bf1c3875937214427864c21697b2fc00082..9ad6cbf5bf902779eb177fb3292e80dcf9668b37 100755 --- a/ets2panda/linter/test/deprecatedapi/scroll_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/scroll_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 41, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Free\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.arkts2.json index 92cf38ee6673ac32b54d0d4cf15deb4e6156e0ee..bb10d761e7eb77663d69e7523a373aee0ad44330 100755 --- a/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/setImageCacheCount_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"setImageCacheCount\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.arkts2.json index d8b65d5c64f13d2cb16a0e78186c9e5f14b6841b..b9b2d94b66338c813a90c14f0767b39ef89f0d72 100755 --- a/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/setImageFileCacheSize_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 30, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"setImageFileCacheSize\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.arkts2.json index bb45649496482f8514ba5c577a628ab55e4cacf1..5238aea41b95937f9844932222072371071f044c 100755 --- a/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/setImageRawDataCacheSize_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"setImageRawDataCacheSize\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.arkts2.json index b44f2449617b1c6218a3775622194c04a81f140f..3ac87ce66de491252a590c825b39070358234778 100755 --- a/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/showActionMenu.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"showActionMenu\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 10, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"buttons\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -81,7 +81,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"showActionMenu\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -91,7 +91,7 @@ "endColumn": 10, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"buttons\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -111,7 +111,7 @@ "endColumn": 12, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/sizeType.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/sizeType.ets.arkts2.json index feb77417ccc03f9ddf3d229d027e01be35dad395..832bb8301efdd620dca298bef2bb5fc0143a93a6 100644 --- a/ets2panda/linter/test/deprecatedapi/sizeType.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/sizeType.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 39, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 42, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"XS\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 37, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 40, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"XS\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 37, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 40, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SM\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -81,7 +81,7 @@ "endColumn": 37, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -91,7 +91,7 @@ "endColumn": 40, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"MD\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 37, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -111,7 +111,7 @@ "endColumn": 40, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"LG\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.arkts2.json index 969b9eb44b53b8bd38a164e1786f39e7e95d0428..be4383aba184430630271ac83b69e622038b2be9 100755 --- a/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/sizeTypeXS_api.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 71, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -31,7 +31,7 @@ "endColumn": 74, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SM\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 44, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"SizeType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 47, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"XS\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json index 6423f82bd7d7de0c797c56e9166fac93d8556498..3799eb68a19549246cf75b3ad5d5c2d6a045b7a9 100755 --- a/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/swiper_api.ets.arkts2.json @@ -31,7 +31,7 @@ "endColumn": 51, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"IndicatorStyle\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 29, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"IndicatorStyle\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -51,7 +51,7 @@ "endColumn": 39, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"IndicatorStyle\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -61,7 +61,7 @@ "endColumn": 23, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"top\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -71,7 +71,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -81,7 +81,7 @@ "endColumn": 26, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"bottom\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -91,7 +91,7 @@ "endColumn": 52, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Stretch\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -101,7 +101,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"left\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -111,7 +111,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"right\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -121,7 +121,7 @@ "endColumn": 27, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"color\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -131,7 +131,7 @@ "endColumn": 36, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"selectedColor\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -141,7 +141,7 @@ "endColumn": 25, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"mask\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -151,7 +151,7 @@ "endColumn": 28, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"bottom\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -161,7 +161,7 @@ "endColumn": 37, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"IndicatorStyle\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -171,7 +171,7 @@ "endColumn": 21, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"size\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -181,7 +181,7 @@ "endColumn": 43, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"IndicatorStyle\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -191,7 +191,7 @@ "endColumn": 18, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"top\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -211,7 +211,7 @@ "endColumn": 31, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"bottom\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -221,7 +221,7 @@ "endColumn": 33, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"bottom\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -231,7 +231,7 @@ "endColumn": 50, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"AutoLinear\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -241,7 +241,7 @@ "endColumn": 35, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Stretch\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -251,7 +251,7 @@ "endColumn": 39, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"AUTO_LINEAR\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" } ] diff --git a/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json index 6a24afa2aac4d5e054cd450c061e7d3ff0b6969c..e534260a3e278e602efd63462f1f0681a94a76b4 100755 --- a/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/temporary_api.ets.arkts2.json @@ -13,7 +13,7 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ + "result": [ { "line": 17, "column": 1, @@ -31,7 +31,7 @@ "endColumn": 22, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PanelType\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 32, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"Temporary\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -94,5 +94,5 @@ "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" } - ] -} + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json index 2e6eb36ba331904bfaa72a500323fd751ed89a09..65983ca6efc6dee25af56f1f500f5f0abd3f5d66 100755 --- a/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json +++ b/ets2panda/linter/test/deprecatedapi/wrap_content_api.ets.arkts2.json @@ -13,7 +13,7 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ + "result": [ { "line": 17, "column": 1, @@ -31,7 +31,7 @@ "endColumn": 26, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"PanelHeight\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -41,7 +41,7 @@ "endColumn": 39, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"WRAP_CONTENT\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { @@ -94,5 +94,5 @@ "rule": "The ArkUI interface \"Panel\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" } - ] -} + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/avoid_using_union_types.ets b/ets2panda/linter/test/main/avoid_using_union_types.ets index da1290b868f322e04231a4cc1d9aacc847f4e590..9b96d9dc4b9be27401b5cb27dad71ae1522d5437 100644 --- a/ets2panda/linter/test/main/avoid_using_union_types.ets +++ b/ets2panda/linter/test/main/avoid_using_union_types.ets @@ -44,4 +44,10 @@ class E { tt() {} } let ab: D|E = new D(); -ab.tt(); \ No newline at end of file +ab.tt(); + +declare interface TextPickerResult { + value: string | string[]; +} +const result: TextPickerResult = { value: 'a' }; +result.value.toString() // no error - ok diff --git a/ets2panda/linter/test/main/builder_node.ets.arkts2.json b/ets2panda/linter/test/main/builder_node.ets.arkts2.json index e6bce3c58be5804a4561bfc38065f87f2bf9e368..fa11de342c962e69ff33e969b95d9eac7be2cac8 100644 --- a/ets2panda/linter/test/main/builder_node.ets.arkts2.json +++ b/ets2panda/linter/test/main/builder_node.ets.arkts2.json @@ -294,6 +294,26 @@ "rule": "The ArkUI interface \"UIContext\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, + { + "line": 75, + "column": 31, + "endLine": 75, + "endColumn": 42, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"wrapBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 77, + "column": 31, + "endLine": 77, + "endColumn": 42, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"wrapBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, { "line": 111, "column": 2, diff --git a/ets2panda/linter/test/main/destructuring_object_property_name.ets b/ets2panda/linter/test/main/destructuring_object_property_name.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6c9d7b8b0edba7932d072813c593b24ab841652 --- /dev/null +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let obj = { + a: 1, + '2': 2, + 3: 3, + ['d']: 4 +}; + +let { a, a: a2 } = obj; // OK +let { '2': b } = obj; // Not fixable, support only identifiers as property names +let { 3: c } = obj; // Not fixable, support only identifiers as property names +let { ['d']: d } = obj; // Not fixable, support only identifiers as property names + +({ a, a: a2 } = obj); // OK +({ '2': b } = obj); // Not fixable, support only identifiers as property names +({ 3: c } = obj); // Not fixable, support only identifiers as property names +({ ['d']: d } = obj); // Not fixable, support only identifiers as property names \ No newline at end of file diff --git a/ets2panda/linter/test/main/destructuring_object_property_name.ets.args.json b/ets2panda/linter/test/main/destructuring_object_property_name.ets.args.json new file mode 100644 index 0000000000000000000000000000000000000000..12b3ca8decaeda0b8758fdb4a74d2ae3fba065f7 --- /dev/null +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets.args.json @@ -0,0 +1,20 @@ +{ + "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": { + "autofix": "", + "migrate": "" + } +} diff --git a/ets2panda/linter/test/main/destructuring_object_property_name.ets.autofix.json b/ets2panda/linter/test/main/destructuring_object_property_name.ets.autofix.json new file mode 100644 index 0000000000000000000000000000000000000000..8fe52e532a1eb30245b1b8202e50f2bcc636cea1 --- /dev/null +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets.autofix.json @@ -0,0 +1,150 @@ +{ + "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": 11, + "endLine": 16, + "endColumn": 12, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 3, + "endLine": 19, + "endColumn": 4, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 23, + "problem": "DestructuringDeclaration", + "autofix": [ + { + "replacementText": "let a2 = obj.a;\n", + "start": 658, + "end": 681, + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 23 + } + ], + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 5, + "endLine": 24, + "endColumn": 21, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 5, + "endLine": 25, + "endColumn": 19, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 5, + "endLine": 26, + "endColumn": 23, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 2, + "endLine": 28, + "endColumn": 20, + "problem": "DestructuringAssignment", + "autofix": [ + { + "replacementText": "a2 = obj.a;\n", + "start": 932, + "end": 953, + "line": 28, + "column": 2, + "endLine": 28, + "endColumn": 20 + } + ], + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 2, + "endLine": 29, + "endColumn": 18, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 2, + "endLine": 30, + "endColumn": 16, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 4, + "endLine": 30, + "endColumn": 5, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 2, + "endLine": 31, + "endColumn": 20, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/destructuring_object_property_name.ets.json b/ets2panda/linter/test/main/destructuring_object_property_name.ets.json new file mode 100644 index 0000000000000000000000000000000000000000..9e2606ae3554da1ed12c468605c905daef41f7ab --- /dev/null +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets.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": 16, + "column": 11, + "endLine": 16, + "endColumn": 12, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 3, + "endLine": 19, + "endColumn": 4, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 23, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 5, + "endLine": 24, + "endColumn": 21, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 5, + "endLine": 25, + "endColumn": 19, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 5, + "endLine": 26, + "endColumn": 23, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 28, + "column": 2, + "endLine": 28, + "endColumn": 20, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 2, + "endLine": 29, + "endColumn": 18, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 2, + "endLine": 30, + "endColumn": 16, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 4, + "endLine": 30, + "endColumn": 5, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 2, + "endLine": 31, + "endColumn": 20, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/destructuring_object_property_name.ets.migrate.ets b/ets2panda/linter/test/main/destructuring_object_property_name.ets.migrate.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c72f5222fe55b3afa0baef599253a9f478c88d4 --- /dev/null +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets.migrate.ets @@ -0,0 +1,33 @@ +/* + * 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. + */ + +let obj = { + a: 1, + '2': 2, + 3: 3, + ['d']: 4 +}; + +let a2 = obj.a; + // OK +let { '2': b } = obj; // Not fixable, support only identifiers as property names +let { 3: c } = obj; // Not fixable, support only identifiers as property names +let { ['d']: d } = obj; // Not fixable, support only identifiers as property names + +a2 = obj.a; + // OK +({ '2': b } = obj); // Not fixable, support only identifiers as property names +({ 3: c } = obj); // Not fixable, support only identifiers as property names +({ ['d']: d } = obj); // Not fixable, support only identifiers as property names \ No newline at end of file diff --git a/ets2panda/linter/test/main/destructuring_object_property_name.ets.migrate.json b/ets2panda/linter/test/main/destructuring_object_property_name.ets.migrate.json new file mode 100644 index 0000000000000000000000000000000000000000..f816a019b5bb1d4dee8b310e2dc43a4da16bc183 --- /dev/null +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets.migrate.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": 16, + "column": 11, + "endLine": 16, + "endColumn": 12, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 3, + "endLine": 19, + "endColumn": 4, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 25, + "column": 5, + "endLine": 25, + "endColumn": 21, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 5, + "endLine": 26, + "endColumn": 19, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 5, + "endLine": 27, + "endColumn": 23, + "problem": "DestructuringDeclaration", + "suggest": "", + "rule": "Destructuring variable declarations are not supported (arkts-no-destruct-decls)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 2, + "endLine": 31, + "endColumn": 18, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 2, + "endLine": 32, + "endColumn": 16, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + }, + { + "line": 32, + "column": 4, + "endLine": 32, + "endColumn": 5, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 33, + "column": 2, + "endLine": 33, + "endColumn": 20, + "problem": "DestructuringAssignment", + "suggest": "", + "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", + "severity": "ERROR" + } + ] +} \ No newline at end of file diff --git a/ets2panda/linter/test/main/incompatible_function.ets b/ets2panda/linter/test/main/incompatible_function.ets index 4330949c719a3717839e8f7a3f98bb4b417793b5..1701ac0932e01c42c674e4e4b9da75993f3af6c8 100644 --- a/ets2panda/linter/test/main/incompatible_function.ets +++ b/ets2panda/linter/test/main/incompatible_function.ets @@ -134,4 +134,70 @@ class E { Dfun(a: X|Y): X { return a; } +} + +import { Entry, Text, Column, Component, Button, ClickEvent ,Image ,ShadowOptions} from '@ohos.arkui.component' +import { State } from '@ohos.arkui.stateManagement' +import hilog from '@ohos.hilog' +import util from '@ohos.util'; + +@Entry +@Component +struct MyStateSample { + @State stateVar: string = 'state var'; + message: string = 'var'; + + changeValue() { + this.getUIContext(); + this.stateVar += '~' + } + + build() { + Column(undefined) { + Text('Hello World').fontSize(20) + Button(this.message).backgroundColor('#FFFF00FF') + .onClick(async (e: ClickEvent) => { + let lock: AsyncLock = AsyncLock.request("lock_1"); + hilog.info(0x0000, 'testTag', 'On Click'); + let a = this.getUIContext(); + this.changeValue(); + + }) + Text(this.stateVar).fontSize(20) + .onClick((e: ClickEvent) => { + this.message += "~" + } as (event: ClickEvent) => void) + Child({ stateVar: this.stateVar }) + } + } +} + +interface CustomClickable { + onClick(handler: (event: ClickEvent) => void): this; +} + +function onClick(handler: (event: ClickEvent) => void): this { + return this.onClick((e: ClickEvent) => { + console.log('Before custom onClick'); + handler(e); + console.log('After custom onClick'); + }); +} + +// 将扩展方法附加到Button组件 +Button.extend({ onClick }); + +@Entry +@Component +struct MyComponent { + @State message: string = 'Click me'; + + build() { + Column() { + Button(this.message) + .onClick((e: ClickEvent) => { + this.message = 'Custom onClick worked!'; + }) + } + } } \ No newline at end of file diff --git a/ets2panda/linter/test/main/incompatible_function.ets.arkts2.json b/ets2panda/linter/test/main/incompatible_function.ets.arkts2.json index 31c19f7df35cda1cf1b42ca41cbba563768f8813..5b2f2475b0e6a5194d038317141415d5433cbcdf 100644 --- a/ets2panda/linter/test/main/incompatible_function.ets.arkts2.json +++ b/ets2panda/linter/test/main/incompatible_function.ets.arkts2.json @@ -123,6 +123,106 @@ "suggest": "", "rule": "Structural typing is not supported (arkts-no-structural-typing)", "severity": "ERROR" + }, + { + "line": 139, + "column": 1, + "endLine": 139, + "endColumn": 112, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 140, + "column": 1, + "endLine": 140, + "endColumn": 52, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 141, + "column": 1, + "endLine": 141, + "endColumn": 32, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 142, + "column": 1, + "endLine": 142, + "endColumn": 31, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 159, + "column": 18, + "endLine": 165, + "endColumn": 10, + "problem": "IncompationbleFunctionType", + "suggest": "", + "rule": "Stricter assignments into variables of function type (arkts-incompatible-function-types)", + "severity": "ERROR" + }, + { + "line": 162, + "column": 15, + "endLine": 162, + "endColumn": 38, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 169, + "column": 37, + "endLine": 169, + "endColumn": 41, + "problem": "VoidOperator", + "suggest": "", + "rule": "\"void\" operator is not supported (arkts-no-void-operator)", + "severity": "ERROR" + }, + { + "line": 176, + "column": 50, + "endLine": 176, + "endColumn": 54, + "problem": "ThisType", + "suggest": "", + "rule": "Type notation using \"this\" is not supported (arkts-no-typing-with-this)", + "severity": "ERROR" + }, + { + "line": 180, + "column": 10, + "endLine": 180, + "endColumn": 14, + "problem": "FunctionContainsThis", + "suggest": "", + "rule": "Using \"this\" inside stand-alone functions is not supported (arkts-no-standalone-this)", + "severity": "ERROR" + }, + { + "line": 179, + "column": 57, + "endLine": 179, + "endColumn": 61, + "problem": "ThisType", + "suggest": "", + "rule": "Type notation using \"this\" is not supported (arkts-no-typing-with-this)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/incompatible_function.ets.json b/ets2panda/linter/test/main/incompatible_function.ets.json index 2844fc25ba579f7e073c0d91f47b203c80c09683..e2e1afdc24b3780c5fbc0b6926038fa23b78adda 100644 --- a/ets2panda/linter/test/main/incompatible_function.ets.json +++ b/ets2panda/linter/test/main/incompatible_function.ets.json @@ -13,5 +13,96 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [] + "result": [ + { + "line": 139, + "column": 1, + "endLine": 139, + "endColumn": 112, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 140, + "column": 1, + "endLine": 140, + "endColumn": 52, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 141, + "column": 1, + "endLine": 141, + "endColumn": 32, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 142, + "column": 1, + "endLine": 142, + "endColumn": 31, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 159, + "column": 18, + "endLine": 165, + "endColumn": 10, + "problem": "IncompationbleFunctionType", + "suggest": "", + "rule": "Stricter assignments into variables of function type (arkts-incompatible-function-types)", + "severity": "ERROR" + }, + { + "line": 162, + "column": 15, + "endLine": 162, + "endColumn": 38, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 176, + "column": 50, + "endLine": 176, + "endColumn": 54, + "problem": "ThisType", + "suggest": "", + "rule": "Type notation using \"this\" is not supported (arkts-no-typing-with-this)", + "severity": "ERROR" + }, + { + "line": 180, + "column": 10, + "endLine": 180, + "endColumn": 14, + "problem": "FunctionContainsThis", + "suggest": "", + "rule": "Using \"this\" inside stand-alone functions is not supported (arkts-no-standalone-this)", + "severity": "ERROR" + }, + { + "line": 179, + "column": 57, + "endLine": 179, + "endColumn": 61, + "problem": "ThisType", + "suggest": "", + "rule": "Type notation using \"this\" is not supported (arkts-no-typing-with-this)", + "severity": "ERROR" + } + ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/interface_import_5.ets.arkts2.json b/ets2panda/linter/test/main/interface_import_5.ets.arkts2.json index ab357ad279ff77ea2af752ae0ac40dd9db49b6bc..b4edf8e90e240f0761d955582924ef7750775d1e 100644 --- a/ets2panda/linter/test/main/interface_import_5.ets.arkts2.json +++ b/ets2panda/linter/test/main/interface_import_5.ets.arkts2.json @@ -21,7 +21,7 @@ "endColumn": 46, "problem": "NoDeprecatedApi", "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getContext\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/interface_import_5.ets.autofix.json b/ets2panda/linter/test/main/interface_import_5.ets.autofix.json index 0c7503cb107134012bc1620f5d08607ab9b661c7..1970edd683aaaf7c875bb889ae0ce4fb398de6bd 100644 --- a/ets2panda/linter/test/main/interface_import_5.ets.autofix.json +++ b/ets2panda/linter/test/main/interface_import_5.ets.autofix.json @@ -32,7 +32,7 @@ } ], "suggest": "", - "rule": "ArkUI deprecated api check (arkui-no-deprecated-api)", + "rule": "The ArkUI interface \"getContext\" is deprecated (arkui-deprecated-interface)", "severity": "ERROR" }, { diff --git a/ets2panda/linter/test/main/wrapped_builder_generic_1.ets.arkts2.json b/ets2panda/linter/test/main/wrapped_builder_generic_1.ets.arkts2.json index 211ffc2630b043b8e1e9454deaba1493eded4b6b..e81fd481df1ebbe9516dca588163b99e4ef890f1 100644 --- a/ets2panda/linter/test/main/wrapped_builder_generic_1.ets.arkts2.json +++ b/ets2panda/linter/test/main/wrapped_builder_generic_1.ets.arkts2.json @@ -134,6 +134,16 @@ "rule": "The ArkUI interface \"WrappedBuilder\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, + { + "line": 22, + "column": 59, + "endLine": 22, + "endColumn": 70, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"wrapBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, { "line": 23, "column": 24, @@ -144,6 +154,16 @@ "rule": "The ArkUI interface \"WrappedBuilder\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, + { + "line": 23, + "column": 59, + "endLine": 23, + "endColumn": 70, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"wrapBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, { "line": 24, "column": 24, diff --git a/ets2panda/linter/test/main/wrapped_builder_generic_2.ets.arkts2.json b/ets2panda/linter/test/main/wrapped_builder_generic_2.ets.arkts2.json index 2b9f863f556a4b311ce352db6b7b8e7bbab1ca71..a9ac9aae354b756a0dca883cb4ec04bdb28fcf39 100644 --- a/ets2panda/linter/test/main/wrapped_builder_generic_2.ets.arkts2.json +++ b/ets2panda/linter/test/main/wrapped_builder_generic_2.ets.arkts2.json @@ -254,6 +254,26 @@ "rule": "The ArkUI interface \"WrappedBuilder\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, + { + "line": 29, + "column": 58, + "endLine": 29, + "endColumn": 69, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"wrapBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 29, + "column": 82, + "endLine": 29, + "endColumn": 93, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"wrapBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, { "line": 30, "column": 20, @@ -264,6 +284,26 @@ "rule": "The ArkUI interface \"WrappedBuilder\" should be imported before it is used (arkui-modular-interface)", "severity": "ERROR" }, + { + "line": 30, + "column": 58, + "endLine": 30, + "endColumn": 69, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"wrapBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, + { + "line": 30, + "column": 100, + "endLine": 30, + "endColumn": 111, + "problem": "UIInterfaceImport", + "suggest": "", + "rule": "The ArkUI interface \"wrapBuilder\" should be imported before it is used (arkui-modular-interface)", + "severity": "ERROR" + }, { "line": 31, "column": 20,