Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Allow references to typesVersions parent #311

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/rules/noBadReferenceRule.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as path from "path";
import * as Lint from "tslint";
import * as ts from "typescript";

Expand Down Expand Up @@ -29,7 +30,8 @@ function walk(ctx: Lint.WalkContext<void>): void {
const { sourceFile } = ctx;
for (const ref of sourceFile.referencedFiles) {
if (sourceFile.isDeclarationFile) {
if (ref.fileName.startsWith("..")) {
const dirPath = path.dirname(sourceFile.fileName);
if (path.normalize(ref.fileName).startsWith(/^ts\d+\.\d$/.test(path.basename(dirPath)) ? "../.." : "..")) {
ctx.addFailure(ref.pos, ref.end, Rule.FAILURE_STRING);
}
} else {
Expand Down
1 change: 1 addition & 0 deletions test/no-bad-reference/ts2.0/index.d.ts.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference path="../ts1.0/index.d.ts" />