From 9db920cba0dd188771022936dba7c0c51ea946f4 Mon Sep 17 00:00:00 2001 From: Raif Mirza Erten Date: Wed, 9 Jul 2025 13:36:02 +0300 Subject: [PATCH] Missed case for equality judgment Issue: #ICL4PD Description: Fixed some missed test cases for equality judgment rule. Signed-off-by: Raif Mirza Erten --- ets2panda/linter/src/cli/CommandLineParser.ts | 77 ++- ets2panda/linter/src/lib/CookBookMsg.ts | 10 +- ets2panda/linter/src/lib/FaultAttrs.ts | 2 +- ets2panda/linter/src/lib/TypeScriptLinter.ts | 83 ++- .../linter/src/lib/autofixes/Autofixer.ts | 82 ++- .../scan/ProblemStatisticsCommonFunction.ts | 2 +- .../src/lib/utils/consts/ArkuiImportList.ts | 70 +-- .../src/lib/utils/consts/BuiltinWhiteList.ts | 7 +- .../lib/utils/consts/WorkloadRelatedConst.ts | 2 +- .../interop/interop_equality_judgment.ets | 8 +- .../interop_equality_judgment.ets.arkts2.json | 224 +++++++-- ...interop_equality_judgment.ets.autofix.json | 472 ++++++++++++++---- .../interop_equality_judgment.ets.migrate.ets | 8 +- ...interop_equality_judgment.ets.migrate.json | 66 ++- .../interop/interop_equality_judgment_js.js | 10 +- .../interop_import_js_rules.ets.autofix.json | 4 +- ..._not_have_property_arkts2.ets.autofix.json | 16 +- 17 files changed, 786 insertions(+), 357 deletions(-) diff --git a/ets2panda/linter/src/cli/CommandLineParser.ts b/ets2panda/linter/src/cli/CommandLineParser.ts index 88efd14adf..04f6792b4d 100644 --- a/ets2panda/linter/src/cli/CommandLineParser.ts +++ b/ets2panda/linter/src/cli/CommandLineParser.ts @@ -206,57 +206,56 @@ function formCommandLineOptions(parsedCmd: ParsedCommand): CommandLineOptions { } function processRuleConfig(commandLineOptions: CommandLineOptions, options: OptionValues): void { - const configureRulePath = getConfigureRulePath(options); - const configuredRulesMap = getRulesFromConfig(configureRulePath); - const arkTSRulesMap = extractRuleTags(cookBookTag); - commandLineOptions.linterOptions.ruleConfigTags = getConfiguredRuleTags(arkTSRulesMap, configuredRulesMap); + const configureRulePath = getConfigureRulePath(options); + const configuredRulesMap = getRulesFromConfig(configureRulePath); + const arkTSRulesMap = extractRuleTags(cookBookTag); + commandLineOptions.linterOptions.ruleConfigTags = getConfiguredRuleTags(arkTSRulesMap, configuredRulesMap); } -function getConfigureRulePath(options: OptionValues) : string { - if (!options.ruleConfig) { - return getDefaultConfigurePath(); - } else { - const stats = fs.statSync(path.normalize(options.ruleConfig)); - if (!stats.isFile()) { - Logger.error(`The file at ${options.ruleConfigPath} path does not exist! +function getConfigureRulePath(options: OptionValues): string { + if (!options.ruleConfig) { + return getDefaultConfigurePath(); + } + const stats = fs.statSync(path.normalize(options.ruleConfig)); + if (!stats.isFile()) { + Logger.error(`The file at ${options.ruleConfigPath} path does not exist! And will use the default configure rule`); - return getDefaultConfigurePath(); - } else { - return options.ruleConfig; - } - } + return getDefaultConfigurePath(); + } + return options.ruleConfig; } -function getDefaultConfigurePath() : string { +function getDefaultConfigurePath(): string { const defaultConfigPath = path.join(process.cwd(), 'rule-config.json'); try { fs.accessSync(defaultConfigPath, fs.constants.F_OK); } catch (error: any) { if (error.code === 'ENOENT') { - Logger.error(`The default rule configuration file does not exist, please add the file named rule-config.json in the migration-helper folder!`); + Logger.error( + 'The default rule configuration file does not exist, please add the file named rule-config.json in the migration-helper folder!' + ); process.exit(1); } } return defaultConfigPath; } - function processAutofixRuleConfig(commandLineOptions: CommandLineOptions, options: OptionValues): void { - if (options.ruleConfig) { - return; - } - const autofixConfigureRulePath = options.autofixRuleConfig; - if (!autofixConfigureRulePath || autofixConfigureRulePath.length === 0) { - return; - } - const stats = fs.statSync(path.normalize(options.autofixRuleConfig)); - if (!stats.isFile()) { - Logger.error(`The file at ${options.autofixRuleConfig} path does not exist!`); - return; - } - const configuredRulesMap = getRulesFromConfig(autofixConfigureRulePath); - const arkTSRulesMap = extractRuleTags(cookBookTag); - commandLineOptions.linterOptions.autofixRuleConfigTags = getConfiguredRuleTags(arkTSRulesMap, configuredRulesMap); + if (options.ruleConfig) { + return; + } + const autofixConfigureRulePath = options.autofixRuleConfig; + if (!autofixConfigureRulePath || autofixConfigureRulePath.length === 0) { + return; + } + const stats = fs.statSync(path.normalize(options.autofixRuleConfig)); + if (!stats.isFile()) { + Logger.error(`The file at ${options.autofixRuleConfig} path does not exist!`); + return; + } + const configuredRulesMap = getRulesFromConfig(autofixConfigureRulePath); + const arkTSRulesMap = extractRuleTags(cookBookTag); + commandLineOptions.linterOptions.autofixRuleConfigTags = getConfiguredRuleTags(arkTSRulesMap, configuredRulesMap); } function createCommand(): Command { @@ -342,11 +341,11 @@ function processResponseFiles(parsedCmd: ParsedCommand): void { const rspFiles = parsedCmd.args.responseFiles; for (const rspFile of rspFiles) { try { - const rspArgs = fs - .readFileSync(rspFile) - .toString() - .split('\n') - .filter((e) => { + const rspArgs = fs. + readFileSync(rspFile). + toString(). + split('\n'). + filter((e) => { return e.trimEnd(); }); const cmdArgs = ['dummy', 'dummy']; diff --git a/ets2panda/linter/src/lib/CookBookMsg.ts b/ets2panda/linter/src/lib/CookBookMsg.ts index d94ca19217..c9f5b69115 100644 --- a/ets2panda/linter/src/lib/CookBookMsg.ts +++ b/ets2panda/linter/src/lib/CookBookMsg.ts @@ -17,14 +17,14 @@ export const cookBookMsg: string[] = []; export const cookBookTag: string[] = []; /** - * @note If the value contains multiple parentheses groups, + * @note If the value contains multiple parentheses groups, * the rule name must be placed in the last group. - * - * @example + * + * @example * // Correct (rule name in last parentheses): * 'cookBookTag[352] = "1.2 Void conflict...(sdk-ability-asynchronous-lifecycle)"' - * -*/ + * + */ cookBookTag[1] = 'Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)'; diff --git a/ets2panda/linter/src/lib/FaultAttrs.ts b/ets2panda/linter/src/lib/FaultAttrs.ts index faeb575025..f67ac33cb4 100644 --- a/ets2panda/linter/src/lib/FaultAttrs.ts +++ b/ets2panda/linter/src/lib/FaultAttrs.ts @@ -267,4 +267,4 @@ faultsAttrs[FaultID.NumericBigintCompare] = new FaultAttributes(376); faultsAttrs[FaultID.NondecimalBigint] = new FaultAttributes(377); faultsAttrs[FaultID.UnsupportOperator] = new FaultAttributes(378); faultsAttrs[FaultID.StateStylesBlockNeedArrowFunc] = new FaultAttributes(381); -faultsAttrs[FaultID.PromiseVoidNeedResolveArg] = new FaultAttributes(382); \ No newline at end of file +faultsAttrs[FaultID.PromiseVoidNeedResolveArg] = new FaultAttributes(382); diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 393b46cc96..fe93dc5fbd 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -724,7 +724,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { private static checkTypedArrayOrBuiltInConstructor(parent: ts.Node): boolean { if (ts.isNewExpression(parent)) { - const newExpr = parent as ts.NewExpression; + const newExpr = parent; const typeName = newExpr.expression.getText(); return TYPED_ARRAYS.includes(typeName) || BUILTIN_CONSTRUCTORS.includes(typeName); @@ -1534,7 +1534,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handlePropertyDeclarationForProp(node); this.handleSdkGlobalApi(node); this.handleObjectLiteralAssignmentToClass(node); - this.handleNumericPublicStatic(node) + this.handleNumericPublicStatic(node); } private handleSendableClassProperty(node: ts.PropertyDeclaration): void { @@ -2077,7 +2077,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleObjectLiteralAssignmentToClass(tsBinaryExpr); this.handleAssignmentNotsLikeSmartType(tsBinaryExpr); } - + private handleNumericPublicStatic(node: ts.PropertyDeclaration): void { if (!this.options.arkts2) { return; @@ -2091,8 +2091,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } if (node.initializer) { - if (ts.isBinaryExpression(node.initializer) && - this.isNumericExpression(node.initializer)) { + if (ts.isBinaryExpression(node.initializer) && this.isNumericExpression(node.initializer)) { const autofix = this.autofixer?.fixNumericPublicStatic(node); this.incrementCounters(node, FaultID.NumericSemantics, autofix); } @@ -2106,10 +2105,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!ts.isBinaryExpression(node)) { return false; } - return ( - this.isNumericExpression(node.left) && - this.isNumericExpression(node.right) - ); + return this.isNumericExpression(node.left) && this.isNumericExpression(node.right); } private checkInterOpImportJsDataCompare(expr: ts.BinaryExpression): void { @@ -3507,19 +3503,18 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { // Check if a type string has an equivalent primitive/wrapper type in a set private static areWrapperAndPrimitiveTypesEqual(typeStr: string, typeSet: Set): boolean { - const typePairs = [ - ['String', 'string'], - ['Number', 'number'], - ['Boolean', 'boolean'] - ]; + const typePairs = [ + ['String', 'string'], + ['Number', 'number'], + ['Boolean', 'boolean'] + ]; - for (const [wrapper, primitive] of typePairs) { - if ((typeStr === wrapper && typeSet.has(primitive)) || - (typeStr === primitive && typeSet.has(wrapper))) { - return true; - } + for (const [wrapper, primitive] of typePairs) { + if (typeStr === wrapper && typeSet.has(primitive) || typeStr === primitive && typeSet.has(wrapper)) { + return true; } - return false; + } + return false; } private isDerivedTypeAssignable(derivedType: ts.Type, baseType: ts.Type): boolean { @@ -3553,29 +3548,29 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { // Converts union types into an array of type strings for easy comparison. private flattenUnionTypes(type: ts.Type): string[] { - if (type.isUnion()) { - return type.types.map((t) => { - return TypeScriptLinter.normalizeTypeString(this.tsTypeChecker.typeToString(t)); - }); - } - return [TypeScriptLinter.normalizeTypeString(this.tsTypeChecker.typeToString(type))]; + if (type.isUnion()) { + return type.types.map((t) => { + return TypeScriptLinter.normalizeTypeString(this.tsTypeChecker.typeToString(t)); + }); + } + return [TypeScriptLinter.normalizeTypeString(this.tsTypeChecker.typeToString(type))]; } // Normalize type string to handle primitive wrapper types consistently private static normalizeTypeString(typeStr: string): string { - // Handle all primitive wrapper types - const wrapperToPrimitive: Record = { - 'String': 'string', - 'Number': 'number', - 'Boolean': 'boolean' - }; + // Handle all primitive wrapper types + const wrapperToPrimitive: Record = { + String: 'string', + Number: 'number', + Boolean: 'boolean' + }; - // Replace wrapper types with their primitive counterparts - let normalized = typeStr; - for (const [wrapper, primitive] of Object.entries(wrapperToPrimitive)) { - normalized = normalized.replace(new RegExp(wrapper, 'g'), primitive); - } - return normalized; + // Replace wrapper types with their primitive counterparts + let normalized = typeStr; + for (const [wrapper, primitive] of Object.entries(wrapperToPrimitive)) { + normalized = normalized.replace(new RegExp(wrapper, 'g'), primitive); + } + return normalized; } private checkClassImplementsMethod(classDecl: ts.ClassDeclaration, methodName: string): boolean { @@ -4394,7 +4389,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } if (ts.isCallExpression(tsCallExpr) && tsCallExpr.expression.kind === ts.SyntaxKind.SuperKeyword) { - return; + return; } const node = ts.isCallExpression(tsCallExpr) ? tsCallExpr.expression : tsCallExpr.typeName; const constructorType = this.tsTypeChecker.getTypeAtLocation(node); @@ -10186,7 +10181,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } } if (this.isObjectPropertyAccess(accessExpr)) { - return true; + return true; } return this.isInstanceOfCheck(accessExpr.parent, accessExpr); @@ -10866,7 +10861,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return false; } - const ifStatement = accessExpr.parent.parent.parent as ts.IfStatement; + const ifStatement = accessExpr.parent.parent.parent; if (!ts.isBinaryExpression(ifStatement.expression)) { return false; @@ -10878,10 +10873,12 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return false; } - if (!ts.isPropertyAccessExpression(condition.left) || + if ( + !ts.isPropertyAccessExpression(condition.left) || condition.left.name.text !== LENGTH_IDENTIFIER || !ts.isIdentifier(condition.left.expression) || - condition.left.expression.text !== arrayAccessInfo.arrayIdent.text) { + condition.left.expression.text !== arrayAccessInfo.arrayIdent.text + ) { return false; } diff --git a/ets2panda/linter/src/lib/autofixes/Autofixer.ts b/ets2panda/linter/src/lib/autofixes/Autofixer.ts index 4a3dbb93cd..2987d79032 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -981,11 +981,11 @@ export class Autofixer { const propertyChain: string[] = [propertyName]; let current: ts.Node = node; - + while (current.parent && ts.isElementAccessExpression(current.parent)) { const parentArg = current.parent.argumentExpression; if (ts.isStringLiteral(parentArg)) { - propertyChain.push(parentArg.text); + propertyChain.push(parentArg.text); } current = current.parent; } @@ -3710,18 +3710,17 @@ export class Autofixer { }); if (items.length > 1) { - const formattedList = items - .map((item) => { + const formattedList = items. + map((item) => { return ` ${item.trim()},`; - }) - .join('\n'); + }). + join('\n'); return `{\n${formattedList}\n}`; } return `{${importList}}`; }); } - fixStylesDecoratorGlobal( funcDecl: ts.FunctionDeclaration, calls: ts.Identifier[], @@ -4643,7 +4642,7 @@ export class Autofixer { fixImportClause(tsImportClause: ts.ImportClause): Autofix[] { void this; - const replacementText = tsImportClause.getText().replace(/\blazy\b\s*/, ""); + const replacementText = tsImportClause.getText().replace(/\blazy\b\s*/, ''); return [{ start: tsImportClause.getStart(), end: tsImportClause.getEnd(), replacementText }]; } @@ -4658,6 +4657,21 @@ export class Autofixer { return undefined; } + createInteropPropertyAccess(exp: ts.Expression): string { + let text: string; + if (!ts.isPropertyAccessExpression(exp)) { + text = exp.getText(); + return text; + } + const statements = ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(exp.expression, ts.factory.createIdentifier(GET_PROPERTY)), + undefined, + [ts.factory.createStringLiteral(exp.name.getText())] + ); + text = this.printer.printNode(ts.EmitHint.Unspecified, statements, exp.getSourceFile()); + return text; + } + replaceInteropEqualityOperator( tsBinaryExpr: ts.BinaryExpression, binaryOperator: ts.BinaryOperator @@ -4668,14 +4682,20 @@ export class Autofixer { } const tsLhsExpr = tsBinaryExpr.left; + const left = this.createInteropPropertyAccess(tsLhsExpr); const tsRhsExpr = tsBinaryExpr.right; + const right = this.createInteropPropertyAccess(tsRhsExpr); + if (!left || !right) { + return undefined; + } + const callExpression = ts.factory.createCallExpression( ts.factory.createPropertyAccessExpression( - ts.factory.createIdentifier(tsLhsExpr.getText()), + ts.factory.createIdentifier(left), ts.factory.createIdentifier(info.functionName) ), undefined, - [ts.factory.createIdentifier(tsRhsExpr.getText())] + [ts.factory.createIdentifier(right)] ); let text = this.printer.printNode(ts.EmitHint.Unspecified, callExpression, tsBinaryExpr.getSourceFile()); @@ -4728,17 +4748,17 @@ export class Autofixer { const expr = callExpr.expression; const hasOptionalChain = !!callExpr.questionDotToken; - const replacementText = hasOptionalChain - ? `${expr.getText()}${callExpr.questionDotToken.getText()}unsafeCall` - : `${expr.getText()}.unsafeCall`; + const replacementText = hasOptionalChain ? + `${expr.getText()}${callExpr.questionDotToken.getText()}unsafeCall` : + `${expr.getText()}.unsafeCall`; - return [{ + return [ + { start: expr.getStart(), - end: hasOptionalChain - ? callExpr.questionDotToken.getEnd() - : expr.getEnd(), + end: hasOptionalChain ? callExpr.questionDotToken.getEnd() : expr.getEnd(), replacementText - }]; + } + ]; } private static createBuiltInTypeInitializer(type: ts.TypeReferenceNode): ts.Expression | undefined { @@ -4917,7 +4937,10 @@ export class Autofixer { return [{ start: insertPos, end: insertPos, replacementText: typeArgsText }]; } - private fixGenericCallNoTypeArgsForArrayType(node: ts.NewExpression, arrayTypeNode: ts.ArrayTypeNode): Autofix[] | undefined { + private fixGenericCallNoTypeArgsForArrayType( + node: ts.NewExpression, + arrayTypeNode: ts.ArrayTypeNode + ): Autofix[] | undefined { const elementTypeNode = arrayTypeNode.elementType; const srcFile = node.getSourceFile(); const typeArgsText = `<${this.printer.printNode(ts.EmitHint.Unspecified, elementTypeNode, srcFile)}>`; @@ -4925,7 +4948,10 @@ export class Autofixer { return [{ start: insertPos, end: insertPos, replacementText: typeArgsText }]; } - private fixGenericCallNoTypeArgsForUnionType(node: ts.NewExpression, unionType: ts.UnionTypeNode): Autofix[] | undefined { + private fixGenericCallNoTypeArgsForUnionType( + node: ts.NewExpression, + unionType: ts.UnionTypeNode + ): Autofix[] | undefined { const matchingTypes = unionType.types.filter((type) => { return ts.isTypeReferenceNode(type) && type.typeName.getText() === node.expression.getText(); }) as ts.TypeReferenceNode[]; @@ -5147,8 +5173,8 @@ export class Autofixer { fixNumericPublicStatic(node: ts.PropertyDeclaration): Autofix[] | undefined { if (!node?.name || node.type) { - return undefined - }; + return undefined; + } const typeNode = ts.factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword); const modifiers = ts.getModifiers(node) || []; const updatedProperty = ts.factory.updatePropertyDeclaration( @@ -5161,11 +5187,13 @@ export class Autofixer { ); const newText = this.printer.printNode(ts.EmitHint.Unspecified, updatedProperty, node.getSourceFile()); - return [{ - start: node.getStart(), - end: node.getEnd(), - replacementText: newText - }]; + return [ + { + start: node.getStart(), + end: node.getEnd(), + replacementText: newText + } + ]; } fixRepeat(stmt: ts.ExpressionStatement): Autofix[] { diff --git a/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsCommonFunction.ts b/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsCommonFunction.ts index 1dbd42bcd1..cbe8c04e23 100644 --- a/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsCommonFunction.ts +++ b/ets2panda/linter/src/lib/statistics/scan/ProblemStatisticsCommonFunction.ts @@ -119,7 +119,7 @@ export function generateReportFileSync(reportName: string, reportData: any, repo fs.mkdirSync(path.dirname(reportFilePath), { recursive: true }); fs.writeFileSync(reportFilePath, JSON.stringify(reportData, null, 2)); } catch (error) { - Logger.error(`Error generating report file:${error}`); + Logger.error(`Error generating report file:${error}`); } } diff --git a/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts b/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts index 3beae87577..f8ab0145c5 100644 --- a/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts +++ b/ets2panda/linter/src/lib/utils/consts/ArkuiImportList.ts @@ -1616,52 +1616,52 @@ export const arkuiImportList: Set = new Set([ ]); export const arkTsBuiltInTypeName: Set = new Set([ - 'Object', - 'Function', - 'Boolean', - 'Symbol', - 'Number', - 'BigInt', - 'Math', + 'Object', + 'Function', + 'Boolean', + 'Symbol', + 'Number', + 'BigInt', + 'Math', 'Date', - 'String', + 'String', 'RegExp', - 'Array', - 'Int8Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Int16Array', - 'Uint16Array', - 'Int32Array', + 'Array', + 'Int8Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Int16Array', + 'Uint16Array', + 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', - 'BigInt64Array', + 'BigInt64Array', 'BigUint64Array', - 'Map', - 'Set', + 'Map', + 'Set', 'WeakMap', 'WeakSet', - 'ArrayBuffer', - 'SharedArrayBuffer', - 'DataView', - 'JSON', - 'Promise', - 'Generator', - 'GeneratorFunction', + 'ArrayBuffer', + 'SharedArrayBuffer', + 'DataView', + 'JSON', + 'Promise', + 'Generator', + 'GeneratorFunction', 'AsyncFunction', - 'AsyncGenerator', - 'AsyncGeneratorFunction', - 'Reflect', - 'Proxy', + 'AsyncGenerator', + 'AsyncGeneratorFunction', + 'Reflect', + 'Proxy', 'Error', 'EvalError', - 'RangeError', - 'ReferenceError', - 'SyntaxError', - 'TypeError', - 'URIError', + 'RangeError', + 'ReferenceError', + 'SyntaxError', + 'TypeError', + 'URIError', 'AggregateError', 'Intl', 'WebAssembly' -]); \ No newline at end of file +]); diff --git a/ets2panda/linter/src/lib/utils/consts/BuiltinWhiteList.ts b/ets2panda/linter/src/lib/utils/consts/BuiltinWhiteList.ts index a491289280..6882910101 100644 --- a/ets2panda/linter/src/lib/utils/consts/BuiltinWhiteList.ts +++ b/ets2panda/linter/src/lib/utils/consts/BuiltinWhiteList.ts @@ -46,9 +46,4 @@ export const BUILTIN_DISABLE_CALLSIGNATURE = [ 'URIError' ]; -export const BUILTIN_CONSTRUCTORS = [ - 'Boolean', - 'Number', - 'Object', - 'String' -]; \ No newline at end of file +export const BUILTIN_CONSTRUCTORS = ['Boolean', 'Number', 'Object', 'String']; diff --git a/ets2panda/linter/src/lib/utils/consts/WorkloadRelatedConst.ts b/ets2panda/linter/src/lib/utils/consts/WorkloadRelatedConst.ts index c0c5efc0cc..676b1fb1e7 100644 --- a/ets2panda/linter/src/lib/utils/consts/WorkloadRelatedConst.ts +++ b/ets2panda/linter/src/lib/utils/consts/WorkloadRelatedConst.ts @@ -17,4 +17,4 @@ export const AVERAGE_LINE_FOR_REPAIRE_RULE_COEFFICIENT = 3; export const TEST_DEBUG_WORKLOAD_COEFFICIENT = 1.2; -export const NPAI_REPAIRE_WORKLOADA_COEFFICIEN = 0.2; \ No newline at end of file +export const NPAI_REPAIRE_WORKLOADA_COEFFICIEN = 0.2; diff --git a/ets2panda/linter/test/interop/interop_equality_judgment.ets b/ets2panda/linter/test/interop/interop_equality_judgment.ets index 65ce20fddc..aebc647fbe 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets @@ -13,8 +13,12 @@ * limitations under the License. */ -import {a, b} from "./interop_equality_judgment_js" +import {a, b, c, d} from "./interop_equality_judgment_js" a == b a != b a === b -a !== b \ No newline at end of file +a !== b +c.num1 == d.num1 +c.num1 != d.num2 +c.num1 === d.num1 +c.num1 !== d.num2 diff --git a/ets2panda/linter/test/interop/interop_equality_judgment.ets.arkts2.json b/ets2panda/linter/test/interop/interop_equality_judgment.ets.arkts2.json index 920de865a7..24b5949ab2 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.arkts2.json +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.arkts2.json @@ -14,55 +14,175 @@ "limitations under the License." ], "result": [ - { - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 52, - "problem": "InterOpImportJs", - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 7, - "problem": "InteropEqualityJudgment", - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 7, - "problem": "InteropEqualityJudgment", - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 8, - "problem": "InteropEqualityJudgment", - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, - { - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 8, - "problem": "InteropEqualityJudgment", - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - } - ] -} \ No newline at end of file + { + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 58, + "problem": "InterOpImportJs", + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 7, + "problem": "InteropEqualityJudgment", + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 7, + "problem": "InteropEqualityJudgment", + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 8, + "problem": "InteropEqualityJudgment", + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 8, + "problem": "InteropEqualityJudgment", + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 17, + "problem": "InteropEqualityJudgment", + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 7, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 11, + "endLine": 21, + "endColumn": 17, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 17, + "problem": "InteropEqualityJudgment", + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 7, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 17, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 18, + "problem": "InteropEqualityJudgment", + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 7, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 12, + "endLine": 23, + "endColumn": 18, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 18, + "problem": "InteropEqualityJudgment", + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 7, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 12, + "endLine": 24, + "endColumn": 18, + "problem": "InteropObjectProperty", + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json b/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json index d38814d67c..92a6f21d60 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.autofix.json @@ -14,119 +14,371 @@ "limitations under the License." ], "result": [ + { + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 58, + "problem": "InterOpImportJs", + "autofix": [ { - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 52, - "problem": "InterOpImportJs", - "autofix": [ - { - "start": 605, - "end": 656, - "replacementText": "", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 52 - }, - { - "start": 656, - "end": 656, - "replacementText": "let a = ESValue.load('./interop_equality_judgment_js').getProperty('a');\nlet b = ESValue.load('./interop_equality_judgment_js').getProperty('b');\n", - "line": 16, - "column": 1, - "endLine": 16, - "endColumn": 52 - } - ], - "suggest": "", - "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", - "severity": "ERROR" + "start": 605, + "end": 662, + "replacementText": "", + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 58 }, { - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 7, - "problem": "InteropEqualityJudgment", - "autofix": [ - { - "start": 657, - "end": 663, - "replacementText": "a.areEqual(b)", - "line": 17, - "column": 1, - "endLine": 17, - "endColumn": 7 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, + "start": 662, + "end": 662, + "replacementText": "let a = ESValue.load('./interop_equality_judgment_js').getProperty('a');\nlet b = ESValue.load('./interop_equality_judgment_js').getProperty('b');\nlet c = ESValue.load('./interop_equality_judgment_js').getProperty('c');\nlet d = ESValue.load('./interop_equality_judgment_js').getProperty('d');\n", + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 58 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 7, + "problem": "InteropEqualityJudgment", + "autofix": [ { - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 7, - "problem": "InteropEqualityJudgment", - "autofix": [ - { - "start": 664, - "end": 670, - "replacementText": "!a.areEqual(b)", - "line": 18, - "column": 1, - "endLine": 18, - "endColumn": 7 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, + "start": 663, + "end": 669, + "replacementText": "a.areEqual(b)", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 7, + "problem": "InteropEqualityJudgment", + "autofix": [ { - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 8, - "problem": "InteropEqualityJudgment", - "autofix": [ - { - "start": 671, - "end": 678, - "replacementText": "a.areStrictlyEqual(b)", - "line": 19, - "column": 1, - "endLine": 19, - "endColumn": 8 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - }, + "start": 670, + "end": 676, + "replacementText": "!a.areEqual(b)", + "line": 18, + "column": 1, + "endLine": 18, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 8, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 677, + "end": 684, + "replacementText": "a.areStrictlyEqual(b)", + "line": 19, + "column": 1, + "endLine": 19, + "endColumn": 8 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 8, + "problem": "InteropEqualityJudgment", + "autofix": [ { - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 8, - "problem": "InteropEqualityJudgment", - "autofix": [ - { - "start": 679, - "end": 686, - "replacementText": "!a.areStrictlyEqual(b)", - "line": 20, - "column": 1, - "endLine": 20, - "endColumn": 8 - } - ], - "suggest": "", - "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", - "severity": "ERROR" - } - ] -} \ No newline at end of file + "start": 685, + "end": 692, + "replacementText": "!a.areStrictlyEqual(b)", + "line": 20, + "column": 1, + "endLine": 20, + "endColumn": 8 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 17, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 693, + "end": 709, + "replacementText": "c.getProperty(\"num1\").areEqual(d.getProperty(\"num1\"))", + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 7, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 693, + "end": 699, + "replacementText": "c.getProperty(\"num1\")", + "line": 21, + "column": 1, + "endLine": 21, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 11, + "endLine": 21, + "endColumn": 17, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 703, + "end": 709, + "replacementText": "d.getProperty(\"num1\")", + "line": 21, + "column": 11, + "endLine": 21, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 17, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 710, + "end": 726, + "replacementText": "!c.getProperty(\"num1\").areEqual(d.getProperty(\"num2\"))", + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 7, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 710, + "end": 716, + "replacementText": "c.getProperty(\"num1\")", + "line": 22, + "column": 1, + "endLine": 22, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 17, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 720, + "end": 726, + "replacementText": "d.getProperty(\"num2\")", + "line": 22, + "column": 11, + "endLine": 22, + "endColumn": 17 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 18, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 727, + "end": 744, + "replacementText": "c.getProperty(\"num1\").areStrictlyEqual(d.getProperty(\"num1\"))", + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 7, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 727, + "end": 733, + "replacementText": "c.getProperty(\"num1\")", + "line": 23, + "column": 1, + "endLine": 23, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 12, + "endLine": 23, + "endColumn": 18, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 738, + "end": 744, + "replacementText": "d.getProperty(\"num1\")", + "line": 23, + "column": 12, + "endLine": 23, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 18, + "problem": "InteropEqualityJudgment", + "autofix": [ + { + "start": 745, + "end": 762, + "replacementText": "!c.getProperty(\"num1\").areStrictlyEqual(d.getProperty(\"num2\"))", + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "\"JS\" objects can't be used directly as operands of the equality operators (arkts-interop-js2s-equality-judgment)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 7, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 745, + "end": 751, + "replacementText": "c.getProperty(\"num1\")", + "line": 24, + "column": 1, + "endLine": 24, + "endColumn": 7 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 12, + "endLine": 24, + "endColumn": 18, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 756, + "end": 762, + "replacementText": "d.getProperty(\"num2\")", + "line": 24, + "column": 12, + "endLine": 24, + "endColumn": 18 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets index 75dfa93e70..4280a2dfb4 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.ets @@ -15,8 +15,14 @@ let a = ESValue.load('./interop_equality_judgment_js').getProperty('a'); let b = ESValue.load('./interop_equality_judgment_js').getProperty('b'); +let c = ESValue.load('./interop_equality_judgment_js').getProperty('c'); +let d = ESValue.load('./interop_equality_judgment_js').getProperty('d'); a.areEqual(b) !a.areEqual(b) a.areStrictlyEqual(b) -!a.areStrictlyEqual(b) \ No newline at end of file +!a.areStrictlyEqual(b) +c.getProperty("num1").areEqual(d.getProperty("num1")) +!c.getProperty("num1").areEqual(d.getProperty("num2")) +c.getProperty("num1").areStrictlyEqual(d.getProperty("num1")) +!c.getProperty("num1").areStrictlyEqual(d.getProperty("num2")) diff --git a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json index c8a37393a6..165b58c9e8 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json +++ b/ets2panda/linter/test/interop/interop_equality_judgment.ets.migrate.json @@ -13,26 +13,46 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [ - { - "line": 16, - "column": 5, - "endLine": 16, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - }, - { - "line": 17, - "column": 5, - "endLine": 17, - "endColumn": 72, - "problem": "AnyType", - "suggest": "", - "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", - "severity": "ERROR" - } - ] -} \ No newline at end of file + "result": [ + { + "line": 16, + "column": 5, + "endLine": 16, + "endColumn": 72, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 5, + "endLine": 17, + "endColumn": 72, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 5, + "endLine": 18, + "endColumn": 72, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 5, + "endLine": 19, + "endColumn": 72, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/interop/interop_equality_judgment_js.js b/ets2panda/linter/test/interop/interop_equality_judgment_js.js index 6461191d68..036eb5a333 100644 --- a/ets2panda/linter/test/interop/interop_equality_judgment_js.js +++ b/ets2panda/linter/test/interop/interop_equality_judgment_js.js @@ -15,4 +15,12 @@ class A {} export let a = new A() -export let b = new A() \ No newline at end of file +export let b = new A() +export let c = { + num1:1, + num2:2, +} +export let d = { + num1: 1, + num2: 2, +} diff --git a/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json b/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json index e160d4c3d0..8b588fa108 100644 --- a/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_import_js_rules.ets.autofix.json @@ -1051,7 +1051,7 @@ { "start": 1831, "end": 1858, - "replacementText": "orange.isVegetable1.areStrictlyEqual(123)", + "replacementText": "orange.getProperty(\"isVegetable1\").areStrictlyEqual(123)", "line": 84, "column": 5, "endLine": 84, @@ -1136,4 +1136,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} diff --git a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json index a4046013b9..b04c0809f2 100644 --- a/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json +++ b/ets2panda/linter/test/interop/interop_not_have_property_arkts2.ets.autofix.json @@ -431,7 +431,7 @@ { "start": 1005, "end": 1031, - "replacementText": "machine.name.areStrictlyEqual(\"machine\")", + "replacementText": "machine.getProperty(\"name\").areStrictlyEqual(\"machine\")", "line": 32, "column": 12, "endLine": 32, @@ -515,7 +515,7 @@ { "start": 1173, "end": 1190, - "replacementText": "user.id.areStrictlyEqual(\"Bob\")", + "replacementText": "user.getProperty(\"id\").areStrictlyEqual(\"Bob\")", "line": 37, "column": 12, "endLine": 37, @@ -620,7 +620,7 @@ { "start": 1312, "end": 1326, - "replacementText": "user.id.areStrictlyEqual(10)", + "replacementText": "user.getProperty(\"id\").areStrictlyEqual(10)", "line": 42, "column": 8, "endLine": 42, @@ -725,7 +725,7 @@ { "start": 1454, "end": 1470, - "replacementText": "user.id.areStrictlyEqual(123n)", + "replacementText": "user.getProperty(\"id\").areStrictlyEqual(123n)", "line": 47, "column": 12, "endLine": 47, @@ -809,7 +809,7 @@ { "start": 1601, "end": 1617, - "replacementText": "user.id.areStrictlyEqual(true)", + "replacementText": "user.getProperty(\"id\").areStrictlyEqual(true)", "line": 52, "column": 12, "endLine": 52, @@ -914,7 +914,7 @@ { "start": 1758, "end": 1784, - "replacementText": "machine.name.areStrictlyEqual(\"machine\")", + "replacementText": "machine.getProperty(\"name\").areStrictlyEqual(\"machine\")", "line": 57, "column": 12, "endLine": 57, @@ -998,7 +998,7 @@ { "start": 1929, "end": 1957, - "replacementText": "employee.name.areStrictlyEqual(\"employee\")", + "replacementText": "employee.getProperty(\"name\").areStrictlyEqual(\"employee\")", "line": 62, "column": 12, "endLine": 62, @@ -1031,4 +1031,4 @@ "severity": "ERROR" } ] -} \ No newline at end of file +} -- Gitee