Skip to content

Commit 2b8b2b9

Browse files
mightyiamJamesHenry
authored andcommitted
Fix: no-triple-slash-reference (fixes typescript-eslint#75)
1 parent 4fe8677 commit 2b8b2b9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

packages/eslint-plugin-typescript/lib/rules/no-triple-slash-reference.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ module.exports = {
3535
* @private
3636
*/
3737
function checkTripleSlashReference(program) {
38-
const leading = sourceCode.getComments(program).leading;
38+
const commentsBefore = sourceCode.getCommentsBefore(program);
3939

40-
leading.forEach(comment => {
40+
commentsBefore.forEach(comment => {
4141
if (comment.type !== "Line") {
4242
return;
4343
}

packages/eslint-plugin-typescript/tests/lib/rules/no-triple-slash-reference.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ ruleTester.run("no-triple-slash-reference", rule, {
3939
column: 1
4040
}
4141
]
42+
},
43+
{
44+
code: `
45+
/// <reference path="Animal" />
46+
let a
47+
`,
48+
parser: "typescript-eslint-parser",
49+
errors: [
50+
{
51+
message: "Do not use a triple slash reference",
52+
line: 2,
53+
column: 1
54+
}
55+
]
4256
}
4357
]
4458
});

0 commit comments

Comments
 (0)