Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 7ce5d61

Browse files
committed
add test for #416
1 parent f5de9b0 commit 7ce5d61

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tests/lib/scope-analysis.js

+24-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
*/
55
"use strict";
66

7+
const assert = require("assert");
78
const fs = require("fs");
89
const path = require("path");
9-
const { parseForESLint } = require("../..");
10+
const { Linter } = require("eslint");
11+
const parser = require("../..");
1012

1113
/** Reference resolver. */
1214
class ReferenceResolver {
@@ -144,7 +146,7 @@ describe("TypeScript scope analysis", () => {
144146
for (const filePath of files) {
145147
test(filePath, () => {
146148
const code = fs.readFileSync(filePath, "utf8");
147-
const { scopeManager } = parseForESLint(code, {
149+
const { scopeManager } = parser.parseForESLint(code, {
148150
loc: true,
149151
range: true,
150152
tokens: true,
@@ -169,4 +171,24 @@ describe("TypeScript scope analysis", () => {
169171
expect(scopeTree).toMatchSnapshot();
170172
});
171173
}
174+
175+
test("https://github.com/eslint/typescript-eslint-parser/issues/416", () => {
176+
const linter = new Linter();
177+
linter.defineParser("typescript-eslint-parser", parser);
178+
179+
const code = `
180+
export type SomeThing = {
181+
id: string;
182+
}
183+
`;
184+
const config = {
185+
parser: "typescript-eslint-parser",
186+
rules: {
187+
"no-undef": "error"
188+
}
189+
};
190+
const messages = linter.verify(code, config, { filename: "issue416.ts" });
191+
192+
assert.deepStrictEqual(messages, []);
193+
});
172194
});

0 commit comments

Comments
 (0)