diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 3eff9cde2c467688b59990b3422cb0bc2d8a665a..b721cf14803412d7d3042e8399451c0754f650fa 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -2016,32 +2016,43 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { this.handleQuotedHyphenPropsDeprecated(node); this.handleNoDeprecatedApi(node); - const propName = node.name; - if (!propName || !(ts.isNumericLiteral(propName) || this.options.arkts2 && ts.isStringLiteral(propName))) { - return; - } - /* - * We can use literals as property names only when creating Record or any interop instances. - * We can also initialize with constant string literals. - * Assignment with string enum values is handled in handleComputedPropertyName - */ - let isRecordObjectInitializer = false; - let isLibraryType = false; - let isDynamic = false; - const objectLiteralType = this.tsTypeChecker.getContextualType(node.parent); - if (objectLiteralType) { - isRecordObjectInitializer = this.tsUtils.checkTypeSet(objectLiteralType, this.tsUtils.isStdRecordType); - isLibraryType = this.tsUtils.isLibraryType(objectLiteralType); - } - - isDynamic = isLibraryType || this.tsUtils.isDynamicLiteralInitializer(node.parent); - if (!isRecordObjectInitializer && !isDynamic) { - const autofix = this.autofixer?.fixLiteralAsPropertyNamePropertyAssignment(node); - this.incrementCounters(node.name, FaultID.LiteralAsPropertyName, autofix); - } + if (!this.options.arkts2) { + this.handleLiteralAsPropertyNameForPropertyAssignment(node); + } + } + + private handleLiteralAsPropertyNameForPropertyAssignment(node: ts.PropertyAssignment): void { + const propName = node.name; + if (!propName || !(ts.isNumericLiteral(propName) || ts.isStringLiteral(propName))) { + return; + } + + /* + * We can use literals as property names only when creating Record or any interop instances. + * We can also initialize with constant string literals. + * Assignment with string enum values is handled in handleComputedPropertyName + */ + let isRecordObjectInitializer = false; + let isLibraryType = false; + let isDynamic = false; + const objectLiteralType = this.tsTypeChecker.getContextualType(node.parent); + + if (objectLiteralType) { + isRecordObjectInitializer = this.tsUtils.checkTypeSet(objectLiteralType, this.tsUtils.isStdRecordType); + isLibraryType = this.tsUtils.isLibraryType(objectLiteralType); + } + isDynamic = isLibraryType || this.tsUtils.isDynamicLiteralInitializer(node.parent); + + if (!isRecordObjectInitializer && !isDynamic) { + const autofix = this.autofixer?.fixLiteralAsPropertyNamePropertyAssignment(node); + this.incrementCounters(node.name, FaultID.LiteralAsPropertyName, autofix); + } +} + + private static getAllClassesFromSourceFile(sourceFile: ts.SourceFile): ts.ClassDeclaration[] { const allClasses: ts.ClassDeclaration[] = []; function visit(node: ts.Node): void { @@ -2808,13 +2819,22 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } private isObjectLiteralKeyTypeValid(objectLiteral: ts.ObjectLiteralExpression, contextualType: ts.Type): void { - if (!this.tsUtils.isStdRecordType(contextualType)) { + const decl = contextualType.symbol?.declarations?.[0]; + if ( + !this.tsUtils.isStdRecordType(contextualType) && + !(decl && (ts.isClassDeclaration(decl) || ts.isInterfaceDeclaration(decl))) + ) { return; } objectLiteral.properties.forEach((prop: ts.ObjectLiteralElementLike): void => { if (ts.isPropertyAssignment(prop)) { - if (!this.tsUtils.isValidRecordObjectLiteralKey(prop.name)) { - this.incrementCounters(prop, FaultID.ObjectLiteralKeyType); + const propName = prop.name; + const isValid = this.tsUtils.isStdRecordType(contextualType) ? + this.tsUtils.isValidRecordObjectLiteralKey(propName) : + ts.isIdentifier(propName); + + if (!isValid) { + this.incrementCounters(propName, FaultID.ObjectLiteralKeyType); } } }); diff --git a/ets2panda/linter/test/main/arkts-obj-literal-key-type.ets.arkts2.json b/ets2panda/linter/test/main/arkts-obj-literal-key-type.ets.arkts2.json index dbdffd06776867060b04094a5bfd91963f2ad3a4..f60e39da2bdf900a710840139a1e6f4c161dc42f 100644 --- a/ets2panda/linter/test/main/arkts-obj-literal-key-type.ets.arkts2.json +++ b/ets2panda/linter/test/main/arkts-obj-literal-key-type.ets.arkts2.json @@ -19,16 +19,16 @@ "column": 13, "endLine": 31, "endColumn": 18, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { "line": 33, "column": 35, "endLine": 33, - "endColumn": 42, + "endColumn": 38, "problem": "ObjectLiteralKeyType", "suggest": "", "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", @@ -49,9 +49,9 @@ "column": 13, "endLine": 35, "endColumn": 19, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -59,16 +59,16 @@ "column": 31, "endLine": 35, "endColumn": 36, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { "line": 37, "column": 34, "endLine": 37, - "endColumn": 46, + "endColumn": 40, "problem": "ObjectLiteralKeyType", "suggest": "", "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", @@ -78,7 +78,7 @@ "line": 37, "column": 48, "endLine": 37, - "endColumn": 55, + "endColumn": 51, "problem": "ObjectLiteralKeyType", "suggest": "", "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", diff --git a/ets2panda/linter/test/main/arkts-obj-literal-key-type.ets.json b/ets2panda/linter/test/main/arkts-obj-literal-key-type.ets.json index c41e2343989fdaf2f20b1c92f4c941cf0fa1b469..0ebd77f3e553fdaf5d3d372c8c805bdf315cdf36 100644 --- a/ets2panda/linter/test/main/arkts-obj-literal-key-type.ets.json +++ b/ets2panda/linter/test/main/arkts-obj-literal-key-type.ets.json @@ -14,25 +14,55 @@ "limitations under the License." ], "result": [ - { - "line": 33, - "column": 33, - "endLine": 33, - "endColumn": 34, - "problem": "ObjectLiteralNoContextType", - "suggest": "", - "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", - "severity": "ERROR" - }, - { - "line": 37, - "column": 33, - "endLine": 37, - "endColumn": 34, - "problem": "ObjectLiteralNoContextType", - "suggest": "", - "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", - "severity": "ERROR" - } - ] + { + "line": 31, + "column": 13, + "endLine": 31, + "endColumn": 18, + "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": 33, + "endLine": 33, + "endColumn": 34, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 13, + "endLine": 35, + "endColumn": 19, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 31, + "endLine": 35, + "endColumn": 36, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 33, + "endLine": 37, + "endColumn": 34, + "problem": "ObjectLiteralNoContextType", + "suggest": "", + "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", + "severity": "ERROR" + } + ] } 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 index 8fe52e532a1eb30245b1b8202e50f2bcc636cea1..218cb8f87b8c558420264b33bb31d9565fdb73fc 100644 --- a/ets2panda/linter/test/main/destructuring_object_property_name.ets.autofix.json +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets.autofix.json @@ -24,6 +24,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 18, + "column": 3, + "endLine": 18, + "endColumn": 6, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 19, "column": 3, @@ -116,6 +126,16 @@ "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", "severity": "ERROR" }, + { + "line": 29, + "column": 4, + "endLine": 29, + "endColumn": 7, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 30, "column": 2, diff --git a/ets2panda/linter/test/main/destructuring_object_property_name.ets.json b/ets2panda/linter/test/main/destructuring_object_property_name.ets.json index 9e2606ae3554da1ed12c468605c905daef41f7ab..dfaf7f22a125429aa1e7ec5c0ae20d49ea81e7f8 100644 --- a/ets2panda/linter/test/main/destructuring_object_property_name.ets.json +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets.json @@ -24,6 +24,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 18, + "column": 3, + "endLine": 18, + "endColumn": 6, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 19, "column": 3, @@ -94,6 +104,16 @@ "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", "severity": "ERROR" }, + { + "line": 29, + "column": 4, + "endLine": 29, + "endColumn": 7, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 30, "column": 2, 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 index f816a019b5bb1d4dee8b310e2dc43a4da16bc183..d104b0838dd51443f539762d0863a3e8f97b0bd2 100644 --- a/ets2panda/linter/test/main/destructuring_object_property_name.ets.migrate.json +++ b/ets2panda/linter/test/main/destructuring_object_property_name.ets.migrate.json @@ -24,6 +24,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 18, + "column": 3, + "endLine": 18, + "endColumn": 6, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 19, "column": 3, @@ -74,6 +84,16 @@ "rule": "Destructuring assignment is not supported (arkts-no-destruct-assignment)", "severity": "ERROR" }, + { + "line": 31, + "column": 4, + "endLine": 31, + "endColumn": 7, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 32, "column": 2, diff --git a/ets2panda/linter/test/main/interface_literal_prop_name.ets.json b/ets2panda/linter/test/main/interface_literal_prop_name.ets.json index 6f68e19f773c93b033612ff79f18344ec936e933..323f3bdc20e445983761bdf23353290c1e3434ae 100644 --- a/ets2panda/linter/test/main/interface_literal_prop_name.ets.json +++ b/ets2panda/linter/test/main/interface_literal_prop_name.ets.json @@ -34,6 +34,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 31, + "column": 3, + "endLine": 31, + "endColumn": 6, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 36, "column": 3, @@ -44,6 +54,26 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 37, + "column": 3, + "endLine": 37, + "endColumn": 6, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 3, + "endLine": 38, + "endColumn": 7, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 43, "column": 10, @@ -64,6 +94,26 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 51, + "column": 3, + "endLine": 51, + "endColumn": 6, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 52, + "column": 3, + "endLine": 52, + "endColumn": 7, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 57, "column": 3, @@ -73,6 +123,16 @@ "suggest": "", "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" + }, + { + "line": 58, + "column": 3, + "endLine": 58, + "endColumn": 6, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.arkts2.json b/ets2panda/linter/test/main/literals_as_prop_names.ets.arkts2.json index c2fdcec6c082a9d006877612d83ebdf73955c3c2..f094451863721a0c420b22ef8bdda803879e4f18 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.arkts2.json +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.arkts2.json @@ -49,9 +49,9 @@ "column": 3, "endLine": 32, "endColumn": 4, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -59,9 +59,9 @@ "column": 3, "endLine": 33, "endColumn": 8, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -104,26 +104,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, - { - "line": 57, - "column": 10, - "endLine": 57, - "endColumn": 16, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, - { - "line": 57, - "column": 22, - "endLine": 57, - "endColumn": 23, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 59, "column": 13, @@ -189,9 +169,9 @@ "column": 3, "endLine": 80, "endColumn": 4, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -199,9 +179,9 @@ "column": 3, "endLine": 81, "endColumn": 8, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -209,9 +189,9 @@ "column": 36, "endLine": 84, "endColumn": 37, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -339,9 +319,9 @@ "column": 13, "endLine": 128, "endColumn": 18, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -358,7 +338,7 @@ "line": 136, "column": 3, "endLine": 136, - "endColumn": 15, + "endColumn": 12, "problem": "ObjectLiteralKeyType", "suggest": "", "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.autofix.json b/ets2panda/linter/test/main/literals_as_prop_names.ets.autofix.json index cb3ffe0ff9d0ee13ff642be1c3e1075ca4bcf1a8..353c9e527250144e48d4ec5d566673aeb4a19174 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.autofix.json +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.autofix.json @@ -127,38 +127,9 @@ "column": 3, "endLine": 32, "endColumn": 4, - "problem": "LiteralAsPropertyName", - "autofix": [ - { - "replacementText": "__2", - "start": 836, - "end": 837, - "line": 37, - "column": 13, - "endLine": 37, - "endColumn": 29 - }, - { - "replacementText": "__2", - "start": 928, - "end": 929, - "line": 37, - "column": 13, - "endLine": 37, - "endColumn": 29 - }, - { - "replacementText": "litAsPropName.__2", - "start": 1001, - "end": 1017, - "line": 37, - "column": 13, - "endLine": 37, - "endColumn": 29 - } - ], + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -166,38 +137,9 @@ "column": 3, "endLine": 33, "endColumn": 8, - "problem": "LiteralAsPropertyName", - "autofix": [ - { - "replacementText": "Two", - "start": 849, - "end": 854, - "line": 38, - "column": 13, - "endLine": 38, - "endColumn": 33 - }, - { - "replacementText": "Two", - "start": 940, - "end": 945, - "line": 38, - "column": 13, - "endLine": 38, - "endColumn": 33 - }, - { - "replacementText": "litAsPropName.Two", - "start": 1032, - "end": 1052, - "line": 38, - "column": 13, - "endLine": 38, - "endColumn": 33 - } - ], + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -309,26 +251,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, - { - "line": 57, - "column": 10, - "endLine": 57, - "endColumn": 16, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, - { - "line": 57, - "column": 22, - "endLine": 57, - "endColumn": 23, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 59, "column": 13, @@ -390,18 +312,18 @@ "replacementText": "___2", "start": 1726, "end": 1727, - "line": 80, + "line": 75, "column": 3, - "endLine": 80, + "endLine": 75, "endColumn": 4 }, { "replacementText": "___2", "start": 1808, "end": 1809, - "line": 80, + "line": 75, "column": 3, - "endLine": 80, + "endLine": 75, "endColumn": 4 } ], @@ -420,18 +342,18 @@ "replacementText": "__2", "start": 1739, "end": 1744, - "line": 81, + "line": 76, "column": 3, - "endLine": 81, + "endLine": 76, "endColumn": 8 }, { "replacementText": "__2", "start": 1824, "end": 1829, - "line": 81, + "line": 76, "column": 3, - "endLine": 81, + "endLine": 76, "endColumn": 8 } ], @@ -454,29 +376,9 @@ "column": 3, "endLine": 80, "endColumn": 4, - "problem": "LiteralAsPropertyName", - "autofix": [ - { - "replacementText": "___2", - "start": 1726, - "end": 1727, - "line": 80, - "column": 3, - "endLine": 80, - "endColumn": 4 - }, - { - "replacementText": "___2", - "start": 1808, - "end": 1809, - "line": 80, - "column": 3, - "endLine": 80, - "endColumn": 4 - } - ], + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -484,29 +386,9 @@ "column": 3, "endLine": 81, "endColumn": 8, - "problem": "LiteralAsPropertyName", - "autofix": [ - { - "replacementText": "__2", - "start": 1739, - "end": 1744, - "line": 81, - "column": 3, - "endLine": 81, - "endColumn": 8 - }, - { - "replacementText": "__2", - "start": 1824, - "end": 1829, - "line": 81, - "column": 3, - "endLine": 81, - "endColumn": 8 - } - ], + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -514,9 +396,9 @@ "column": 36, "endLine": 84, "endColumn": 37, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -748,20 +630,9 @@ "column": 13, "endLine": 128, "endColumn": 18, - "problem": "LiteralAsPropertyName", - "autofix": [ - { - "replacementText": "age", - "start": 2432, - "end": 2437, - "line": 128, - "column": 13, - "endLine": 128, - "endColumn": 18 - } - ], + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -789,7 +660,7 @@ "line": 136, "column": 3, "endLine": 136, - "endColumn": 15, + "endColumn": 12, "problem": "ObjectLiteralKeyType", "suggest": "", "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.json b/ets2panda/linter/test/main/literals_as_prop_names.ets.json index dfce9f6d57c2bbbe9c5508988e3349826cbbdd2d..67551a2d06c68cd5f8c820c47e5c5f24de1232f9 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.json +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.json @@ -34,6 +34,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 33, + "column": 3, + "endLine": 33, + "endColumn": 8, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 36, "column": 13, @@ -74,6 +84,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 57, + "column": 10, + "endLine": 57, + "endColumn": 16, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 57, "column": 22, @@ -134,6 +154,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 81, + "column": 3, + "endLine": 81, + "endColumn": 8, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 84, "column": 36, @@ -144,6 +174,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 128, + "column": 13, + "endLine": 128, + "endColumn": 18, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 142, "column": 3, diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.ets b/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.ets index c4a325d399ce794b1cd44ace736c041f158a8705..cfe2c22819d9f63eba12ba0d098c099764c901a5 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.ets +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.ets @@ -134,7 +134,7 @@ class A{ public age:number = 1; } -let a:A = { age: 30} +let a:A = { "age": 30} class B { diff --git a/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.json b/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.json index f6c728a06ac978d82fa8ed2797d0de8be6f71d97..46bd0dfc2b394ad37a46306567e3fcbb34ff3928 100644 --- a/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.json +++ b/ets2panda/linter/test/main/literals_as_prop_names.ets.migrate.json @@ -24,26 +24,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, - { - "line": 62, - "column": 10, - "endLine": 62, - "endColumn": 16, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, - { - "line": 62, - "column": 22, - "endLine": 62, - "endColumn": 23, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 64, "column": 13, @@ -79,9 +59,9 @@ "column": 36, "endLine": 93, "endColumn": 37, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -94,11 +74,21 @@ "rule": "Enum cannot get member name by member value (arkts-enum-no-props-by-index)", "severity": "ERROR" }, + { + "line": 137, + "column": 13, + "endLine": 137, + "endColumn": 18, + "problem": "ObjectLiteralKeyType", + "suggest": "", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", + "severity": "ERROR" + }, { "line": 145, "column": 3, "endLine": 145, - "endColumn": 15, + "endColumn": 12, "problem": "ObjectLiteralKeyType", "suggest": "", "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", diff --git a/ets2panda/linter/test/main/numeric_semantics2.ets.arkts2.json b/ets2panda/linter/test/main/numeric_semantics2.ets.arkts2.json index 7eee5ba0ef8186898cd80b87f4d6f73304e5da73..12f28e66711f937726a80b38848564117619c283 100755 --- a/ets2panda/linter/test/main/numeric_semantics2.ets.arkts2.json +++ b/ets2panda/linter/test/main/numeric_semantics2.ets.arkts2.json @@ -89,9 +89,9 @@ "column": 18, "endLine": 37, "endColumn": 24, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -99,9 +99,9 @@ "column": 32, "endLine": 37, "endColumn": 33, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -124,16 +124,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, - { - "line": 42, - "column": 30, - "endLine": 42, - "endColumn": 31, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 44, "column": 17, diff --git a/ets2panda/linter/test/main/numeric_semantics2.ets.autofix.json b/ets2panda/linter/test/main/numeric_semantics2.ets.autofix.json index cc194db2026827a6b21dd6a0c50fb890c2823fda..d671e2706faab7c752d987cf09f2a6f24b173a4b 100644 --- a/ets2panda/linter/test/main/numeric_semantics2.ets.autofix.json +++ b/ets2panda/linter/test/main/numeric_semantics2.ets.autofix.json @@ -65,19 +65,19 @@ "replacementText": "name", "start": 1117, "end": 1123, - "line": 37, - "column": 18, - "endLine": 37, - "endColumn": 24 + "line": 35, + "column": 20, + "endLine": 35, + "endColumn": 26 }, { "replacementText": "name", "start": 1210, "end": 1216, - "line": 37, - "column": 18, - "endLine": 37, - "endColumn": 24 + "line": 35, + "column": 20, + "endLine": 35, + "endColumn": 26 } ], "suggest": "", @@ -149,29 +149,9 @@ "column": 18, "endLine": 37, "endColumn": 24, - "problem": "LiteralAsPropertyName", - "autofix": [ - { - "replacementText": "name", - "start": 1117, - "end": 1123, - "line": 37, - "column": 18, - "endLine": 37, - "endColumn": 24 - }, - { - "replacementText": "name", - "start": 1210, - "end": 1216, - "line": 37, - "column": 18, - "endLine": 37, - "endColumn": 24 - } - ], + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -179,38 +159,9 @@ "column": 32, "endLine": 37, "endColumn": 33, - "problem": "LiteralAsPropertyName", - "autofix": [ - { - "replacementText": "__2", - "start": 1133, - "end": 1134, - "line": 38, - "column": 17, - "endLine": 38, - "endColumn": 21 - }, - { - "replacementText": "__2", - "start": 1224, - "end": 1225, - "line": 38, - "column": 17, - "endLine": 38, - "endColumn": 21 - }, - { - "replacementText": "x.__2", - "start": 1256, - "end": 1260, - "line": 38, - "column": 17, - "endLine": 38, - "endColumn": 21 - } - ], + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -262,16 +213,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, - { - "line": 42, - "column": 30, - "endLine": 42, - "endColumn": 31, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 44, "column": 17, diff --git a/ets2panda/linter/test/main/numeric_semantics2.ets.json b/ets2panda/linter/test/main/numeric_semantics2.ets.json index af8a3e440fd6719874e75c8e07504feac3577cd7..8a8c673288e2c3df5153d902e0072cef1bc9a602 100755 --- a/ets2panda/linter/test/main/numeric_semantics2.ets.json +++ b/ets2panda/linter/test/main/numeric_semantics2.ets.json @@ -64,6 +64,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 37, + "column": 18, + "endLine": 37, + "endColumn": 24, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 37, "column": 32, diff --git a/ets2panda/linter/test/main/numeric_semantics2.ets.migrate.json b/ets2panda/linter/test/main/numeric_semantics2.ets.migrate.json index 427546b36a021225fa36846e3226e87339f62896..f2d1d9a281fa87364de772b606e7c77aca3299f3 100644 --- a/ets2panda/linter/test/main/numeric_semantics2.ets.migrate.json +++ b/ets2panda/linter/test/main/numeric_semantics2.ets.migrate.json @@ -64,16 +64,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, - { - "line": 42, - "column": 30, - "endLine": 42, - "endColumn": 31, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 44, "column": 17, diff --git a/ets2panda/linter/test/main/object_literals_autofixes.ets.autofix.json b/ets2panda/linter/test/main/object_literals_autofixes.ets.autofix.json index 5f107cd9acf91e6c0e34bb23e215062f712baa54..919b9ae1f271465ebb7ea8ec70df45ff071b7d1e 100644 --- a/ets2panda/linter/test/main/object_literals_autofixes.ets.autofix.json +++ b/ets2panda/linter/test/main/object_literals_autofixes.ets.autofix.json @@ -34,12 +34,20 @@ { "start": 1131, "end": 1131, - "replacementText": "interface GeneratedObjectLiteralInterface_1 {\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_1 {\n}\n", + "line": 33, + "column": 12, + "endLine": 33, + "endColumn": 13 }, { "start": 1139, "end": 1139, - "replacementText": ": GeneratedObjectLiteralInterface_1" + "replacementText": ": GeneratedObjectLiteralInterface_1", + "line": 33, + "column": 12, + "endLine": 33, + "endColumn": 13 } ], "suggest": "", @@ -56,12 +64,20 @@ { "start": 1146, "end": 1146, - "replacementText": "interface GeneratedObjectLiteralInterface_2 {\n hello: string;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_2 {\n hello: string;\n}\n", + "line": 34, + "column": 12, + "endLine": 34, + "endColumn": 13 }, { "start": 1154, "end": 1154, - "replacementText": ": GeneratedObjectLiteralInterface_2" + "replacementText": ": GeneratedObjectLiteralInterface_2", + "line": 34, + "column": 12, + "endLine": 34, + "endColumn": 13 } ], "suggest": "", @@ -88,12 +104,20 @@ { "start": 1177, "end": 1177, - "replacementText": "interface GeneratedObjectLiteralInterface_3 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_3 {\n a: number;\n b: number;\n}\n", + "line": 35, + "column": 13, + "endLine": 35, + "endColumn": 14 }, { "start": 1186, "end": 1186, - "replacementText": ": GeneratedObjectLiteralInterface_3" + "replacementText": ": GeneratedObjectLiteralInterface_3", + "line": 35, + "column": 13, + "endLine": 35, + "endColumn": 14 } ], "suggest": "", @@ -110,12 +134,20 @@ { "start": 1203, "end": 1203, - "replacementText": "interface GeneratedObjectLiteralInterface_5 {\n field: string;\n field1: number;\n field2: string;\n field3: number;\n field4: boolean;\n field5: boolean;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_5 {\n field: string;\n field1: number;\n field2: string;\n field3: number;\n field4: boolean;\n field5: boolean;\n}\n", + "line": 36, + "column": 12, + "endLine": 36, + "endColumn": 13 }, { "start": 1211, "end": 1211, - "replacementText": ": GeneratedObjectLiteralInterface_5" + "replacementText": ": GeneratedObjectLiteralInterface_5", + "line": 36, + "column": 12, + "endLine": 36, + "endColumn": 13 } ], "suggest": "", @@ -142,12 +174,20 @@ { "start": 1385, "end": 1385, - "replacementText": "interface GeneratedObjectLiteralInterface_6 {\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_6 {\n}\n", + "line": 51, + "column": 8, + "endLine": 51, + "endColumn": 9 }, { "start": 1464, "end": 1466, - "replacementText": "({} as GeneratedObjectLiteralInterface_6)" + "replacementText": "({} as GeneratedObjectLiteralInterface_6)", + "line": 51, + "column": 8, + "endLine": 51, + "endColumn": 9 } ], "suggest": "", @@ -164,12 +204,20 @@ { "start": 1385, "end": 1385, - "replacementText": "interface GeneratedObjectLiteralInterface_10 {\n a: number;\n b: string;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_10 {\n a: number;\n b: string;\n}\n", + "line": 52, + "column": 8, + "endLine": 52, + "endColumn": 9 }, { "start": 1475, "end": 1491, - "replacementText": "({ a: 1, b: '2' } as GeneratedObjectLiteralInterface_10)" + "replacementText": "({ a: 1, b: '2' } as GeneratedObjectLiteralInterface_10)", + "line": 52, + "column": 8, + "endLine": 52, + "endColumn": 9 } ], "suggest": "", @@ -186,12 +234,20 @@ { "start": 1385, "end": 1385, - "replacementText": "interface GeneratedObjectLiteralInterface_13 {\n q: number;\n w: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_13 {\n q: number;\n w: number;\n}\n", + "line": 53, + "column": 8, + "endLine": 53, + "endColumn": 9 }, { "start": 1500, "end": 1536, - "replacementText": "({ q: 10,\n w: 20 } as GeneratedObjectLiteralInterface_13)" + "replacementText": "({ q: 10,\n w: 20 } as GeneratedObjectLiteralInterface_13)", + "line": 53, + "column": 8, + "endLine": 53, + "endColumn": 9 } ], "suggest": "", @@ -218,12 +274,20 @@ { "start": 1541, "end": 1541, - "replacementText": "interface GeneratedObjectLiteralInterface_14 {\n q: number;\n w: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_14 {\n q: number;\n w: number;\n}\n", + "line": 61, + "column": 8, + "endLine": 61, + "endColumn": 9 }, { "start": 1583, "end": 1599, - "replacementText": "({ q: 10, w: 20 } as GeneratedObjectLiteralInterface_14)" + "replacementText": "({ q: 10, w: 20 } as GeneratedObjectLiteralInterface_14)", + "line": 61, + "column": 8, + "endLine": 61, + "endColumn": 9 } ], "suggest": "", @@ -240,12 +304,20 @@ { "start": 1541, "end": 1541, - "replacementText": "interface GeneratedObjectLiteralInterface_16 {\n q: number;\n w: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_16 {\n q: number;\n w: number;\n}\n", + "line": 63, + "column": 8, + "endLine": 63, + "endColumn": 9 }, { "start": 1621, "end": 1637, - "replacementText": "({ q: 30, w: 40 } as GeneratedObjectLiteralInterface_16)" + "replacementText": "({ q: 30, w: 40 } as GeneratedObjectLiteralInterface_16)", + "line": 63, + "column": 8, + "endLine": 63, + "endColumn": 9 } ], "suggest": "", @@ -262,12 +334,20 @@ { "start": 1687, "end": 1687, - "replacementText": "interface GeneratedObjectLiteralInterface_17 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_17 {\n a: number;\n b: number;\n}\n", + "line": 67, + "column": 12, + "endLine": 67, + "endColumn": 13 }, { "start": 1698, "end": 1710, - "replacementText": "({ a: 1, b: 2 } as GeneratedObjectLiteralInterface_17)" + "replacementText": "({ a: 1, b: 2 } as GeneratedObjectLiteralInterface_17)", + "line": 67, + "column": 12, + "endLine": 67, + "endColumn": 13 } ], "suggest": "", @@ -284,12 +364,20 @@ { "start": 1687, "end": 1687, - "replacementText": "interface GeneratedObjectLiteralInterface_18 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_18 {\n a: number;\n b: number;\n}\n", + "line": 67, + "column": 29, + "endLine": 67, + "endColumn": 30 }, { "start": 1715, "end": 1727, - "replacementText": "({ a: 3, b: 4 } as GeneratedObjectLiteralInterface_18)" + "replacementText": "({ a: 3, b: 4 } as GeneratedObjectLiteralInterface_18)", + "line": 67, + "column": 29, + "endLine": 67, + "endColumn": 30 } ], "suggest": "", @@ -316,12 +404,20 @@ { "start": 1731, "end": 1731, - "replacementText": "interface GeneratedObjectLiteralInterface_19 {\n x: number;\n y: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_19 {\n x: number;\n y: number;\n}\n", + "line": 71, + "column": 9, + "endLine": 71, + "endColumn": 10 }, { "start": 1773, "end": 1783, - "replacementText": "{ x: 1, y: 2 } as GeneratedObjectLiteralInterface_19" + "replacementText": "{ x: 1, y: 2 } as GeneratedObjectLiteralInterface_19", + "line": 71, + "column": 9, + "endLine": 71, + "endColumn": 10 } ], "suggest": "", @@ -338,12 +434,20 @@ { "start": 1731, "end": 1731, - "replacementText": "interface GeneratedObjectLiteralInterface_20 {\n q: number;\n w: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_20 {\n q: number;\n w: number;\n}\n", + "line": 72, + "column": 12, + "endLine": 72, + "endColumn": 13 }, { "start": 1797, "end": 1807, - "replacementText": "({ q: 1, w: 2 } as GeneratedObjectLiteralInterface_20)" + "replacementText": "({ q: 1, w: 2 } as GeneratedObjectLiteralInterface_20)", + "line": 72, + "column": 12, + "endLine": 72, + "endColumn": 13 } ], "suggest": "", @@ -360,12 +464,20 @@ { "start": 1731, "end": 1731, - "replacementText": "interface GeneratedObjectLiteralInterface_21 {\n q: number;\n w: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_21 {\n q: number;\n w: number;\n}\n", + "line": 72, + "column": 27, + "endLine": 72, + "endColumn": 28 }, { "start": 1812, "end": 1822, - "replacementText": "({ q: 3, w: 4 } as GeneratedObjectLiteralInterface_21)" + "replacementText": "({ q: 3, w: 4 } as GeneratedObjectLiteralInterface_21)", + "line": 72, + "column": 27, + "endLine": 72, + "endColumn": 28 } ], "suggest": "", @@ -382,12 +494,20 @@ { "start": 1874, "end": 1874, - "replacementText": "interface GeneratedObjectLiteralInterface_22 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_22 {\n a: number;\n b: number;\n}\n", + "line": 77, + "column": 10, + "endLine": 77, + "endColumn": 11 }, { "start": 1890, "end": 1890, - "replacementText": ": GeneratedObjectLiteralInterface_22" + "replacementText": ": GeneratedObjectLiteralInterface_22", + "line": 77, + "column": 10, + "endLine": 77, + "endColumn": 11 } ], "suggest": "", @@ -404,12 +524,20 @@ { "start": 1874, "end": 1874, - "replacementText": "interface GeneratedObjectLiteralInterface_23 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_23 {\n a: number;\n b: number;\n}\n", + "line": 78, + "column": 11, + "endLine": 78, + "endColumn": 12 }, { "start": 1914, "end": 1914, - "replacementText": ": GeneratedObjectLiteralInterface_23" + "replacementText": ": GeneratedObjectLiteralInterface_23", + "line": 78, + "column": 11, + "endLine": 78, + "endColumn": 12 } ], "suggest": "", @@ -436,12 +564,20 @@ { "start": 1874, "end": 1874, - "replacementText": "interface GeneratedObjectLiteralInterface_24 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_24 {\n a: number;\n b: number;\n}\n", + "line": 79, + "column": 11, + "endLine": 79, + "endColumn": 12 }, { "start": 1938, "end": 1938, - "replacementText": ": GeneratedObjectLiteralInterface_24" + "replacementText": ": GeneratedObjectLiteralInterface_24", + "line": 79, + "column": 11, + "endLine": 79, + "endColumn": 12 } ], "suggest": "", @@ -458,12 +594,20 @@ { "start": 1874, "end": 1874, - "replacementText": "interface GeneratedObjectLiteralInterface_25 {\n c: number;\n d: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_25 {\n c: number;\n d: number;\n}\n", + "line": 80, + "column": 11, + "endLine": 80, + "endColumn": 12 }, { "start": 1965, "end": 1977, - "replacementText": "{ c: 3, d: 4 } as GeneratedObjectLiteralInterface_25" + "replacementText": "{ c: 3, d: 4 } as GeneratedObjectLiteralInterface_25", + "line": 80, + "column": 11, + "endLine": 80, + "endColumn": 12 } ], "suggest": "", @@ -480,12 +624,20 @@ { "start": 1874, "end": 1874, - "replacementText": "interface GeneratedObjectLiteralInterface_26 {\n e: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_26 {\n e: number;\n}\n", + "line": 81, + "column": 10, + "endLine": 81, + "endColumn": 11 }, { "start": 1989, "end": 1995, - "replacementText": "({ e: 5 } as GeneratedObjectLiteralInterface_26)" + "replacementText": "({ e: 5 } as GeneratedObjectLiteralInterface_26)", + "line": 81, + "column": 10, + "endLine": 81, + "endColumn": 11 } ], "suggest": "", @@ -502,12 +654,20 @@ { "start": 1874, "end": 1874, - "replacementText": "interface GeneratedObjectLiteralInterface_27 {\n f: number;\n g: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_27 {\n f: number;\n g: number;\n}\n", + "line": 81, + "column": 21, + "endLine": 81, + "endColumn": 22 }, { "start": 2000, "end": 2012, - "replacementText": "({ f: 6, g: 7 } as GeneratedObjectLiteralInterface_27)" + "replacementText": "({ f: 6, g: 7 } as GeneratedObjectLiteralInterface_27)", + "line": 81, + "column": 21, + "endLine": 81, + "endColumn": 22 } ], "suggest": "", @@ -524,12 +684,20 @@ { "start": 1874, "end": 1874, - "replacementText": "interface GeneratedObjectLiteralInterface_28 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_28 {\n a: number;\n b: number;\n}\n", + "line": 84, + "column": 17, + "endLine": 84, + "endColumn": 18 }, { "start": 2040, "end": 2040, - "replacementText": ": GeneratedObjectLiteralInterface_28" + "replacementText": ": GeneratedObjectLiteralInterface_28", + "line": 84, + "column": 17, + "endLine": 84, + "endColumn": 18 } ], "suggest": "", @@ -546,12 +714,20 @@ { "start": 1874, "end": 1874, - "replacementText": "interface GeneratedObjectLiteralInterface_29 {\n c: number;\n d: number;\n e: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_29 {\n c: number;\n d: number;\n e: number;\n}\n", + "line": 85, + "column": 17, + "endLine": 85, + "endColumn": 18 }, { "start": 2068, "end": 2068, - "replacementText": ": GeneratedObjectLiteralInterface_29" + "replacementText": ": GeneratedObjectLiteralInterface_29", + "line": 85, + "column": 17, + "endLine": 85, + "endColumn": 18 } ], "suggest": "", @@ -568,12 +744,20 @@ { "start": 2150, "end": 2150, - "replacementText": "interface GeneratedObjectLiteralInterface_30 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_30 {\n a: number;\n b: number;\n}\n", + "line": 90, + "column": 22, + "endLine": 90, + "endColumn": 23 }, { "start": 2168, "end": 2168, - "replacementText": ": GeneratedObjectLiteralInterface_30" + "replacementText": ": GeneratedObjectLiteralInterface_30", + "line": 90, + "column": 22, + "endLine": 90, + "endColumn": 23 } ], "suggest": "", @@ -610,12 +794,20 @@ { "start": 2408, "end": 2408, - "replacementText": "interface GeneratedObjectLiteralInterface_31 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_31 {\n a: number;\n b: number;\n}\n", + "line": 95, + "column": 13, + "endLine": 95, + "endColumn": 14 }, { "start": 2440, "end": 2440, - "replacementText": ": GeneratedObjectLiteralInterface_31" + "replacementText": ": GeneratedObjectLiteralInterface_31", + "line": 95, + "column": 13, + "endLine": 95, + "endColumn": 14 } ], "suggest": "", @@ -632,12 +824,20 @@ { "start": 2408, "end": 2408, - "replacementText": "interface GeneratedObjectLiteralInterface_32 {\n c: number;\n d: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_32 {\n c: number;\n d: number;\n}\n", + "line": 96, + "column": 13, + "endLine": 96, + "endColumn": 14 }, { "start": 2466, "end": 2466, - "replacementText": ": GeneratedObjectLiteralInterface_32" + "replacementText": ": GeneratedObjectLiteralInterface_32", + "line": 96, + "column": 13, + "endLine": 96, + "endColumn": 14 } ], "suggest": "", @@ -654,12 +854,20 @@ { "start": 2408, "end": 2408, - "replacementText": "interface GeneratedObjectLiteralInterface_33 {\n e: number;\n f: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_33 {\n e: number;\n f: number;\n}\n", + "line": 99, + "column": 17, + "endLine": 99, + "endColumn": 18 }, { "start": 2518, "end": 2518, - "replacementText": ": GeneratedObjectLiteralInterface_33" + "replacementText": ": GeneratedObjectLiteralInterface_33", + "line": 99, + "column": 17, + "endLine": 99, + "endColumn": 18 } ], "suggest": "", @@ -676,12 +884,20 @@ { "start": 2408, "end": 2408, - "replacementText": "interface GeneratedObjectLiteralInterface_34 {\n g: number;\n d: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_34 {\n g: number;\n d: number;\n}\n", + "line": 102, + "column": 13, + "endLine": 102, + "endColumn": 14 }, { "start": 2551, "end": 2551, - "replacementText": ": GeneratedObjectLiteralInterface_34" + "replacementText": ": GeneratedObjectLiteralInterface_34", + "line": 102, + "column": 13, + "endLine": 102, + "endColumn": 14 } ], "suggest": "", @@ -698,12 +914,20 @@ { "start": 2408, "end": 2408, - "replacementText": "interface GeneratedObjectLiteralInterface_35 {\n q: number;\n w: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_35 {\n q: number;\n w: number;\n}\n", + "line": 102, + "column": 27, + "endLine": 102, + "endColumn": 28 }, { "start": 2568, "end": 2577, - "replacementText": "({ q: 1, w: 2 } as GeneratedObjectLiteralInterface_35)" + "replacementText": "({ q: 1, w: 2 } as GeneratedObjectLiteralInterface_35)", + "line": 102, + "column": 27, + "endLine": 102, + "endColumn": 28 } ], "suggest": "", @@ -720,12 +944,20 @@ { "start": 2408, "end": 2408, - "replacementText": "interface GeneratedObjectLiteralInterface_36 {\n q: number;\n w: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_36 {\n q: number;\n w: number;\n}\n", + "line": 102, + "column": 41, + "endLine": 102, + "endColumn": 42 }, { "start": 2582, "end": 2591, - "replacementText": "({ q: 3, w: 4 } as GeneratedObjectLiteralInterface_36)" + "replacementText": "({ q: 3, w: 4 } as GeneratedObjectLiteralInterface_36)", + "line": 102, + "column": 41, + "endLine": 102, + "endColumn": 42 } ], "suggest": "", @@ -752,6 +984,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 105, + "column": 22, + "endLine": 105, + "endColumn": 25, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 106, "column": 13, @@ -852,12 +1094,20 @@ { "start": 3051, "end": 3051, - "replacementText": "class GeneratedObjectLiteralClass_1 {\n m() { }\n}\n\n" + "replacementText": "class GeneratedObjectLiteralClass_1 {\n m() { }\n}\n\n", + "line": 115, + "column": 13, + "endLine": 115, + "endColumn": 14 }, { "start": 3063, "end": 3073, - "replacementText": "new GeneratedObjectLiteralClass_1()" + "replacementText": "new GeneratedObjectLiteralClass_1()", + "line": 115, + "column": 13, + "endLine": 115, + "endColumn": 14 } ], "suggest": "", @@ -924,7 +1174,11 @@ { "start": 3759, "end": 3799, - "replacementText": "interface LocalType {\n a: number;\n b: string;\n}" + "replacementText": "interface LocalType {\n a: number;\n b: string;\n}", + "line": 134, + "column": 22, + "endLine": 134, + "endColumn": 23 } ], "suggest": "", @@ -1001,17 +1255,29 @@ { "start": 4281, "end": 4282, - "replacementText": "\"a\"" + "replacementText": "\"a\"", + "line": 145, + "column": 33, + "endLine": 145, + "endColumn": 34 }, { "start": 4291, "end": 4292, - "replacementText": "\"b\"" + "replacementText": "\"b\"", + "line": 145, + "column": 33, + "endLine": 145, + "endColumn": 34 }, { "start": 4301, "end": 4302, - "replacementText": "\"c\"" + "replacementText": "\"c\"", + "line": 145, + "column": 33, + "endLine": 145, + "endColumn": 34 } ], "suggest": "", @@ -1038,17 +1304,29 @@ { "start": 4356, "end": 4359, - "replacementText": "\"foo\"" + "replacementText": "\"foo\"", + "line": 151, + "column": 42, + "endLine": 151, + "endColumn": 43 }, { "start": 4368, "end": 4371, - "replacementText": "\"bar\"" + "replacementText": "\"bar\"", + "line": 151, + "column": 42, + "endLine": 151, + "endColumn": 43 }, { "start": 4410, "end": 4413, - "replacementText": "\"baz\"" + "replacementText": "\"baz\"", + "line": 151, + "column": 42, + "endLine": 151, + "endColumn": 43 } ], "suggest": "", @@ -1105,12 +1383,20 @@ { "start": 4701, "end": 4704, - "replacementText": "\"key\"" + "replacementText": "\"key\"", + "line": 171, + "column": 13, + "endLine": 171, + "endColumn": 14 }, { "start": 4719, "end": 4726, - "replacementText": "\"message\"" + "replacementText": "\"message\"", + "line": 171, + "column": 13, + "endLine": 171, + "endColumn": 14 } ], "suggest": "", diff --git a/ets2panda/linter/test/main/object_literals_autofixes.ets.json b/ets2panda/linter/test/main/object_literals_autofixes.ets.json index ff838327c3663578824e6dc51fac496988831862..64ef2e22c1639978585dba7e13f3535698779448 100644 --- a/ets2panda/linter/test/main/object_literals_autofixes.ets.json +++ b/ets2panda/linter/test/main/object_literals_autofixes.ets.json @@ -404,6 +404,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 105, + "column": 22, + "endLine": 105, + "endColumn": 25, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 106, "column": 13, diff --git a/ets2panda/linter/test/main/object_literals_autofixes.ets.migrate.json b/ets2panda/linter/test/main/object_literals_autofixes.ets.migrate.json index e69f8c28502e98e3389a8c244620b123c4cd1ca1..4526e7c2c56bcb761063266bd70ca5ff0a1936ba 100644 --- a/ets2panda/linter/test/main/object_literals_autofixes.ets.migrate.json +++ b/ets2panda/linter/test/main/object_literals_autofixes.ets.migrate.json @@ -84,6 +84,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 240, + "column": 22, + "endLine": 240, + "endColumn": 25, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 241, "column": 13, diff --git a/ets2panda/linter/test/main/types.ets.autofix.json b/ets2panda/linter/test/main/types.ets.autofix.json index 7eb21c4bca928fa17ded06c1872067415840c9b7..1d918e5be97473e497664891fd7c40a200913719 100644 --- a/ets2panda/linter/test/main/types.ets.autofix.json +++ b/ets2panda/linter/test/main/types.ets.autofix.json @@ -54,12 +54,20 @@ { "start": 610, "end": 610, - "replacementText": "interface GeneratedObjectLiteralInterface_1 {\n name: string;\n idx: number;\n handler: string;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_1 {\n name: string;\n idx: number;\n handler: string;\n}\n", + "line": 26, + "column": 18, + "endLine": 26, + "endColumn": 19 }, { "start": 829, "end": 829, - "replacementText": ": GeneratedObjectLiteralInterface_1" + "replacementText": ": GeneratedObjectLiteralInterface_1", + "line": 26, + "column": 18, + "endLine": 26, + "endColumn": 19 } ], "suggest": "", @@ -76,7 +84,11 @@ { "start": 969, "end": 1007, - "replacementText": "interface Point {\n x: number;\n y: number;\n}" + "replacementText": "interface Point {\n x: number;\n y: number;\n}", + "line": 32, + "column": 16, + "endLine": 32, + "endColumn": 17 } ], "suggest": "", @@ -123,7 +135,11 @@ { "start": 1235, "end": 1313, - "replacementText": "let isNumber: (x: any) => x is number = (x: any): x is number => {\n return typeof x === 'number';\n};" + "replacementText": "let isNumber: (x: any) => x is number = (x: any): x is number => {\n return typeof x === 'number';\n};", + "line": 43, + "column": 3, + "endLine": 43, + "endColumn": 11 } ], "suggest": "", @@ -160,7 +176,11 @@ { "start": 1405, "end": 1570, - "replacementText": "interface ComputedPropertyT {\n a: string; // String-like name\n 5: string; // Number-like name\n [c]: string; // String-like name\n [d]: string; // Number-like name\n}" + "replacementText": "interface ComputedPropertyT {\n a: string; // String-like name\n 5: string; // Number-like name\n [c]: string; // String-like name\n [d]: string; // Number-like name\n}", + "line": 54, + "column": 26, + "endLine": 54, + "endColumn": 27 } ], "suggest": "", @@ -207,12 +227,20 @@ { "replacementText": "__2", "start": 1604, - "end": 1605 + "end": 1605, + "line": 67, + "column": 3, + "endLine": 67, + "endColumn": 4 }, { "replacementText": "__2", "start": 1684, - "end": 1685 + "end": 1685, + "line": 67, + "column": 3, + "endLine": 67, + "endColumn": 4 } ], "suggest": "", @@ -229,12 +257,50 @@ { "replacementText": "__2", "start": 1604, - "end": 1605 + "end": 1605, + "line": 67, + "column": 3, + "endLine": 67, + "endColumn": 4 }, { "replacementText": "__2", "start": 1684, - "end": 1685 + "end": 1685, + "line": 67, + "column": 3, + "endLine": 67, + "endColumn": 4 + } + ], + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 68, + "column": 3, + "endLine": 68, + "endColumn": 8, + "problem": "LiteralAsPropertyName", + "autofix": [ + { + "replacementText": "Two", + "start": 1617, + "end": 1622, + "line": 68, + "column": 3, + "endLine": 68, + "endColumn": 8 + }, + { + "replacementText": "Two", + "start": 1696, + "end": 1701, + "line": 68, + "column": 3, + "endLine": 68, + "endColumn": 8 } ], "suggest": "", @@ -251,7 +317,11 @@ { "start": 1710, "end": 1758, - "replacementText": "interface Dictionary {\n [key: string]: unknown;\n}" + "replacementText": "interface Dictionary {\n [key: string]: unknown;\n}", + "line": 71, + "column": 19, + "endLine": 71, + "endColumn": 20 } ], "suggest": "", @@ -328,7 +398,11 @@ { "start": 1999, "end": 2083, - "replacementText": "interface DescribableFunction {\n description: string;\n (someArg: number): boolean;\n}" + "replacementText": "interface DescribableFunction {\n description: string;\n (someArg: number): boolean;\n}", + "line": 94, + "column": 28, + "endLine": 94, + "endColumn": 29 } ], "suggest": "", @@ -355,12 +429,20 @@ { "start": 2405, "end": 2405, - "replacementText": "interface GeneratedTypeLiteralInterface_1 {\n x: 2;\n}\n" + "replacementText": "interface GeneratedTypeLiteralInterface_1 {\n x: 2;\n}\n", + "line": 111, + "column": 19, + "endLine": 111, + "endColumn": 20 }, { "start": 2423, "end": 2431, - "replacementText": "GeneratedTypeLiteralInterface_1" + "replacementText": "GeneratedTypeLiteralInterface_1", + "line": 111, + "column": 19, + "endLine": 111, + "endColumn": 20 } ], "suggest": "", @@ -377,12 +459,20 @@ { "start": 2436, "end": 2436, - "replacementText": "interface GeneratedTypeLiteralInterface_2 {\n y: string;\n}\n" + "replacementText": "interface GeneratedTypeLiteralInterface_2 {\n y: string;\n}\n", + "line": 112, + "column": 12, + "endLine": 112, + "endColumn": 13 }, { "start": 2447, "end": 2460, - "replacementText": "GeneratedTypeLiteralInterface_2" + "replacementText": "GeneratedTypeLiteralInterface_2", + "line": 112, + "column": 12, + "endLine": 112, + "endColumn": 13 } ], "suggest": "", @@ -399,12 +489,20 @@ { "start": 2436, "end": 2436, - "replacementText": "interface GeneratedTypeLiteralInterface_3 {\n y: 'constant';\n}\n" + "replacementText": "interface GeneratedTypeLiteralInterface_3 {\n y: 'constant';\n}\n", + "line": 112, + "column": 35, + "endLine": 112, + "endColumn": 36 }, { "start": 2470, "end": 2487, - "replacementText": "GeneratedTypeLiteralInterface_3" + "replacementText": "GeneratedTypeLiteralInterface_3", + "line": 112, + "column": 35, + "endLine": 112, + "endColumn": 36 } ], "suggest": "", @@ -421,12 +519,20 @@ { "start": 2543, "end": 2543, - "replacementText": "interface GeneratedTypeLiteralInterface_4 {\n z: boolean;\n}\n" + "replacementText": "interface GeneratedTypeLiteralInterface_4 {\n z: boolean;\n}\n", + "line": 116, + "column": 9, + "endLine": 116, + "endColumn": 10 }, { "start": 2551, "end": 2565, - "replacementText": "GeneratedTypeLiteralInterface_4" + "replacementText": "GeneratedTypeLiteralInterface_4", + "line": 116, + "column": 9, + "endLine": 116, + "endColumn": 10 } ], "suggest": "", @@ -463,7 +569,11 @@ { "start": 2630, "end": 2636, - "replacementText": "1 as any" + "replacementText": "1 as any", + "line": 119, + "column": 15, + "endLine": 119, + "endColumn": 21 } ], "suggest": "", @@ -490,7 +600,11 @@ { "start": 2657, "end": 2714, - "replacementText": "document.getElementById('main_canvas') as HTMLCanvasElement" + "replacementText": "document.getElementById('main_canvas') as HTMLCanvasElement", + "line": 120, + "column": 20, + "endLine": 120, + "endColumn": 77 } ], "suggest": "", @@ -507,12 +621,20 @@ { "start": 2719, "end": 2719, - "replacementText": "interface GeneratedObjectLiteralInterface_2 {\n a: number;\n b: string;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_2 {\n a: number;\n b: string;\n}\n", + "line": 124, + "column": 13, + "endLine": 124, + "endColumn": 14 }, { "start": 2765, "end": 2765, - "replacementText": ": GeneratedObjectLiteralInterface_2" + "replacementText": ": GeneratedObjectLiteralInterface_2", + "line": 124, + "column": 13, + "endLine": 124, + "endColumn": 14 } ], "suggest": "", @@ -559,7 +681,11 @@ { "start": 3075, "end": 3192, - "replacementText": "let arrayFunc: (array: Array) => Array = (array: Array): Array => {\n return array.map((x) => x.toString());\n};" + "replacementText": "let arrayFunc: (array: Array) => Array = (array: Array): Array => {\n return array.map((x) => x.toString());\n};", + "line": 138, + "column": 3, + "endLine": 138, + "endColumn": 11 } ], "suggest": "", diff --git a/ets2panda/linter/test/main/types.ets.json b/ets2panda/linter/test/main/types.ets.json index 9daadb68bf9f73245defa3b2bfc56b71a80ea5b2..547ad8d2c7487e8e98d95c05af89cf6ac70f2887 100644 --- a/ets2panda/linter/test/main/types.ets.json +++ b/ets2panda/linter/test/main/types.ets.json @@ -184,6 +184,16 @@ "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", "severity": "ERROR" }, + { + "line": 68, + "column": 3, + "endLine": 68, + "endColumn": 8, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 71, "column": 19, diff --git a/ets2panda/linter/test/main/types.ets.migrate.ets b/ets2panda/linter/test/main/types.ets.migrate.ets index 07bcd2036971da481f8dc8867af57126a0f474f2..6782d2536759d7c34115df24776360d7909f744d 100644 --- a/ets2panda/linter/test/main/types.ets.migrate.ets +++ b/ets2panda/linter/test/main/types.ets.migrate.ets @@ -68,12 +68,12 @@ interface ComputedPropertyT { class LiteralAsPropertyName { __2: string; - 'Two': number; + Two: number; } const litAsPropName: LiteralAsPropertyName = { __2: 'two', - 'Two': 2, + Two: 2, }; interface Dictionary { diff --git a/ets2panda/linter/test/main/types.ets.migrate.json b/ets2panda/linter/test/main/types.ets.migrate.json index 9235d4235cf4c7aca6585e704998c63f0030b9a0..7df919f6535a74d70f5147168ee13a044a7d4ac9 100644 --- a/ets2panda/linter/test/main/types.ets.migrate.json +++ b/ets2panda/linter/test/main/types.ets.migrate.json @@ -274,6 +274,16 @@ "rule": "Property '__2' has no initializer and is not definitely assigned in the constructor.", "severity": "ERROR" }, + { + "line": 71, + "column": 3, + "endLine": 71, + "endColumn": 6, + "problem": "StrictDiagnostic", + "suggest": "Property 'Two' has no initializer and is not definitely assigned in the constructor.", + "rule": "Property 'Two' has no initializer and is not definitely assigned in the constructor.", + "severity": "ERROR" + }, { "line": 114, "column": 3, diff --git a/ets2panda/linter/test/migration/mixed_problems.ets.autofix.json b/ets2panda/linter/test/migration/mixed_problems.ets.autofix.json index 57f25df2f307782186bdc847598ce6a21d60dae0..011a49fa390f3c33f1131c0db195b312d0ca7449 100644 --- a/ets2panda/linter/test/migration/mixed_problems.ets.autofix.json +++ b/ets2panda/linter/test/migration/mixed_problems.ets.autofix.json @@ -24,12 +24,20 @@ { "replacementText": "GeneratedDestructObj_1", "start": 663, - "end": 671 + "end": 671, + "line": 17, + "column": 5, + "endLine": 17, + "endColumn": 30 }, { "replacementText": "\nlet a = GeneratedDestructObj_1.a;\nlet b = GeneratedDestructObj_1.b;\n", "start": 689, - "end": 689 + "end": 689, + "line": 17, + "column": 5, + "endLine": 17, + "endColumn": 30 } ], "suggest": "", @@ -56,12 +64,20 @@ { "replacementText": "GeneratedDestructObj_2", "start": 764, - "end": 774 + "end": 774, + "line": 20, + "column": 5, + "endLine": 26, + "endColumn": 2 }, { "replacementText": "\nlet a2 = GeneratedDestructObj_2.a2;\nlet b2 = GeneratedDestructObj_2.b2;\n", "start": 869, - "end": 869 + "end": 869, + "line": 20, + "column": 5, + "endLine": 26, + "endColumn": 2 } ], "suggest": "", @@ -98,12 +114,20 @@ { "start": 760, "end": 760, - "replacementText": "interface GeneratedTypeLiteralInterface_1 {\n c2: number;\n d2: string;\n}\n" + "replacementText": "interface GeneratedTypeLiteralInterface_1 {\n c2: number;\n d2: string;\n}\n", + "line": 25, + "column": 10, + "endLine": 25, + "endColumn": 11 }, { "start": 840, "end": 866, - "replacementText": "GeneratedTypeLiteralInterface_1" + "replacementText": "GeneratedTypeLiteralInterface_1", + "line": 25, + "column": 10, + "endLine": 25, + "endColumn": 11 } ], "suggest": "", @@ -130,12 +154,20 @@ { "start": 913, "end": 913, - "replacementText": "interface GeneratedObjectLiteralInterface_1 {\n a: number;\n b: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_1 {\n a: number;\n b: number;\n}\n", + "line": 29, + "column": 20, + "endLine": 29, + "endColumn": 21 }, { "start": 932, "end": 946, - "replacementText": "({ a: 1, b: 2 } as GeneratedObjectLiteralInterface_1)" + "replacementText": "({ a: 1, b: 2 } as GeneratedObjectLiteralInterface_1)", + "line": 29, + "column": 20, + "endLine": 29, + "endColumn": 21 } ], "suggest": "", @@ -152,7 +184,11 @@ { "start": 1043, "end": 1238, - "replacementText": "let fun = function () {\n var o = {\n 'a': 1,\n 'b': 2\n };\n var o2 = {\n 'c': 3,\n 'd': 4,\n 5: {\n x1: 10,\n x2: 20\n }\n };\n}" + "replacementText": "let fun = function () {\n var o = {\n 'a': 1,\n 'b': 2\n };\n var o2 = {\n 'c': 3,\n 'd': 4,\n 5: {\n x1: 10,\n x2: 20\n }\n };\n}", + "line": 32, + "column": 1, + "endLine": 32, + "endColumn": 4 } ], "suggest": "", @@ -169,7 +205,11 @@ { "start": 1053, "end": 1238, - "replacementText": "() => {\n var o = {\n 'a': 1,\n 'b': 2\n };\n var o2 = {\n 'c': 3,\n 'd': 4,\n 5: {\n x1: 10,\n x2: 20\n }\n };\n}" + "replacementText": "() => {\n var o = {\n 'a': 1,\n 'b': 2\n };\n var o2 = {\n 'c': 3,\n 'd': 4,\n 5: {\n x1: 10,\n x2: 20\n }\n };\n}", + "line": 32, + "column": 11, + "endLine": 46, + "endColumn": 2 } ], "suggest": "", @@ -186,7 +226,11 @@ { "start": 1071, "end": 1117, - "replacementText": "let o = {\n 'a': 1,\n 'b': 2\n}" + "replacementText": "let o = {\n 'a': 1,\n 'b': 2\n}", + "line": 33, + "column": 5, + "endLine": 33, + "endColumn": 8 } ], "suggest": "", @@ -203,6 +247,26 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 34, + "column": 9, + "endLine": 34, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 9, + "endLine": 35, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 38, "column": 5, @@ -213,7 +277,11 @@ { "start": 1124, "end": 1235, - "replacementText": "let o2 = {\n 'c': 3,\n 'd': 4,\n 5: {\n x1: 10,\n x2: 20\n }\n}" + "replacementText": "let o2 = {\n 'c': 3,\n 'd': 4,\n 5: {\n x1: 10,\n x2: 20\n }\n}", + "line": 38, + "column": 5, + "endLine": 38, + "endColumn": 8 } ], "suggest": "", @@ -230,6 +298,26 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 39, + "column": 9, + "endLine": 39, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 9, + "endLine": 40, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 41, "column": 9, @@ -250,12 +338,20 @@ { "start": 1043, "end": 1043, - "replacementText": "interface GeneratedObjectLiteralInterface_2 {\n x1: number;\n x2: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_2 {\n x1: number;\n x2: number;\n}\n", + "line": 41, + "column": 12, + "endLine": 41, + "endColumn": 13 }, { "start": 1178, "end": 1228, - "replacementText": "({ x1: 10,\n x2: 20 } as GeneratedObjectLiteralInterface_2)" + "replacementText": "({ x1: 10,\n x2: 20 } as GeneratedObjectLiteralInterface_2)", + "line": 41, + "column": 12, + "endLine": 41, + "endColumn": 13 } ], "suggest": "", @@ -282,7 +378,11 @@ { "start": 1299, "end": 1311, - "replacementText": "private a!: number;" + "replacementText": "private a!: number;", + "line": 50, + "column": 5, + "endLine": 50, + "endColumn": 7 } ], "suggest": "", diff --git a/ets2panda/linter/test/migration/mixed_problems.ets.json b/ets2panda/linter/test/migration/mixed_problems.ets.json index dbb09ef3dc5bcac13242fb8caaa6b0e6f809b349..96624388d7cc0712cf3a957dde5e70746199a1da 100644 --- a/ets2panda/linter/test/migration/mixed_problems.ets.json +++ b/ets2panda/linter/test/migration/mixed_problems.ets.json @@ -134,6 +134,26 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 34, + "column": 9, + "endLine": 34, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 35, + "column": 9, + "endLine": 35, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 38, "column": 5, @@ -154,6 +174,26 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 39, + "column": 9, + "endLine": 39, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 40, + "column": 9, + "endLine": 40, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 41, "column": 9, diff --git a/ets2panda/linter/test/migration/mixed_problems.ets.migrate.json b/ets2panda/linter/test/migration/mixed_problems.ets.migrate.json index bfb7a82f089b08ec604a536fff2ac426e2896312..0708a128c884dcda36beaf7b9cb54e48ed9e6ee6 100644 --- a/ets2panda/linter/test/migration/mixed_problems.ets.migrate.json +++ b/ets2panda/linter/test/migration/mixed_problems.ets.migrate.json @@ -34,6 +34,26 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 60, + "column": 5, + "endLine": 60, + "endColumn": 8, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 61, + "column": 5, + "endLine": 61, + "endColumn": 8, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 63, "column": 14, @@ -44,6 +64,26 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 64, + "column": 5, + "endLine": 64, + "endColumn": 8, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 65, + "column": 5, + "endLine": 65, + "endColumn": 8, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 66, "column": 5, diff --git a/ets2panda/linter/test/rules/rule1.ets.autofix.json b/ets2panda/linter/test/rules/rule1.ets.autofix.json index 4418693726fc8d2fee1ef9a555ecaf70b8925a1e..0220cda6b41b17512ccad75a3cec0639b537a46a 100644 --- a/ets2panda/linter/test/rules/rule1.ets.autofix.json +++ b/ets2panda/linter/test/rules/rule1.ets.autofix.json @@ -24,7 +24,11 @@ { "start": 610, "end": 635, - "replacementText": "let x = { \"name\": 1, 2: 3 }" + "replacementText": "let x = { \"name\": 1, 2: 3 }", + "line": 16, + "column": 1, + "endLine": 16, + "endColumn": 4 } ], "suggest": "", @@ -41,6 +45,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 16, + "column": 10, + "endLine": 16, + "endColumn": 16, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 16, "column": 21, @@ -81,12 +95,20 @@ { "start": 719, "end": 719, - "replacementText": "interface GeneratedObjectLiteralInterface_1 {\n name: number;\n}\n" + "replacementText": "interface GeneratedObjectLiteralInterface_1 {\n name: number;\n}\n", + "line": 24, + "column": 9, + "endLine": 24, + "endColumn": 10 }, { "start": 724, "end": 724, - "replacementText": ": GeneratedObjectLiteralInterface_1" + "replacementText": ": GeneratedObjectLiteralInterface_1", + "line": 24, + "column": 9, + "endLine": 24, + "endColumn": 10 } ], "suggest": "", diff --git a/ets2panda/linter/test/rules/rule1.ets.json b/ets2panda/linter/test/rules/rule1.ets.json index d5b0d795ee9ad175d1527c7d355ad0fb872dc4ea..424d045dbd18e13583f0273ba858a14d08cebc22 100644 --- a/ets2panda/linter/test/rules/rule1.ets.json +++ b/ets2panda/linter/test/rules/rule1.ets.json @@ -34,6 +34,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 16, + "column": 10, + "endLine": 16, + "endColumn": 16, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 16, "column": 21, diff --git a/ets2panda/linter/test/rules/rule1.ets.migrate.json b/ets2panda/linter/test/rules/rule1.ets.migrate.json index a6b59e880c252dc5f29c2e55d97ff6242a0ba012..c61230891574c43734ca68382d94b761abfe858d 100644 --- a/ets2panda/linter/test/rules/rule1.ets.migrate.json +++ b/ets2panda/linter/test/rules/rule1.ets.migrate.json @@ -24,6 +24,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 16, + "column": 11, + "endLine": 16, + "endColumn": 17, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 16, "column": 22, diff --git a/ets2panda/linter/test/sdkwhite/literal_as_property_name_sdk.ets.arkts2.json b/ets2panda/linter/test/sdkwhite/literal_as_property_name_sdk.ets.arkts2.json index aafa0c6dae965cc263d030a379c4a0c741e7e03a..e912f222acdacc33add98dbc94ee38e01d5ab30e 100644 --- a/ets2panda/linter/test/sdkwhite/literal_as_property_name_sdk.ets.arkts2.json +++ b/ets2panda/linter/test/sdkwhite/literal_as_property_name_sdk.ets.arkts2.json @@ -24,16 +24,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 18, - "column": 3, - "endLine": 18, - "endColumn": 18, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 19, "column": 3, @@ -44,16 +34,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 19, - "column": 3, - "endLine": 19, - "endColumn": 17, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 24, "column": 5, @@ -64,16 +44,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 24, - "column": 5, - "endLine": 24, - "endColumn": 20, - "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, @@ -84,16 +54,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 25, - "column": 5, - "endLine": 25, - "endColumn": 13, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 26, "column": 5, @@ -104,16 +64,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 26, - "column": 5, - "endLine": 26, - "endColumn": 20, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 27, "column": 5, @@ -123,16 +73,6 @@ "suggest": "", "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" - }, - { - "line": 27, - "column": 5, - "endLine": 27, - "endColumn": 17, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/sdkwhite/literal_as_property_name_sdk.ets.json b/ets2panda/linter/test/sdkwhite/literal_as_property_name_sdk.ets.json index ca88f857e960b437dcf767c0ac40be998c8f1236..eccbe37c0fbc370725ec85d57b10e880e9a5018a 100644 --- a/ets2panda/linter/test/sdkwhite/literal_as_property_name_sdk.ets.json +++ b/ets2panda/linter/test/sdkwhite/literal_as_property_name_sdk.ets.json @@ -13,5 +13,66 @@ "See the License for the specific language governing permissions and", "limitations under the License." ], - "result": [] + "result": [ + { + "line": 18, + "column": 3, + "endLine": 18, + "endColumn": 18, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 19, + "column": 3, + "endLine": 19, + "endColumn": 17, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 24, + "column": 5, + "endLine": 24, + "endColumn": 20, + "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": 13, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 26, + "column": 5, + "endLine": 26, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 27, + "column": 5, + "endLine": 27, + "endColumn": 17, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + } + ] } \ No newline at end of file diff --git a/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk.ets.arkts2.json b/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk.ets.arkts2.json index 3a348d3c8350c18237159008eeb22f282ceceb46..2d9b41b9926c40eb497baf12cfa69b478940fa0e 100644 --- a/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk.ets.arkts2.json +++ b/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk.ets.arkts2.json @@ -24,16 +24,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 29, - "column": 5, - "endLine": 29, - "endColumn": 19, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 37, "column": 3, @@ -44,16 +34,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 37, - "column": 3, - "endLine": 37, - "endColumn": 18, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 38, "column": 3, @@ -64,16 +44,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 38, - "column": 3, - "endLine": 38, - "endColumn": 17, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 43, "column": 5, @@ -84,16 +54,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 43, - "column": 5, - "endLine": 43, - "endColumn": 20, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 44, "column": 5, @@ -104,16 +64,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 44, - "column": 5, - "endLine": 44, - "endColumn": 13, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 45, "column": 5, @@ -124,16 +74,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 45, - "column": 5, - "endLine": 45, - "endColumn": 20, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 46, "column": 5, @@ -144,16 +84,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 46, - "column": 5, - "endLine": 46, - "endColumn": 17, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 50, "column": 10, @@ -174,16 +104,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 56, - "column": 3, - "endLine": 56, - "endColumn": 19, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 57, "column": 3, @@ -194,16 +114,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 57, - "column": 3, - "endLine": 57, - "endColumn": 20, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 58, "column": 3, @@ -214,16 +124,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 58, - "column": 3, - "endLine": 58, - "endColumn": 20, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 59, "column": 3, @@ -234,16 +134,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 59, - "column": 3, - "endLine": 59, - "endColumn": 11, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 60, "column": 3, @@ -254,16 +144,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 60, - "column": 3, - "endLine": 60, - "endColumn": 10, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 61, "column": 3, @@ -274,16 +154,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 61, - "column": 3, - "endLine": 61, - "endColumn": 12, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 62, "column": 3, @@ -294,16 +164,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 62, - "column": 3, - "endLine": 62, - "endColumn": 17, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 67, "column": 3, @@ -314,36 +174,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 67, - "column": 3, - "endLine": 67, - "endColumn": 17, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, - { - "line": 80, - "column": 7, - "endLine": 80, - "endColumn": 22, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, - { - "line": 81, - "column": 7, - "endLine": 81, - "endColumn": 19, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 90, "column": 68, @@ -384,6 +214,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 115, + "column": 5, + "endLine": 115, + "endColumn": 13, + "problem": "ObjectLiteralKeyType", + "suggest": "", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", + "severity": "ERROR" + }, { "line": 114, "column": 3, @@ -404,16 +244,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 115, - "column": 5, - "endLine": 115, - "endColumn": 13, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 125, "column": 31, @@ -424,6 +254,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 127, + "column": 5, + "endLine": 127, + "endColumn": 20, + "problem": "ObjectLiteralKeyType", + "suggest": "", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", + "severity": "ERROR" + }, { "line": 126, "column": 12, @@ -444,16 +284,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 127, - "column": 5, - "endLine": 127, - "endColumn": 20, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 149, "column": 3, @@ -464,16 +294,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 149, - "column": 3, - "endLine": 149, - "endColumn": 18, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 150, "column": 3, @@ -484,16 +304,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 150, - "column": 3, - "endLine": 150, - "endColumn": 10, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 151, "column": 3, @@ -504,16 +314,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 151, - "column": 3, - "endLine": 151, - "endColumn": 18, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 152, "column": 3, @@ -525,13 +325,13 @@ "severity": "ERROR" }, { - "line": 152, + "line": 159, "column": 3, - "endLine": 152, + "endLine": 159, "endColumn": 21, - "problem": "LiteralAsPropertyName", + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -544,16 +344,6 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, - { - "line": 159, - "column": 3, - "endLine": 159, - "endColumn": 21, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 167, "column": 10, @@ -574,6 +364,16 @@ "rule": "Array literals must contain elements of only inferrable types (arkts-no-noninferrable-arr-literals)", "severity": "ERROR" }, + { + "line": 179, + "column": 5, + "endLine": 179, + "endColumn": 20, + "problem": "ObjectLiteralKeyType", + "suggest": "", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", + "severity": "ERROR" + }, { "line": 178, "column": 3, @@ -585,13 +385,13 @@ "severity": "ERROR" }, { - "line": 179, + "line": 183, "column": 5, - "endLine": 179, - "endColumn": 20, - "problem": "LiteralAsPropertyName", + "endLine": 183, + "endColumn": 13, + "problem": "ObjectLiteralKeyType", "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", "severity": "ERROR" }, { @@ -614,16 +414,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 183, - "column": 5, - "endLine": 183, - "endColumn": 13, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 193, "column": 33, @@ -634,6 +424,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 195, + "column": 5, + "endLine": 195, + "endColumn": 23, + "problem": "ObjectLiteralKeyType", + "suggest": "", + "rule": "Use string-literal keys with Record (arkts-obj-literal-key-type)", + "severity": "ERROR" + }, { "line": 194, "column": 12, @@ -653,16 +453,6 @@ "suggest": "", "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" - }, - { - "line": 195, - "column": 5, - "endLine": 195, - "endColumn": 23, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk.ets.json b/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk.ets.json index eaeaa7697684c7a6a6ecffddcb301018911f035e..17ed9e4363fca09b6ecd4a87b3ab113ec66be126 100755 --- a/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk.ets.json +++ b/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk.ets.json @@ -14,6 +14,76 @@ "limitations under the License." ], "result": [ + { + "line": 29, + "column": 5, + "endLine": 29, + "endColumn": 19, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 37, + "column": 3, + "endLine": 37, + "endColumn": 18, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 38, + "column": 3, + "endLine": 38, + "endColumn": 17, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 43, + "column": 5, + "endLine": 43, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 44, + "column": 5, + "endLine": 44, + "endColumn": 13, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 45, + "column": 5, + "endLine": 45, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 46, + "column": 5, + "endLine": 46, + "endColumn": 17, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 50, "column": 10, @@ -24,6 +94,106 @@ "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" }, + { + "line": 56, + "column": 3, + "endLine": 56, + "endColumn": 19, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 57, + "column": 3, + "endLine": 57, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 58, + "column": 3, + "endLine": 58, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 59, + "column": 3, + "endLine": 59, + "endColumn": 11, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 60, + "column": 3, + "endLine": 60, + "endColumn": 10, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 61, + "column": 3, + "endLine": 61, + "endColumn": 12, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 62, + "column": 3, + "endLine": 62, + "endColumn": 17, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 67, + "column": 3, + "endLine": 67, + "endColumn": 17, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 80, + "column": 7, + "endLine": 80, + "endColumn": 22, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 7, + "endLine": 81, + "endColumn": 19, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 90, "column": 68, @@ -74,6 +244,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 115, + "column": 5, + "endLine": 115, + "endColumn": 13, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 125, "column": 31, @@ -94,6 +274,56 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 127, + "column": 5, + "endLine": 127, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 149, + "column": 3, + "endLine": 149, + "endColumn": 18, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 150, + "column": 3, + "endLine": 150, + "endColumn": 10, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 151, + "column": 3, + "endLine": 151, + "endColumn": 18, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 152, + "column": 3, + "endLine": 152, + "endColumn": 21, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 158, "column": 70, @@ -104,6 +334,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 159, + "column": 3, + "endLine": 159, + "endColumn": 21, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 167, "column": 10, @@ -134,6 +374,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 179, + "column": 5, + "endLine": 179, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 182, "column": 3, @@ -144,6 +394,16 @@ "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" }, + { + "line": 183, + "column": 5, + "endLine": 183, + "endColumn": 13, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 193, "column": 33, @@ -163,6 +423,16 @@ "suggest": "", "rule": "Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals)", "severity": "ERROR" + }, + { + "line": 195, + "column": 5, + "endLine": 195, + "endColumn": 23, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk2.ets.arkts2.json b/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk2.ets.arkts2.json index 84106d351ab25809f282d4840cec7be3e42bdfe5..56c2ae04205439d81632839b6fc2abc08ee228a1 100755 --- a/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk2.ets.arkts2.json +++ b/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk2.ets.arkts2.json @@ -44,26 +44,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 65, - "column": 5, - "endLine": 65, - "endColumn": 20, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, - { - "line": 73, - "column": 3, - "endLine": 73, - "endColumn": 15, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 74, "column": 3, @@ -74,16 +54,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 74, - "column": 3, - "endLine": 74, - "endColumn": 16, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 81, "column": 5, @@ -94,16 +64,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 81, - "column": 5, - "endLine": 81, - "endColumn": 20, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 82, "column": 5, @@ -114,16 +74,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 82, - "column": 5, - "endLine": 82, - "endColumn": 23, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 86, "column": 10, @@ -144,16 +94,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 92, - "column": 3, - "endLine": 92, - "endColumn": 21, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 93, "column": 3, @@ -164,16 +104,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 93, - "column": 3, - "endLine": 93, - "endColumn": 18, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 94, "column": 3, @@ -184,16 +114,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 94, - "column": 3, - "endLine": 94, - "endColumn": 13, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 95, "column": 3, @@ -204,16 +124,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 95, - "column": 3, - "endLine": 95, - "endColumn": 15, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 96, "column": 3, @@ -224,16 +134,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 96, - "column": 3, - "endLine": 96, - "endColumn": 18, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 97, "column": 3, @@ -244,16 +144,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 97, - "column": 3, - "endLine": 97, - "endColumn": 21, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 98, "column": 3, @@ -264,16 +154,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 98, - "column": 3, - "endLine": 98, - "endColumn": 17, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 106, "column": 7, @@ -284,16 +164,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 106, - "column": 7, - "endLine": 106, - "endColumn": 22, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 107, "column": 7, @@ -304,26 +174,6 @@ "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" }, - { - "line": 107, - "column": 7, - "endLine": 107, - "endColumn": 25, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, - { - "line": 109, - "column": 7, - "endLine": 109, - "endColumn": 22, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" - }, { "line": 111, "column": 7, @@ -333,16 +183,6 @@ "suggest": "", "rule": "Object property names must be valid identifiers.Single-quoted and hyphenated properties are not supported. (sdk-no-literal-as-property-name)", "severity": "ERROR" - }, - { - "line": 111, - "column": 7, - "endLine": 111, - "endColumn": 25, - "problem": "LiteralAsPropertyName", - "suggest": "", - "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", - "severity": "ERROR" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk2.ets.json b/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk2.ets.json index fe966ab865f8e5a1816ebf8e86731c56e1a9d321..4715ee64ddc7d3ec47ac851790203b2ff678976d 100755 --- a/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk2.ets.json +++ b/ets2panda/linter/test/sdkwhite/quoted_hyphen_props_deprecated_sdk2.ets.json @@ -14,6 +14,56 @@ "limitations under the License." ], "result": [ + { + "line": 65, + "column": 5, + "endLine": 65, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 73, + "column": 3, + "endLine": 73, + "endColumn": 15, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 74, + "column": 3, + "endLine": 74, + "endColumn": 16, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 81, + "column": 5, + "endLine": 81, + "endColumn": 20, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 82, + "column": 5, + "endLine": 82, + "endColumn": 23, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, { "line": 86, "column": 10, @@ -23,6 +73,116 @@ "suggest": "", "rule": "Function return type inference is limited (arkts-no-implicit-return-types)", "severity": "ERROR" + }, + { + "line": 92, + "column": 3, + "endLine": 92, + "endColumn": 21, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 93, + "column": 3, + "endLine": 93, + "endColumn": 18, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 94, + "column": 3, + "endLine": 94, + "endColumn": 13, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 95, + "column": 3, + "endLine": 95, + "endColumn": 15, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 96, + "column": 3, + "endLine": 96, + "endColumn": 18, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 97, + "column": 3, + "endLine": 97, + "endColumn": 21, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 98, + "column": 3, + "endLine": 98, + "endColumn": 17, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 106, + "column": 7, + "endLine": 106, + "endColumn": 22, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 107, + "column": 7, + "endLine": 107, + "endColumn": 25, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 109, + "column": 7, + "endLine": 109, + "endColumn": 22, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" + }, + { + "line": 111, + "column": 7, + "endLine": 111, + "endColumn": 25, + "problem": "LiteralAsPropertyName", + "suggest": "", + "rule": "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)", + "severity": "ERROR" } ] } \ No newline at end of file