From 251764efec78d278d7cd735ed4ead64ee2382c3a Mon Sep 17 00:00:00 2001 From: sefayilmazunal Date: Fri, 30 May 2025 11:04:48 +0300 Subject: [PATCH] interop instanceof rule autofix added Description: autofix added for interop instanceof rule Issue: #ICBP8M Signed-off-by: sefayilmazunal --- ets2panda/linter/src/lib/TypeScriptLinter.ts | 31 +- .../linter/src/lib/autofixes/Autofixer.ts | 27 +- ets2panda/linter/src/lib/utils/TsUtils.ts | 2 +- .../linter/src/lib/utils/consts/InteropAPI.ts | 1 + .../interop/no_js_instanceof.ets.args.json | 4 +- .../interop/no_js_instanceof.ets.autofix.json | 403 ++++++++++++++++++ .../interop/no_js_instanceof.ets.migrate.ets | 84 ++++ .../interop/no_js_instanceof.ets.migrate.json | 118 +++++ 8 files changed, 655 insertions(+), 15 deletions(-) create mode 100644 ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json create mode 100644 ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets create mode 100644 ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 8469c35143..5025b6a2e8 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -1376,7 +1376,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleTsInterop(propertyAccessNode, () => { this.checkInteropForPropertyAccess(propertyAccessNode); }); - this.propertyAccessExpressionForInterop(propertyAccessNode); + this.propertyAccessExpressionForInterop(propertyAccessNode); if (this.isPrototypePropertyAccess(propertyAccessNode, exprSym, baseExprSym, baseExprType)) { this.incrementCounters(propertyAccessNode.name, FaultID.Prototype); } @@ -1422,23 +1422,25 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { while (ts.isPropertyAccessExpression(current)) { current = current.expression; } - + return current; - } + }; const firstObjNode = getFirstObjectNode(propertyAccessNode); const isFromJs = this.tsUtils.isJsImport(firstObjNode); - - if(isFromJs) { - if (ts.isBinaryExpression(propertyAccessNode.parent) && - propertyAccessNode.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken) { + + if (isFromJs) { + if ( + ts.isBinaryExpression(propertyAccessNode.parent) && + propertyAccessNode.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken + ) { const autofix = this.autofixer?.fixInteropBinaryExpression(propertyAccessNode.parent); this.incrementCounters(propertyAccessNode.parent, FaultID.InteropObjectProperty, autofix); } else { const autofix = this.autofixer?.fixInteropPropertyAccessExpression(propertyAccessNode); this.incrementCounters(propertyAccessNode, FaultID.InteropObjectProperty, autofix); } - } + } } private checkDepricatedIsConcurrent(node: ts.PropertyAccessExpression): void { @@ -5192,7 +5194,6 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { type.getText() === 'null'; if (isNullAssertion) { this.incrementCounters(tsAsExpr, FaultID.InterOpConvertImport); - } } @@ -8290,16 +8291,22 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { if (!this.options.arkts2 || !this.useStatic) { return; } + const left = node.left; const right = node.right; const getNode = (expr: ts.Expression): ts.Node => { return ts.isPropertyAccessExpression(expr) || ts.isCallExpression(expr) ? expr.expression : expr; }; + const leftExpr = getNode(left); const rightExpr = getNode(right); - if (this.tsUtils.isJsImport(leftExpr) || this.tsUtils.isJsImport(rightExpr)) { - this.incrementCounters(node, FaultID.InteropJsInstanceof); + + if (!this.tsUtils.isJsImport(leftExpr) && !this.tsUtils.isJsImport(rightExpr)) { + return; } + + const autofix = this.autofixer?.fixInteropJsInstanceOfExpression(node); + this.incrementCounters(node, FaultID.InteropJsInstanceof, autofix); } private checkAutoIncrementDecrement(unaryExpr: ts.PostfixUnaryExpression | ts.PrefixUnaryExpression): void { @@ -8947,7 +8954,7 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { return; } - const returnType = this.tsTypeChecker.getTypeAtLocation(returnStmt.expression); + const returnType = this.tsTypeChecker.getTypeAtLocation(returnStmt.expression); if (className && isStaticPropertyAccess(returnStmt.expression, className) && returnType.isUnion()) { this.incrementCounters(returnStmt, FaultID.NoTsLikeSmartType); } diff --git a/ets2panda/linter/src/lib/autofixes/Autofixer.ts b/ets2panda/linter/src/lib/autofixes/Autofixer.ts index 5b70254022..027888c516 100644 --- a/ets2panda/linter/src/lib/autofixes/Autofixer.ts +++ b/ets2panda/linter/src/lib/autofixes/Autofixer.ts @@ -52,7 +52,8 @@ import { ARE_STRICTLY_EQUAL, WRAP, INSTANTIATE, - TO_NUMBER + TO_NUMBER, + IS_INSTANCE_OF } from '../utils/consts/InteropAPI'; import { ESLIB_SHAREDARRAYBUFFER } from '../utils/consts/ConcurrentAPI'; @@ -3557,6 +3558,30 @@ export class Autofixer { return [{ start: binaryExpr.getStart(), end: binaryExpr.getEnd(), replacementText }]; } + /** + * Autofix for `foo instanceof Foo` → `foo.isInstanceOf(Foo)`. + * + * @param node The binary `instanceof` expression node. + * @returns A single Autofix replacing the entire `foo instanceof Foo` text. + */ + fixInteropJsInstanceOfExpression(node: ts.BinaryExpression): Autofix[] { + // left-hand and right-hand operands of the `instanceof` + const leftExpr = node.left; + const rightExpr = node.right; + + // build: leftExpr.isInstanceOf(rightExpr) + const callExpr = ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(leftExpr, ts.factory.createIdentifier(IS_INSTANCE_OF)), + undefined, + [rightExpr] + ); + + // render back to source text + const replacementText = this.printer.printNode(ts.EmitHint.Unspecified, callExpr, node.getSourceFile()); + + return [{ replacementText, start: node.getStart(), end: node.getEnd() }]; + } + createReplacementForJsIndirectImportPropertyAccessExpression(node: ts.PropertyAccessExpression): Autofix[] { // Bypass eslint-check void this; diff --git a/ets2panda/linter/src/lib/utils/TsUtils.ts b/ets2panda/linter/src/lib/utils/TsUtils.ts index 2327bf026c..00466a8740 100644 --- a/ets2panda/linter/src/lib/utils/TsUtils.ts +++ b/ets2panda/linter/src/lib/utils/TsUtils.ts @@ -3654,7 +3654,7 @@ export class TsUtils { ) { return false; } - + return true; } current = current.parent; diff --git a/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts b/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts index 334f54afad..8793c13303 100644 --- a/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts +++ b/ets2panda/linter/src/lib/utils/consts/InteropAPI.ts @@ -18,6 +18,7 @@ export const ARE_EQUAL = 'areEqual'; export const ARE_STRICTLY_EQUAL = 'areStrictlyEqual'; export const WRAP = 'wrap'; export const INSTANTIATE = 'instantiate'; +export const IS_INSTANCE_OF = 'isInstanceOf'; export const REFLECT_PROPERTIES = [ 'get', diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.args.json b/ets2panda/linter/test/interop/no_js_instanceof.ets.args.json index 3ef4496a81..571ee6bb76 100755 --- a/ets2panda/linter/test/interop/no_js_instanceof.ets.args.json +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.args.json @@ -14,6 +14,8 @@ "limitations under the License." ], "mode": { - "arkts2": "" + "arkts2": "", + "autofix": "--arkts-2", + "migrate": "--arkts-2" } } diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json b/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json new file mode 100644 index 0000000000..d8c457f86f --- /dev/null +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.autofix.json @@ -0,0 +1,403 @@ +{ + "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": 17, + "column": 1, + "endLine": 17, + "endColumn": 88, + "problem": "ImportAfterStatement", + "suggest": "", + "rule": "\"import\" statements after other statements are not allowed (arkts-no-misplaced-imports)", + "severity": "ERROR" + }, + { + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 88, + "problem": "InterOpImportJs", + "autofix": [ + { + "start": 618, + "end": 705, + "replacementText": "", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 88 + }, + { + "start": 705, + "end": 705, + "replacementText": "let GeneratedImportVar_1 = ESValue.load('./no_js_instanceof_file.js');\nlet Foo = GeneratedImportVar_1.getPropertyByName('Foo');\nlet foo = GeneratedImportVar_1.getPropertyByName('foo');\nlet CreatePerson = GeneratedImportVar_1.getPropertyByName('CreatePerson');\nlet a = GeneratedImportVar_1.getPropertyByName('a');\nlet b = GeneratedImportVar_1.getPropertyByName('b');\nlet MyNamespace = GeneratedImportVar_1.getPropertyByName('MyNamespace');\n", + "line": 17, + "column": 1, + "endLine": 17, + "endColumn": 88 + } + ], + "suggest": "", + "rule": "Importing directly from \"JS\" module is not supported (arkts-interop-js2s-import-js)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 4, + "endLine": 27, + "endColumn": 22, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "foo.isInstanceOf(Foo)", + "start": 779, + "end": 797, + "line": 27, + "column": 4, + "endLine": 27, + "endColumn": 22 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 31, + "column": 4, + "endLine": 31, + "endColumn": 23, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "foo1.isInstanceOf(Foo)", + "start": 812, + "end": 831, + "line": 31, + "column": 4, + "endLine": 31, + "endColumn": 23 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 4, + "endLine": 35, + "endColumn": 23, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "foo.isInstanceOf(Foo1)", + "start": 842, + "end": 861, + "line": 35, + "column": 4, + "endLine": 35, + "endColumn": 23 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 28, + "endLine": 39, + "endColumn": 50, + "problem": "CallJSFunction", + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, + { + "line": 39, + "column": 47, + "endLine": 39, + "endColumn": 49, + "problem": "NumericSemantics", + "autofix": [ + { + "start": 915, + "end": 917, + "replacementText": "18.0", + "line": 39, + "column": 47, + "endLine": 39, + "endColumn": 49 + } + ], + "suggest": "", + "rule": "Numeric semantics is different for integer values (arkts-numeric-semantic)", + "severity": "ERROR" + }, + { + "line": 41, + "column": 4, + "endLine": 41, + "endColumn": 34, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "person.isInstanceOf(CreatePerson)", + "start": 923, + "end": 953, + "line": 41, + "column": 4, + "endLine": 41, + "endColumn": 34 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 8, + "endLine": 46, + "endColumn": 38, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "person.isInstanceOf(CreatePerson)", + "start": 993, + "end": 1023, + "line": 46, + "column": 8, + "endLine": 46, + "endColumn": 38 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 8, + "endLine": 52, + "endColumn": 38, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "person.isInstanceOf(CreatePerson)", + "start": 1072, + "end": 1102, + "line": 52, + "column": 8, + "endLine": 52, + "endColumn": 38 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 12, + "endLine": 59, + "endColumn": 42, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "person.isInstanceOf(CreatePerson)", + "start": 1160, + "end": 1190, + "line": 59, + "column": 12, + "endLine": 59, + "endColumn": 42 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 4, + "endLine": 65, + "endColumn": 22, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "a.isInstanceOf(Array)", + "start": 1217, + "end": 1235, + "line": 65, + "column": 4, + "endLine": 65, + "endColumn": 22 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 4, + "endLine": 69, + "endColumn": 24, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "b().isInstanceOf(Array)", + "start": 1246, + "end": 1266, + "line": 69, + "column": 4, + "endLine": 69, + "endColumn": 24 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 69, + "column": 4, + "endLine": 69, + "endColumn": 7, + "problem": "CallJSFunction", + "suggest": "", + "rule": "ArkTS directly call JS functions or parameters is not supported (arkts-interop-js2s-call-js-func)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 36, + "endLine": 73, + "endColumn": 51, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 36, + "endLine": 73, + "endColumn": 51, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 1309, + "end": 1324, + "replacementText": "MyNamespace.getPropertyByName(\"Dog\")", + "line": 73, + "column": 36, + "endLine": 73, + "endColumn": 51 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 36, + "endLine": 73, + "endColumn": 51, + "problem": "InteropJsObjectUsage", + "autofix": [ + { + "replacementText": "MyNamespace.getPropertyByName('Dog')", + "start": 1309, + "end": 1324, + "line": 73, + "column": 36, + "endLine": 73, + "endColumn": 51 + } + ], + "suggest": "", + "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js-object-usage)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 5, + "endLine": 75, + "endColumn": 37, + "problem": "InteropJsInstanceof", + "autofix": [ + { + "replacementText": "myDog.isInstanceOf(MyNamespace.Dog)", + "start": 1340, + "end": 1372, + "line": 75, + "column": 5, + "endLine": 75, + "endColumn": 37 + } + ], + "suggest": "", + "rule": "Usage of \"instanceof\" operator is not allowed with interop objects (arkts-interop-js2s-instanceof-js-type)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 22, + "endLine": 75, + "endColumn": 37, + "problem": "InteropObjectProperty", + "autofix": [ + { + "start": 1357, + "end": 1372, + "replacementText": "MyNamespace.getPropertyByName(\"Dog\")", + "line": 75, + "column": 22, + "endLine": 75, + "endColumn": 37 + } + ], + "suggest": "", + "rule": "Properties of interop objects can't be accessed directly (arkts-interop-js2s-access-js-prop)", + "severity": "ERROR" + }, + { + "line": 75, + "column": 22, + "endLine": 75, + "endColumn": 37, + "problem": "InteropJsObjectConditionJudgment", + "autofix": [ + { + "replacementText": "MyNamespace.getPropertyByName('Dog')", + "start": 1357, + "end": 1372, + "line": 75, + "column": 22, + "endLine": 75, + "endColumn": 37 + } + ], + "suggest": "", + "rule": "Direct usage of interop JS objects is not supported (arkts-interop-js2s-condition-judgment)", + "severity": "ERROR" + } + ] +} diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets new file mode 100644 index 0000000000..c480638e1b --- /dev/null +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.ets @@ -0,0 +1,84 @@ +/* + * 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. + */ +'use static' + +let GeneratedImportVar_1 = ESValue.load('./no_js_instanceof_file.js'); +let Foo = GeneratedImportVar_1.getPropertyByName('Foo'); +let foo = GeneratedImportVar_1.getPropertyByName('foo'); +let CreatePerson = GeneratedImportVar_1.getPropertyByName('CreatePerson'); +let a = GeneratedImportVar_1.getPropertyByName('a'); +let b = GeneratedImportVar_1.getPropertyByName('b'); +let MyNamespace = GeneratedImportVar_1.getPropertyByName('MyNamespace'); + + +class Foo1 {} + +let foo1 = new Foo1() + +if(foo1 instanceof Foo1) { + +} + +if(foo.isInstanceOf(Foo)) { + +} + +if(foo1.isInstanceOf(Foo)) { + +} + +if(foo.isInstanceOf(Foo1)) { + +} + +let person: CreatePerson = CreatePerson('xc', 18.0) + +if(person.isInstanceOf(CreatePerson)) { + +} + +function test1(): void { + if(person.isInstanceOf(CreatePerson)) { + + } +} + +const test2 = (): void => { + if(person.isInstanceOf(CreatePerson)) { + + } +} + +class Test3 { + init(): void { + if(person.isInstanceOf(CreatePerson)) { + + } + } +} + +if(a.isInstanceOf(Array)) { + +} + +if(b().isInstanceOf(Array)) { + +} + +const myDog: MyNamespace.Dog = new MyNamespace.getPropertyByName("Dog")('Buddy'); + +if (myDog.isInstanceOf(MyNamespace.Dog)) { + console.log("This is a Dog!"); +} \ No newline at end of file diff --git a/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json new file mode 100644 index 0000000000..a379ec1f16 --- /dev/null +++ b/ets2panda/linter/test/interop/no_js_instanceof.ets.migrate.json @@ -0,0 +1,118 @@ +{ + "copyright": [ + "Copyright (c) 2025 Huawei Device Co., Ltd.", + "Licensed under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + "http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + "distributed under the License is distributed on an 'AS IS' BASIS,", + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License." + ], + "result": [ + { + "line": 17, + "column": 5, + "endLine": 17, + "endColumn": 70, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 18, + "column": 5, + "endLine": 18, + "endColumn": 56, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 5, + "endLine": 19, + "endColumn": 56, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 20, + "column": 5, + "endLine": 20, + "endColumn": 74, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 21, + "column": 5, + "endLine": 21, + "endColumn": 52, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 22, + "column": 5, + "endLine": 22, + "endColumn": 52, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 23, + "column": 5, + "endLine": 23, + "endColumn": 72, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)", + "severity": "ERROR" + }, + { + "line": 72, + "column": 19, + "endLine": 72, + "endColumn": 24, + "problem": "ClassAsObjectError", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "ERROR" + }, + { + "line": 76, + "column": 21, + "endLine": 76, + "endColumn": 26, + "problem": "ClassAsObjectError", + "suggest": "", + "rule": "Classes cannot be used as objects (arkts-no-classes-as-obj)", + "severity": "ERROR" + }, + { + "line": 80, + "column": 36, + "endLine": 80, + "endColumn": 65, + "problem": "DynamicCtorCall", + "suggest": "", + "rule": "\"new\" expression with dynamic constructor type is not supported (arkts-no-dynamic-ctor-call)", + "severity": "ERROR" + } + ] +} -- Gitee