@definitelytyped/eslint-plugin 0.0.195 → 0.0.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/rules/expect.d.ts +11 -0
- package/dist/rules/expect.js +428 -0
- package/dist/rules/expect.js.map +1 -0
- package/dist/rules/index.d.ts +6 -0
- package/dist/rules/index.js +2 -0
- package/dist/rules/index.js.map +1 -1
- package/dist/util.d.ts +1 -0
- package/dist/util.js +2 -1
- package/dist/util.js.map +1 -1
- package/package.json +2 -2
- package/src/rules/expect.ts +556 -0
- package/src/rules/index.ts +2 -0
- package/src/util.ts +1 -1
- package/test/__file_snapshots__/types/expect/expect-tests.ts.lint +79 -0
- package/test/__file_snapshots__/types/expect/index.d.ts.lint +19 -0
- package/test/fixtures/types/expect/expect-tests.ts +49 -0
- package/test/fixtures/types/expect/index.d.ts +9 -0
- package/test/fixtures/types/expect/package.json +5 -0
- package/test/fixtures/types/expect/tsconfig.json +20 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @definitelytyped/eslint-plugin
|
|
2
2
|
|
|
3
|
+
## 0.0.197
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3d6c2ffd: Port expect rule from tslint to eslint
|
|
8
|
+
|
|
9
|
+
## 0.0.196
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7805956b: Require eslint ^8.40.0 as peerDependency
|
|
14
|
+
|
|
3
15
|
## 0.0.195
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Options = [
|
|
2
|
+
{
|
|
3
|
+
versionsToTest?: {
|
|
4
|
+
readonly versionName: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
}[];
|
|
7
|
+
}
|
|
8
|
+
];
|
|
9
|
+
type MessageIds = "noTsconfig" | "twoAssertions" | "failure" | "diagnostic" | "programContents" | "noMatch" | "needInstall";
|
|
10
|
+
declare const rule: import("../util").RuleModule<Options, MessageIds>;
|
|
11
|
+
export = rule;
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const utils_1 = require("@definitelytyped/utils");
|
|
6
|
+
const util_1 = require("../util");
|
|
7
|
+
const utils_2 = require("@typescript-eslint/utils");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const builtinTypeScript = require("typescript");
|
|
11
|
+
const rule = (0, util_1.createRule)({
|
|
12
|
+
name: "expect",
|
|
13
|
+
meta: {
|
|
14
|
+
type: "problem",
|
|
15
|
+
docs: {
|
|
16
|
+
description: "Asserts types with $ExpectType.",
|
|
17
|
+
},
|
|
18
|
+
messages: {
|
|
19
|
+
noTsconfig: `Could not find a tsconfig.json file.`,
|
|
20
|
+
twoAssertions: "This line has 2 $ExpectType assertions.",
|
|
21
|
+
failure: `TypeScript{{versionNameString}} expected type to be:\n {{expectedType}}\ngot:\n {{actualType}}`,
|
|
22
|
+
diagnostic: `TypeScript{{versionNameString}} {{message}}`,
|
|
23
|
+
programContents: `Program source files differ between TypeScript versions. This may be a dtslint bug.\n` +
|
|
24
|
+
`Expected to find a file '{{fileName}}' present in ${builtinTypeScript.versionMajorMinor}, but did not find it in ts@{{versionName}}.`,
|
|
25
|
+
noMatch: "Cannot match a node to this assertion. If this is a multiline function call, ensure the assertion is on the line above.",
|
|
26
|
+
needInstall: `A module look-up failed, this often occurs when you need to run \`pnpm install\` on a dependent module before you can lint.
|
|
27
|
+
|
|
28
|
+
Before you debug, first try running:
|
|
29
|
+
|
|
30
|
+
pnpm install -w --filter '...{./types/{{dirPath}}}...'
|
|
31
|
+
|
|
32
|
+
Then re-run.`,
|
|
33
|
+
},
|
|
34
|
+
schema: [
|
|
35
|
+
{
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
versionsToTest: {
|
|
39
|
+
type: "array",
|
|
40
|
+
items: {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
versionName: { type: "string" },
|
|
44
|
+
path: { type: "string" },
|
|
45
|
+
},
|
|
46
|
+
required: ["versionName", "path"],
|
|
47
|
+
additionalProperties: false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
defaultOptions: [{}],
|
|
56
|
+
create(context) {
|
|
57
|
+
if ((0, utils_1.isDeclarationPath)(context.filename) || !context.sourceCode.text.includes("$ExpectType")) {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
const tsconfigPath = (0, util_1.findUp)(context.filename, (dir) => {
|
|
61
|
+
const tsconfig = path_1.default.join(dir, "tsconfig.json");
|
|
62
|
+
return fs_1.default.existsSync(tsconfig) ? tsconfig : undefined;
|
|
63
|
+
});
|
|
64
|
+
if (!tsconfigPath) {
|
|
65
|
+
context.report({
|
|
66
|
+
messageId: "noTsconfig",
|
|
67
|
+
loc: zeroSourceLocation,
|
|
68
|
+
});
|
|
69
|
+
return {};
|
|
70
|
+
}
|
|
71
|
+
// TODO: determine TS versions to run based on this package
|
|
72
|
+
const dirPath = path_1.default.dirname(tsconfigPath);
|
|
73
|
+
const parserServices = utils_2.ESLintUtils.getParserServices(context);
|
|
74
|
+
return {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
76
|
+
Program(node) {
|
|
77
|
+
var _a;
|
|
78
|
+
// Grab the filename as known by TS, just to make sure we get the right normalization.
|
|
79
|
+
const fileName = parserServices.esTreeNodeToTSNodeMap.get(node).fileName;
|
|
80
|
+
const getLocFromIndex = (index) => context.sourceCode.getLocFromIndex(index);
|
|
81
|
+
const toReport = new Map();
|
|
82
|
+
const reporter = ({ versionName, messageId, data, loc }) => {
|
|
83
|
+
const key = JSON.stringify({ messageId, data, loc });
|
|
84
|
+
let existing = toReport.get(key);
|
|
85
|
+
if (existing === undefined) {
|
|
86
|
+
toReport.set(key, (existing = { messageId, data, loc, versions: new Set() }));
|
|
87
|
+
}
|
|
88
|
+
existing.versions.add(versionName);
|
|
89
|
+
};
|
|
90
|
+
let versionsToTest = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.versionsToTest;
|
|
91
|
+
if (!(versionsToTest === null || versionsToTest === void 0 ? void 0 : versionsToTest.length)) {
|
|
92
|
+
// In the editor, just use the built-in install of TypeScript.
|
|
93
|
+
versionsToTest = [{ versionName: "", path: require.resolve("typescript") }];
|
|
94
|
+
}
|
|
95
|
+
for (const version of versionsToTest) {
|
|
96
|
+
const ts = require(version.path);
|
|
97
|
+
const program = getProgram(tsconfigPath, ts, version.versionName, parserServices.program);
|
|
98
|
+
walk(getLocFromIndex, reporter, fileName, program, ts, version.versionName,
|
|
99
|
+
/*nextHigherVersion*/ undefined, dirPath);
|
|
100
|
+
}
|
|
101
|
+
for (const { messageId, data, loc, versions } of toReport.values()) {
|
|
102
|
+
const versionNames = [...versions].sort().join(", ");
|
|
103
|
+
context.report({
|
|
104
|
+
messageId,
|
|
105
|
+
data: { ...data, versionNameString: versionNames ? `@${versionNames}` : "" },
|
|
106
|
+
loc,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
const programCache = new WeakMap();
|
|
114
|
+
/** Maps a tslint Program to one created with the version specified in `options`. */
|
|
115
|
+
function getProgram(configFile, ts, versionName, lintProgram) {
|
|
116
|
+
let versionToProgram = programCache.get(lintProgram);
|
|
117
|
+
if (versionToProgram === undefined) {
|
|
118
|
+
versionToProgram = new Map();
|
|
119
|
+
programCache.set(lintProgram, versionToProgram);
|
|
120
|
+
}
|
|
121
|
+
let newProgram = versionToProgram.get(versionName);
|
|
122
|
+
if (newProgram === undefined) {
|
|
123
|
+
newProgram = createProgram(configFile, ts);
|
|
124
|
+
versionToProgram.set(versionName, newProgram);
|
|
125
|
+
}
|
|
126
|
+
return newProgram;
|
|
127
|
+
}
|
|
128
|
+
function createProgram(configFile, ts) {
|
|
129
|
+
var _a;
|
|
130
|
+
const projectDirectory = path_1.default.dirname(configFile);
|
|
131
|
+
const { config } = ts.readConfigFile(configFile, ts.sys.readFile);
|
|
132
|
+
const parseConfigHost = {
|
|
133
|
+
fileExists: fs_1.default.existsSync,
|
|
134
|
+
readDirectory: ts.sys.readDirectory,
|
|
135
|
+
readFile: (file) => fs_1.default.readFileSync(file, "utf8"),
|
|
136
|
+
useCaseSensitiveFileNames: true,
|
|
137
|
+
};
|
|
138
|
+
const parsed = ts.parseJsonConfigFileContent(config, parseConfigHost, path_1.default.resolve(projectDirectory), {
|
|
139
|
+
noEmit: true,
|
|
140
|
+
});
|
|
141
|
+
if (((_a = config.compilerOptions) === null || _a === void 0 ? void 0 : _a.module) === "node16" && parsed.options.module === undefined) {
|
|
142
|
+
// TypeScript version is too old to handle the "node16" module option,
|
|
143
|
+
// but we can run tests falling back to commonjs/node.
|
|
144
|
+
parsed.options.module = ts.ModuleKind.CommonJS;
|
|
145
|
+
parsed.options.moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
146
|
+
}
|
|
147
|
+
const host = ts.createCompilerHost(parsed.options, true);
|
|
148
|
+
return ts.createProgram(parsed.fileNames, parsed.options, host);
|
|
149
|
+
}
|
|
150
|
+
const zeroSourceLocation = {
|
|
151
|
+
start: { line: 0, column: 0 },
|
|
152
|
+
end: { line: 0, column: 0 },
|
|
153
|
+
};
|
|
154
|
+
function walk(getLocFromIndex, report, fileName, program, ts, versionName, nextHigherVersion, dirPath) {
|
|
155
|
+
const sourceFile = program.getSourceFile(fileName);
|
|
156
|
+
if (!sourceFile) {
|
|
157
|
+
report({
|
|
158
|
+
versionName,
|
|
159
|
+
messageId: "programContents",
|
|
160
|
+
data: { fileName, versionName },
|
|
161
|
+
loc: zeroSourceLocation,
|
|
162
|
+
});
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const checker = program.getTypeChecker();
|
|
166
|
+
if (versionName) {
|
|
167
|
+
// If we're using the built-in version of TS, then we're in the editor and tsserver will report diagnostics.
|
|
168
|
+
// Don't care about emit errors.
|
|
169
|
+
const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);
|
|
170
|
+
for (const diagnostic of diagnostics) {
|
|
171
|
+
addDiagnosticFailure(diagnostic);
|
|
172
|
+
}
|
|
173
|
+
const cannotFindDepsDiags = diagnostics
|
|
174
|
+
.filter((d) => !d.file || isExternalDependency(d.file, dirPath, program))
|
|
175
|
+
.find((d) => d.code === 2307 && d.messageText.toString().includes("Cannot find module"));
|
|
176
|
+
if (cannotFindDepsDiags && cannotFindDepsDiags.file) {
|
|
177
|
+
const packageInfo = (0, util_1.findTypesPackage)(fileName);
|
|
178
|
+
if (!packageInfo) {
|
|
179
|
+
throw new Error("Could not find package info for " + fileName);
|
|
180
|
+
}
|
|
181
|
+
const dtRoot = (0, util_1.findUp)(packageInfo.dir, (dir) => {
|
|
182
|
+
if (fs_1.default.existsSync(path_1.default.join(dir, "notNeededPackages.json"))) {
|
|
183
|
+
return dir;
|
|
184
|
+
}
|
|
185
|
+
return undefined;
|
|
186
|
+
});
|
|
187
|
+
if (dtRoot) {
|
|
188
|
+
const dirPath = path_1.default.relative(dtRoot, path_1.default.dirname(packageInfo.dir));
|
|
189
|
+
report({
|
|
190
|
+
versionName,
|
|
191
|
+
messageId: "needInstall",
|
|
192
|
+
data: { dirPath },
|
|
193
|
+
loc: zeroSourceLocation,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (sourceFile.isDeclarationFile || !sourceFile.text.includes("$ExpectType")) {
|
|
199
|
+
// Normal file.
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const { typeAssertions, duplicates } = parseAssertions(sourceFile);
|
|
203
|
+
for (const line of duplicates) {
|
|
204
|
+
addFailureAtLine(report, { versionName, messageId: "twoAssertions" }, line);
|
|
205
|
+
}
|
|
206
|
+
const { unmetExpectations, unusedAssertions } = getExpectTypeFailures(sourceFile, typeAssertions, checker, ts);
|
|
207
|
+
for (const { node, expected, actual } of unmetExpectations) {
|
|
208
|
+
report({
|
|
209
|
+
versionName,
|
|
210
|
+
messageId: "failure",
|
|
211
|
+
data: {
|
|
212
|
+
expectedType: expected,
|
|
213
|
+
actualType: actual,
|
|
214
|
+
},
|
|
215
|
+
loc: {
|
|
216
|
+
start: getLocFromIndex(node.getStart(sourceFile)),
|
|
217
|
+
end: getLocFromIndex(node.getEnd()),
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
for (const line of unusedAssertions) {
|
|
222
|
+
addFailureAtLine(report, {
|
|
223
|
+
versionName,
|
|
224
|
+
messageId: "noMatch",
|
|
225
|
+
}, line - 1);
|
|
226
|
+
}
|
|
227
|
+
function addDiagnosticFailure(diagnostic) {
|
|
228
|
+
const intro = getIntro();
|
|
229
|
+
if (diagnostic.file === sourceFile) {
|
|
230
|
+
const msg = `${intro}\n${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`;
|
|
231
|
+
report({
|
|
232
|
+
versionName,
|
|
233
|
+
messageId: "diagnostic",
|
|
234
|
+
data: { message: msg },
|
|
235
|
+
loc: {
|
|
236
|
+
start: getLocFromIndex(diagnostic.start),
|
|
237
|
+
end: getLocFromIndex(diagnostic.start + diagnostic.length),
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
report({
|
|
243
|
+
versionName,
|
|
244
|
+
messageId: "diagnostic",
|
|
245
|
+
data: { message: `${intro}\n${fileName}${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}` },
|
|
246
|
+
loc: zeroSourceLocation,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function getIntro() {
|
|
251
|
+
if (nextHigherVersion === undefined) {
|
|
252
|
+
return `compile error: `;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
const msg = `Compile error in typescript@${versionName} but not in typescript@${nextHigherVersion}.\n`;
|
|
256
|
+
const explain = nextHigherVersion === "next"
|
|
257
|
+
? "TypeScript@next features not yet supported."
|
|
258
|
+
: `Fix by adding '"minimumTypeScriptVersion": "${nextHigherVersion}"' to package.json.`;
|
|
259
|
+
return msg + explain;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function addFailureAtLine(report, info, line) {
|
|
263
|
+
const start = sourceFile.getPositionOfLineAndCharacter(line, 0);
|
|
264
|
+
let end = start + sourceFile.text.split("\n")[line].length;
|
|
265
|
+
if (sourceFile.text[end - 1] === "\r") {
|
|
266
|
+
end--;
|
|
267
|
+
}
|
|
268
|
+
report({
|
|
269
|
+
...info,
|
|
270
|
+
loc: {
|
|
271
|
+
start: getLocFromIndex(start),
|
|
272
|
+
end: getLocFromIndex(end),
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// TODO(jakebailey): dedupe these copied frunctions from dtslint
|
|
278
|
+
function normalizePath(file) {
|
|
279
|
+
// replaces '\' with '/' and forces all DOS drive letters to be upper-case
|
|
280
|
+
return path_1.default
|
|
281
|
+
.normalize(file)
|
|
282
|
+
.replace(/\\/g, "/")
|
|
283
|
+
.replace(/^[a-z](?=:)/, (c) => c.toUpperCase());
|
|
284
|
+
}
|
|
285
|
+
function startsWithDirectory(filePath, dirPath) {
|
|
286
|
+
const normalFilePath = normalizePath(filePath);
|
|
287
|
+
const normalDirPath = normalizePath(dirPath).replace(/\/$/, "");
|
|
288
|
+
return normalFilePath.startsWith(normalDirPath + "/") || normalFilePath.startsWith(normalDirPath + "\\");
|
|
289
|
+
}
|
|
290
|
+
function isExternalDependency(file, dirPath, program) {
|
|
291
|
+
return !startsWithDirectory(file.fileName, dirPath) || program.isSourceFileFromExternalLibrary(file);
|
|
292
|
+
}
|
|
293
|
+
function parseAssertions(sourceFile) {
|
|
294
|
+
const typeAssertions = new Map();
|
|
295
|
+
const duplicates = [];
|
|
296
|
+
const { text } = sourceFile;
|
|
297
|
+
const commentRegexp = /\/\/(.*)/g;
|
|
298
|
+
const lineStarts = sourceFile.getLineStarts();
|
|
299
|
+
let curLine = 0;
|
|
300
|
+
while (true) {
|
|
301
|
+
const commentMatch = commentRegexp.exec(text);
|
|
302
|
+
if (commentMatch === null) {
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
// Match on the contents of that comment so we do nothing in a commented-out assertion,
|
|
306
|
+
// i.e. `// foo; // $ExpectType number`
|
|
307
|
+
if (!commentMatch[1].startsWith(" $ExpectType ")) {
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
const line = getLine(commentMatch.index);
|
|
311
|
+
const expectedType = commentMatch[1].slice(" $ExpectType ".length);
|
|
312
|
+
// Don't bother with the assertion if there are 2 assertions on 1 line. Just fail for the duplicate.
|
|
313
|
+
if (typeAssertions.delete(line)) {
|
|
314
|
+
duplicates.push(line);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
typeAssertions.set(line, expectedType);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return { typeAssertions, duplicates };
|
|
321
|
+
function getLine(pos) {
|
|
322
|
+
// advance curLine to be the line preceding 'pos'
|
|
323
|
+
while (lineStarts[curLine + 1] <= pos) {
|
|
324
|
+
curLine++;
|
|
325
|
+
}
|
|
326
|
+
// If this is the first token on the line, it applies to the next line.
|
|
327
|
+
// Otherwise, it applies to the text to the left of it.
|
|
328
|
+
return isFirstOnLine(text, lineStarts[curLine], pos) ? curLine + 1 : curLine;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function isFirstOnLine(text, lineStart, pos) {
|
|
332
|
+
for (let i = lineStart; i < pos; i++) {
|
|
333
|
+
if (text[i] !== " ") {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
function getExpectTypeFailures(sourceFile, typeAssertions, checker, ts) {
|
|
340
|
+
const unmetExpectations = [];
|
|
341
|
+
// Match assertions to the first node that appears on the line they apply to.
|
|
342
|
+
// `forEachChild` isn't available as a method in older TypeScript versions, so must use `ts.forEachChild` instead.
|
|
343
|
+
ts.forEachChild(sourceFile, function iterate(node) {
|
|
344
|
+
if (node.kind === ts.SyntaxKind.EndOfFileToken) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const line = lineOfPosition(node.getStart(sourceFile), sourceFile);
|
|
348
|
+
const expected = typeAssertions.get(line);
|
|
349
|
+
if (expected !== undefined) {
|
|
350
|
+
// https://github.com/Microsoft/TypeScript/issues/14077
|
|
351
|
+
if (node.kind === ts.SyntaxKind.ExpressionStatement) {
|
|
352
|
+
node = node.expression;
|
|
353
|
+
}
|
|
354
|
+
const type = checker.getTypeAtLocation(getNodeForExpectType(node, ts));
|
|
355
|
+
const actual = type
|
|
356
|
+
? checker.typeToString(type, /*enclosingDeclaration*/ undefined, ts.TypeFormatFlags.NoTruncation)
|
|
357
|
+
: "";
|
|
358
|
+
let actualNormalized;
|
|
359
|
+
const candidates = expected.split(/\s*\|\|\s*/).map((s) => s.trim());
|
|
360
|
+
if (!(
|
|
361
|
+
// Fast path
|
|
362
|
+
(candidates.some((s) => s === actual) ||
|
|
363
|
+
candidates.some((s) => {
|
|
364
|
+
actualNormalized !== null && actualNormalized !== void 0 ? actualNormalized : (actualNormalized = normalizedTypeToString(ts, actual));
|
|
365
|
+
const normalized = normalizedTypeToString(ts, s);
|
|
366
|
+
return normalized === actualNormalized;
|
|
367
|
+
})))) {
|
|
368
|
+
unmetExpectations.push({ node, expected, actual });
|
|
369
|
+
}
|
|
370
|
+
typeAssertions.delete(line);
|
|
371
|
+
}
|
|
372
|
+
ts.forEachChild(node, iterate);
|
|
373
|
+
});
|
|
374
|
+
return { unmetExpectations, unusedAssertions: typeAssertions.keys() };
|
|
375
|
+
}
|
|
376
|
+
function normalizedTypeToString(ts, type) {
|
|
377
|
+
const sourceFile = ts.createSourceFile("foo.ts", `declare var x: ${type};`, ts.ScriptTarget.Latest);
|
|
378
|
+
const typeNode = sourceFile.statements[0].declarationList.declarations[0].type;
|
|
379
|
+
const printer = ts.createPrinter({});
|
|
380
|
+
function print(node) {
|
|
381
|
+
return printer.printNode(ts.EmitHint.Unspecified, node, sourceFile);
|
|
382
|
+
}
|
|
383
|
+
// TODO: pass undefined instead once https://github.com/microsoft/TypeScript/pull/52941 is released
|
|
384
|
+
const context = ts.nullTransformationContext;
|
|
385
|
+
function visit(node) {
|
|
386
|
+
node = ts.visitEachChild(node, visit, context);
|
|
387
|
+
if (ts.isUnionTypeNode(node)) {
|
|
388
|
+
const types = node.types
|
|
389
|
+
.map((t) => [t, print(t)])
|
|
390
|
+
.sort((a, b) => (a[1] < b[1] ? -1 : 1))
|
|
391
|
+
.map((t) => t[0]);
|
|
392
|
+
return ts.factory.updateUnionTypeNode(node, ts.factory.createNodeArray(types));
|
|
393
|
+
}
|
|
394
|
+
if (ts.isTypeOperatorNode(node) &&
|
|
395
|
+
node.operator === ts.SyntaxKind.ReadonlyKeyword &&
|
|
396
|
+
ts.isArrayTypeNode(node.type)) {
|
|
397
|
+
// It's possible that this would conflict with a library which defines their own type with this name,
|
|
398
|
+
// but that's unlikely (and was not previously handled in a prior revision of type string normalization).
|
|
399
|
+
return ts.factory.createTypeReferenceNode("ReadonlyArray", [skipTypeParentheses(ts, node.type.elementType)]);
|
|
400
|
+
}
|
|
401
|
+
return node;
|
|
402
|
+
}
|
|
403
|
+
const visited = visit(typeNode);
|
|
404
|
+
return print(visited);
|
|
405
|
+
}
|
|
406
|
+
function skipTypeParentheses(ts, node) {
|
|
407
|
+
while (ts.isParenthesizedTypeNode(node))
|
|
408
|
+
node = node.type;
|
|
409
|
+
return node;
|
|
410
|
+
}
|
|
411
|
+
function getNodeForExpectType(node, ts) {
|
|
412
|
+
if (node.kind === ts.SyntaxKind.VariableStatement) {
|
|
413
|
+
// ts2.0 doesn't have `isVariableStatement`
|
|
414
|
+
const { declarationList: { declarations }, } = node;
|
|
415
|
+
if (declarations.length === 1) {
|
|
416
|
+
const { initializer } = declarations[0];
|
|
417
|
+
if (initializer) {
|
|
418
|
+
return initializer;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return node;
|
|
423
|
+
}
|
|
424
|
+
function lineOfPosition(pos, sourceFile) {
|
|
425
|
+
return sourceFile.getLineAndCharacterOfPosition(pos).line;
|
|
426
|
+
}
|
|
427
|
+
module.exports = rule;
|
|
428
|
+
//# sourceMappingURL=expect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/rules/expect.ts"],"names":[],"mappings":";;;;AAAA,kDAA2D;AAC3D,kCAA+D;AAC/D,oDAAiE;AAEjE,gDAAwB;AACxB,4CAAoB;AAIpB,MAAM,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAa,CAAC;AAmB5D,MAAM,IAAI,GAAG,IAAA,iBAAU,EAAsB;IAC3C,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,iCAAiC;SAC/C;QACD,QAAQ,EAAE;YACR,UAAU,EAAE,sCAAsC;YAClD,aAAa,EAAE,yCAAyC;YACxD,OAAO,EAAE,kGAAkG;YAC3G,UAAU,EAAE,6CAA6C;YACzD,eAAe,EACb,uFAAuF;gBACvF,qDAAqD,iBAAiB,CAAC,iBAAiB,8CAA8C;YACxI,OAAO,EACL,yHAAyH;YAC3H,W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;IACvD,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,iBAAiB,EAAE;QACjD,2CAA2C;QAC3C,MAAM,EACJ,eAAe,EAAE,EAAE,YAAY,EAAE,GAClC,GAAG,IAA4B,CAAC;QACjC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7B,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YACxC,IAAI,WAAW,EAAE;gBACf,OAAO,WAAW,CAAC;aACpB;SACF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,GAAW,EAAE,UAAyB;IAC5D,OAAO,UAAU,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED,iBAAS,IAAI,CAAC"}
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -17,4 +17,10 @@ export declare const rules: {
|
|
|
17
17
|
"no-single-declare-module": import("../util").RuleModule<never[], "oneModuleDeclaration">;
|
|
18
18
|
"no-old-dt-header": import("../util").RuleModule<never[], "noOldDTHeader">;
|
|
19
19
|
"no-import-of-dev-dependencies": import("../util").RuleModule<never[], "noImportOfDevDependencies" | "noReferenceOfDevDependencies">;
|
|
20
|
+
expect: import("../util").RuleModule<[{
|
|
21
|
+
versionsToTest?: {
|
|
22
|
+
readonly versionName: string;
|
|
23
|
+
readonly path: string;
|
|
24
|
+
}[] | undefined;
|
|
25
|
+
}], "noTsconfig" | "twoAssertions" | "failure" | "diagnostic" | "programContents" | "noMatch" | "needInstall">;
|
|
20
26
|
};
|
package/dist/rules/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const strictExportDeclareModifiers = require("./strict-export-declare-modifiers"
|
|
|
19
19
|
const noSingleDeclareModule = require("./no-single-declare-module");
|
|
20
20
|
const noOldDTHeader = require("./no-old-dt-header");
|
|
21
21
|
const noImportOfDevDependencies = require("./no-import-of-dev-dependencies");
|
|
22
|
+
const expect = require("./expect");
|
|
22
23
|
exports.rules = {
|
|
23
24
|
"export-just-namespace": exportJustNamespace,
|
|
24
25
|
"no-any-union": noAnyUnion,
|
|
@@ -38,5 +39,6 @@ exports.rules = {
|
|
|
38
39
|
"no-single-declare-module": noSingleDeclareModule,
|
|
39
40
|
"no-old-dt-header": noOldDTHeader,
|
|
40
41
|
"no-import-of-dev-dependencies": noImportOfDevDependencies,
|
|
42
|
+
expect,
|
|
41
43
|
};
|
|
42
44
|
//# sourceMappingURL=index.js.map
|
package/dist/rules/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";;;AAAA,+DAAgE;AAChE,6CAA8C;AAC9C,qDAAsD;AACtD,+CAAgD;AAChD,uDAAwD;AACxD,wEAAyE;AACzE,sFAAuF;AACvF,uEAAwE;AACxE,iDAAkD;AAClD,2EAA4E;AAC5E,mEAAoE;AACpE,qDAAsD;AACtD,mEAAoE;AACpE,4DAA6D;AAC7D,kFAAmF;AACnF,oEAAqE;AACrE,oDAAqD;AACrD,6EAA8E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";;;AAAA,+DAAgE;AAChE,6CAA8C;AAC9C,qDAAsD;AACtD,+CAAgD;AAChD,uDAAwD;AACxD,wEAAyE;AACzE,sFAAuF;AACvF,uEAAwE;AACxE,iDAAkD;AAClD,2EAA4E;AAC5E,mEAAoE;AACpE,qDAAsD;AACtD,mEAAoE;AACpE,4DAA6D;AAC7D,kFAAmF;AACnF,oEAAqE;AACrE,oDAAqD;AACrD,6EAA8E;AAC9E,mCAAoC;AAEvB,QAAA,KAAK,GAAG;IACnB,uBAAuB,EAAE,mBAAmB;IAC5C,cAAc,EAAE,UAAU;IAC1B,kBAAkB,EAAE,cAAc;IAClC,eAAe,EAAE,WAAW;IAC5B,mBAAmB,EAAE,eAAe;IACpC,4BAA4B,EAAE,uBAAuB;IACrD,oCAAoC,EAAE,6BAA6B;IACnE,4BAA4B,EAAE,sBAAsB;IACpD,gBAAgB,EAAE,YAAY;IAC9B,8BAA8B,EAAE,wBAAwB;IACxD,yBAAyB,EAAE,qBAAqB;IAChD,kBAAkB,EAAE,cAAc;IAClC,yBAAyB,EAAE,qBAAqB;IAChD,qBAAqB,EAAE,kBAAkB;IACzC,iCAAiC,EAAE,4BAA4B;IAC/D,0BAA0B,EAAE,qBAAqB;IACjD,kBAAkB,EAAE,aAAa;IACjC,+BAA+B,EAAE,yBAAyB;IAC1D,MAAM;CACP,CAAC"}
|
package/dist/util.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type RuleModule<TOptions extends readonly unknown[], TMessageIds extends
|
|
|
3
3
|
export declare const createRule: <TOptions extends readonly unknown[], TMessageIds extends string>(opts: Readonly<ESLintUtils.RuleWithMetaAndName<TOptions, TMessageIds>>) => RuleModule<TOptions, TMessageIds>;
|
|
4
4
|
export declare function getTypesPackageForDeclarationFile(file: string): string | undefined;
|
|
5
5
|
export declare function commentsMatching(sourceFile: Readonly<TSESLint.SourceCode>, regex: RegExp, f: (match: string, c: TSESTree.Comment) => void): void;
|
|
6
|
+
export declare function findUp<T extends {}>(p: string, fn: (p: string) => T | undefined): T | undefined;
|
|
6
7
|
export interface TypesPackageInfo {
|
|
7
8
|
dir: string;
|
|
8
9
|
/** package.json with name="@types/foo__bar-baz" */
|
package/dist/util.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getImportSource = exports.findTypesPackage = exports.commentsMatching = exports.getTypesPackageForDeclarationFile = exports.createRule = void 0;
|
|
6
|
+
exports.getImportSource = exports.findTypesPackage = exports.findUp = exports.commentsMatching = exports.getTypesPackageForDeclarationFile = exports.createRule = void 0;
|
|
7
7
|
const utils_1 = require("@definitelytyped/utils");
|
|
8
8
|
const utils_2 = require("@typescript-eslint/utils");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -40,6 +40,7 @@ function findUp(p, fn) {
|
|
|
40
40
|
}
|
|
41
41
|
return undefined;
|
|
42
42
|
}
|
|
43
|
+
exports.findUp = findUp;
|
|
43
44
|
// TODO(jakebailey): pull this helper out to util package?
|
|
44
45
|
function isTypesPackage(packageJson) {
|
|
45
46
|
return (typeof packageJson.name === "string" &&
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAuF;AACvF,oDAA2E;AAC3E,gDAAwB;AACxB,4CAAoB;AASP,QAAA,UAAU,GAEkB,mBAAW,CAAC,WAAW,CAC9D,CAAC,IAAI,EAAE,EAAE,CACP,oGAAoG,IAAI,KAAK,CAChH,CAAC;AAEF,SAAgB,iCAAiC,CAAC,IAAY;;IAC5D,IAAI,CAAC,IAAA,yBAAiB,EAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,MAAA,gBAAgB,CAAC,IAAI,CAAC,0CAAE,QAAQ,CAAC;AAC1C,CAAC;AALD,8EAKC;AAED,SAAgB,gBAAgB,CAC9B,UAAyC,EACzC,KAAa,EACb,CAA+C;IAE/C,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE;QAC7C,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC;YAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;KACzB;AACH,CAAC;AATD,4CASC;AAED,
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"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O,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC;KACxC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAhBD,0CAgBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@definitelytyped/eslint-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.197",
|
|
4
4
|
"description": "ESLint rules for DefinitelyTyped",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
27
27
|
"@typescript-eslint/parser": "^6.11.0",
|
|
28
|
-
"eslint": "^8.
|
|
28
|
+
"eslint": "^8.40.0",
|
|
29
29
|
"eslint-plugin-jsdoc": "^44.0.0",
|
|
30
30
|
"typescript": ">= 3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.7.0-dev || >= 3.8.0-dev || >= 3.9.0-dev || >= 4.0.0-dev || >=5.0.0-dev"
|
|
31
31
|
},
|