Skip to content

Commit

Permalink
fix(subclass): Check qualified name.
Browse files Browse the repository at this point in the history
Closes #87.
  • Loading branch information
cartant committed Mar 9, 2019
1 parent 5fc81f7 commit 31d00c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"resolve": "^1.4.0",
"tslib": "^1.8.0",
"tsutils": "^3.0.0",
"tsutils-etc": "^1.0.0"
"tsutils-etc": "^1.1.0"
},
"description": "TSLint rules for RxJS",
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion source/rules/rxjsNoSubclassRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export class Rule extends Lint.Rules.TypedRule {
if (heritageClause.token === ts.SyntaxKind.ExtendsKeyword) {
heritageClause.types.forEach(heritageType => {
const type = typeChecker.getTypeAtLocation(heritageType);
if (couldBeNames.some(name => couldBeType(type, name))) {
if (couldBeNames.some(name => couldBeType(type, name, {
name: /rxjs/,
typeChecker
}))) {
failures.push(new Lint.RuleFailure(
sourceFile,
heritageType.getStart(),
Expand Down
7 changes: 2 additions & 5 deletions test/v6/fixtures/issues/87/fixture.ts.lint
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
class Observable<T> {
t: T;
}
class Observable<T> { t: T; }

class StringObservable extends Observable<string> {
}
class StringObservable extends Observable<string> {}

[no-subclass]: Subclassing RxJS classes is forbidden
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1540,10 +1540,10 @@ tslint@^5.1.0:
tslib "^1.8.0"
tsutils "^2.27.2"

tsutils-etc@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/tsutils-etc/-/tsutils-etc-1.0.1.tgz#2114f1b41a1d7ad5498690f011a18fa989ebffad"
integrity sha512-Yp6RQzPfxuZNjw/tHYdr+QRHtoPX2Al+9UmydyMidGqKt3Y13lJhryLUNPxYce5Y8KQ0Q6qn2MLJIxwL48GBWg==
tsutils-etc@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/tsutils-etc/-/tsutils-etc-1.1.0.tgz#82ce1c92da29e07d3cde95692d5c5e8dbdc92fd0"
integrity sha512-pJlLtLmQPUyGHqY/Pq6EGnpGmQCnnTDZetQ7eWkeQ5xaw4GtfcR1Zt7HMKFHGDDp53HzQfbqQ+7ps6iJbfa9Hw==

tsutils@^2.27.2:
version "2.29.0"
Expand Down

0 comments on commit 31d00c0

Please sign in to comment.