From a72b5e54446463f4ebdf64c73a33a95e17e6d523 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Tue, 31 Jul 2018 15:41:40 +1000 Subject: [PATCH] test(scope): Add failing test. https://github.com/cartant/rxjs-tslint-rules/issues/54 --- test/v6/fixtures/issues/54/fixture.ts.lint | 18 ++++++++++++++++++ test/v6/fixtures/issues/54/tsconfig.json | 13 +++++++++++++ test/v6/fixtures/issues/54/tslint.json | 8 ++++++++ 3 files changed, 39 insertions(+) create mode 100644 test/v6/fixtures/issues/54/fixture.ts.lint create mode 100644 test/v6/fixtures/issues/54/tsconfig.json create mode 100644 test/v6/fixtures/issues/54/tslint.json diff --git a/test/v6/fixtures/issues/54/fixture.ts.lint b/test/v6/fixtures/issues/54/fixture.ts.lint new file mode 100644 index 00000000..be0c25ef --- /dev/null +++ b/test/v6/fixtures/issues/54/fixture.ts.lint @@ -0,0 +1,18 @@ +import { of } from "rxjs"; +import { map, tap } from "rxjs/operators"; + +ok_mapAnArray () { + const q = '123' + return [ 1, 2, 3 ].map(val => { + return `${q}-${val}` + }) +} + +notOk_mapAnArrayFromParam (input: { q: string }) { + const { q } = input + return [ 1, 2, 3 ].map(val => { + return `${q}-${val}` + }) +} + +[no-unsafe-scope]: Unsafe scopes are forbidden diff --git a/test/v6/fixtures/issues/54/tsconfig.json b/test/v6/fixtures/issues/54/tsconfig.json new file mode 100644 index 00000000..690be78e --- /dev/null +++ b/test/v6/fixtures/issues/54/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "lib": ["es2015"], + "noEmit": true, + "paths": { + "rxjs": ["../../node_modules/rxjs"] + }, + "skipLibCheck": true, + "target": "es5" + }, + "include": ["fixture.ts"] +} diff --git a/test/v6/fixtures/issues/54/tslint.json b/test/v6/fixtures/issues/54/tslint.json new file mode 100644 index 00000000..16e7d689 --- /dev/null +++ b/test/v6/fixtures/issues/54/tslint.json @@ -0,0 +1,8 @@ +{ + "defaultSeverity": "error", + "jsRules": {}, + "rules": { + "rxjs-no-unsafe-scope": { "severity": "error" } + }, + "rulesDirectory": "../../../../../build/rules" +}