diff --git a/examples/ng-cli-example/e2e/tslint.json b/examples/ng-cli-example/e2e/tslint.json new file mode 100644 index 00000000..3f843fe0 --- /dev/null +++ b/examples/ng-cli-example/e2e/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": [ + "../tslint.json" + ], + "rules": { + "rxjs-add": { "severity": "off" } + } +} diff --git a/examples/ng-cli-example/package-lock.json b/examples/ng-cli-example/package-lock.json index 988c43d5..bfe8f397 100644 --- a/examples/ng-cli-example/package-lock.json +++ b/examples/ng-cli-example/package-lock.json @@ -6656,6 +6656,15 @@ "symbol-observable": "1.0.4" } }, + "rxjs-tslint-rules": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/rxjs-tslint-rules/-/rxjs-tslint-rules-3.0.3.tgz", + "integrity": "sha512-d5FhY0T+hxaxG1MKNxEI3pAWyqAGzKcaP2jFF+HpUsTagT0zzGimRtZ1en8T9X5XKoTHZ/ME1RPZcSpvdGY84Q==", + "dev": true, + "requires": { + "resolve": "1.4.0" + } + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", diff --git a/examples/ng-cli-example/package.json b/examples/ng-cli-example/package.json index 174af6dc..a07860a5 100644 --- a/examples/ng-cli-example/package.json +++ b/examples/ng-cli-example/package.json @@ -42,6 +42,7 @@ "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", + "rxjs-tslint-rules": "^3.0.3", "ts-node": "~3.2.0", "tslint": "~5.7.0", "typescript": "~2.3.3" diff --git a/examples/ng-cli-example/src/app/app.component.ts b/examples/ng-cli-example/src/app/app.component.ts index 7b0f6728..90e54136 100644 --- a/examples/ng-cli-example/src/app/app.component.ts +++ b/examples/ng-cli-example/src/app/app.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; @Component({ selector: 'app-root', @@ -7,4 +8,8 @@ import { Component } from '@angular/core'; }) export class AppComponent { title = 'app'; + + constructor() { + const obs = Observable.of(1).map(value => value + 1); + } } diff --git a/examples/ng-cli-example/src/main.ts b/examples/ng-cli-example/src/main.ts index 91ec6da5..ac2fb51f 100644 --- a/examples/ng-cli-example/src/main.ts +++ b/examples/ng-cli-example/src/main.ts @@ -1,3 +1,5 @@ +import './rxjs.imports'; + import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; diff --git a/examples/ng-cli-example/src/rxjs.imports.ts b/examples/ng-cli-example/src/rxjs.imports.ts new file mode 100644 index 00000000..0e66f60b --- /dev/null +++ b/examples/ng-cli-example/src/rxjs.imports.ts @@ -0,0 +1,2 @@ +import 'rxjs/add/observable/of'; +import 'rxjs/add/operator/map'; diff --git a/examples/ng-cli-example/src/tsconfig.spec.json b/examples/ng-cli-example/src/tsconfig.spec.json index 63d89ff2..c5f6155d 100644 --- a/examples/ng-cli-example/src/tsconfig.spec.json +++ b/examples/ng-cli-example/src/tsconfig.spec.json @@ -11,6 +11,7 @@ ] }, "files": [ + "rxjs.imports.ts", "test.ts" ], "include": [ diff --git a/examples/ng-cli-example/tslint.json b/examples/ng-cli-example/tslint.json index c24dc293..fda8b8fe 100644 --- a/examples/ng-cli-example/tslint.json +++ b/examples/ng-cli-example/tslint.json @@ -1,4 +1,7 @@ { + "extends": [ + "rxjs-tslint-rules" + ], "rulesDirectory": [ "node_modules/codelyzer" ], @@ -136,6 +139,14 @@ "use-pipe-transform-interface": true, "component-class-suffix": true, "directive-class-suffix": true, - "invoke-injectable": true + "invoke-injectable": true, + "rxjs-add": { + "options": [{ + "allowElsewhere": false, + "allowUnused": false, + "file": "./src/rxjs.imports.ts" + }], + "severity": "error" + } } }