Skip to content

Commit

Permalink
Allow libraries prefixed with rxjs (#74)
Browse files Browse the repository at this point in the history
* test: Add test for library prefixed with rxjs

* fix: Only examine submodule imports of rxjs
  • Loading branch information
chrisguttandin authored and cartant committed Jan 28, 2019
1 parent bfb82fc commit 1c5b13f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/rules/rxjsNoCompatRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export class Rule extends Lint.Rules.AbstractRule {
const failures: Lint.RuleFailure[] = [];
const importDeclarations = tsquery(
sourceFile,
`ImportDeclaration:has(StringLiteral[value=/^rxjs/])`
`ImportDeclaration:has(StringLiteral[value=/^rxjs\\u002f/])`
);
importDeclarations.forEach(node => {
const importDeclaration = node as ts.ImportDeclaration;
const { moduleSpecifier } = importDeclaration;
if (!/^['"]rxjs(\/(ajax|operators|testing|webSocket))?['"]$/.test(moduleSpecifier.getText())) {
if (!/^['"]rxjs\/(ajax|operators|testing|webSocket)['"]$/.test(moduleSpecifier.getText())) {
failures.push(new Lint.RuleFailure(
sourceFile,
moduleSpecifier.getStart(),
Expand Down
1 change: 1 addition & 0 deletions test/v6/fixtures/no-compat/default/fixture.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ajax } from "rxjs/ajax";
import { concatMap } from "rxjs/operators";
import { TestScheduler } from "rxjs/testing";
import { webSocket } from "rxjs/webSocket";
import * from "rxjs-prefixed-package";

import * as Rx from "rxjs/Rx";
~~~~~~~~~ [no-compat]
Expand Down

0 comments on commit 1c5b13f

Please sign in to comment.