diff --git a/linter/test/esobject.ts b/linter/test/esobject.ts new file mode 100644 index 0000000000000000000000000000000000000000..4bd2116a8890c441e0ad3240efcdb18c43d11e1d --- /dev/null +++ b/linter/test/esobject.ts @@ -0,0 +1,75 @@ +import { ExecSyncOptions } from "child_process"; + +export let obj = new ESObject(); + +type t1 = ESObject +type t2 = ESObject[] + +export type t3 = ESObject +export type t4 = ESObject[] + +export type t5 = t3 +export type t6 = t[] + +export function foo1(): any { + let a: ESObject = "STRING"; + return a +} + +export function foo2(a: ESObject): ESObject { + return a; +} + +export function foo3(a: t3): t3 { + return a; +} + +foo2(5) +foo3(5) +foo2("asd") +foo3("asd") +foo2(null) +foo3(null) +foo2(undefined) +foo3(undefined) + +export function foo4(a: ESObject[]): ESObject { + return a; +} + +export function foo5(a: t3[]): t3 { + return a; +} + +foo4([2, 3]) +foo5([2, 3]) +foo4(["str1", "str2"]) +foo5(["str1", "str2"]) +let n = new ESObject[0] +n = null + +foo4(n) +foo5(n) + +export function foo6(a: ESObject[]): ESObject { + return a; +} + +export function foo7(a: t3[]): t3 { + return a; +} + +export function foo8(a: ESObject[]): ESObject { + return a; +} + +export function foo9(a: t3[]): t3 { + return a; +} + +export class Cls {} + +interface CL extends ESObject {} + +export interface CLS extends ESObject {} + diff --git a/linter/test/esobject.ts.autofix.json b/linter/test/esobject.ts.autofix.json new file mode 100644 index 0000000000000000000000000000000000000000..9ec5f69718bf9a1aef4c6e8cc5e07ee4329718d4 --- /dev/null +++ b/linter/test/esobject.ts.autofix.json @@ -0,0 +1,28 @@ +{ + "nodes": [ + { + "line": 3, + "column": 12, + "problem": "AnyType", + "autofixable": false, + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 14, + "column": 25, + "problem": "AnyType", + "autofixable": false, + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 5, + "problem": "AnyType", + "autofixable": false, + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} \ No newline at end of file diff --git a/linter/test/esobject.ts.relax.json b/linter/test/esobject.ts.relax.json new file mode 100644 index 0000000000000000000000000000000000000000..c7b01d349b57cf8aff595023795911553d594e29 --- /dev/null +++ b/linter/test/esobject.ts.relax.json @@ -0,0 +1,25 @@ +{ + "nodes": [ + { + "line": 3, + "column": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 14, + "column": 25, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 5, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} \ No newline at end of file diff --git a/linter/test/esobject.ts.strict.json b/linter/test/esobject.ts.strict.json new file mode 100644 index 0000000000000000000000000000000000000000..c7b01d349b57cf8aff595023795911553d594e29 --- /dev/null +++ b/linter/test/esobject.ts.strict.json @@ -0,0 +1,25 @@ +{ + "nodes": [ + { + "line": 3, + "column": 12, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 14, + "column": 25, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + }, + { + "line": 48, + "column": 5, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} \ No newline at end of file