diff --git a/linter-4.2/test_rules/rule105_1.ts b/linter-4.2/test_rules/rule105_1.ts new file mode 100644 index 0000000000000000000000000000000000000000..45c4a8327c02ae6cc9fa145a9cce720126884445 --- /dev/null +++ b/linter-4.2/test_rules/rule105_1.ts @@ -0,0 +1,16 @@ +class A { + public fooAttr: number = 0; + public barAttr: number = 0; +} + +function getSomeObject() { + return new A() +} + +let obj: any = getSomeObject() +let obj2 = obj as A; +if (obj2 && obj2.fooAttr && obj2.barAttr) { + console.log("Yes") +} else { + console.log("No") +} diff --git a/linter-4.2/test_rules/rule105_1.ts.autofix.json b/linter-4.2/test_rules/rule105_1.ts.autofix.json new file mode 100644 index 0000000000000000000000000000000000000000..83af4ab39d34786ab4772ee2d1325367550a336a --- /dev/null +++ b/linter-4.2/test_rules/rule105_1.ts.autofix.json @@ -0,0 +1,12 @@ +{ + "nodes": [ + { + "line": 10, + "column": 10, + "problem": "AnyType", + "autofixable": false, + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} diff --git a/linter-4.2/test_rules/rule105_1.ts.relax.json b/linter-4.2/test_rules/rule105_1.ts.relax.json new file mode 100644 index 0000000000000000000000000000000000000000..285de551d192c7783422d88113a247f80e82b541 --- /dev/null +++ b/linter-4.2/test_rules/rule105_1.ts.relax.json @@ -0,0 +1,11 @@ +{ + "nodes": [ + { + "line": 10, + "column": 10, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} diff --git a/linter-4.2/test_rules/rule105_1.ts.strict.json b/linter-4.2/test_rules/rule105_1.ts.strict.json new file mode 100644 index 0000000000000000000000000000000000000000..285de551d192c7783422d88113a247f80e82b541 --- /dev/null +++ b/linter-4.2/test_rules/rule105_1.ts.strict.json @@ -0,0 +1,11 @@ +{ + "nodes": [ + { + "line": 10, + "column": 10, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} diff --git a/linter/test_rules/rule105_1.ts b/linter/test_rules/rule105_1.ts new file mode 100644 index 0000000000000000000000000000000000000000..45c4a8327c02ae6cc9fa145a9cce720126884445 --- /dev/null +++ b/linter/test_rules/rule105_1.ts @@ -0,0 +1,16 @@ +class A { + public fooAttr: number = 0; + public barAttr: number = 0; +} + +function getSomeObject() { + return new A() +} + +let obj: any = getSomeObject() +let obj2 = obj as A; +if (obj2 && obj2.fooAttr && obj2.barAttr) { + console.log("Yes") +} else { + console.log("No") +} diff --git a/linter/test_rules/rule105_1.ts.autofix.json b/linter/test_rules/rule105_1.ts.autofix.json new file mode 100644 index 0000000000000000000000000000000000000000..83af4ab39d34786ab4772ee2d1325367550a336a --- /dev/null +++ b/linter/test_rules/rule105_1.ts.autofix.json @@ -0,0 +1,12 @@ +{ + "nodes": [ + { + "line": 10, + "column": 10, + "problem": "AnyType", + "autofixable": false, + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} diff --git a/linter/test_rules/rule105_1.ts.relax.json b/linter/test_rules/rule105_1.ts.relax.json new file mode 100644 index 0000000000000000000000000000000000000000..285de551d192c7783422d88113a247f80e82b541 --- /dev/null +++ b/linter/test_rules/rule105_1.ts.relax.json @@ -0,0 +1,11 @@ +{ + "nodes": [ + { + "line": 10, + "column": 10, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +} diff --git a/linter/test_rules/rule105_1.ts.strict.json b/linter/test_rules/rule105_1.ts.strict.json new file mode 100644 index 0000000000000000000000000000000000000000..285de551d192c7783422d88113a247f80e82b541 --- /dev/null +++ b/linter/test_rules/rule105_1.ts.strict.json @@ -0,0 +1,11 @@ +{ + "nodes": [ + { + "line": 10, + "column": 10, + "problem": "AnyType", + "suggest": "", + "rule": "Use explicit types instead of \"any\", \"unknown\" (arkts-no-any-unknown)" + } + ] +}