@tsslint/cli 1.4.3 → 1.4.4
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/index.js +9 -11
- package/lib/worker.d.ts +1 -1
- package/lib/worker.js +3 -5
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -335,16 +335,15 @@ class Project {
|
|
|
335
335
|
if (fileCache[0] !== fileMtime) {
|
|
336
336
|
fileCache[0] = fileMtime;
|
|
337
337
|
fileCache[1] = {};
|
|
338
|
-
fileCache[2]
|
|
339
|
-
fileCache[3]
|
|
340
|
-
fileCache[4] = {};
|
|
338
|
+
fileCache[2] = {};
|
|
339
|
+
fileCache[3] = {};
|
|
341
340
|
}
|
|
342
341
|
else {
|
|
343
342
|
cached++;
|
|
344
343
|
}
|
|
345
344
|
}
|
|
346
345
|
else {
|
|
347
|
-
project.cache[fileName] = fileCache = [fileMtime, {},
|
|
346
|
+
project.cache[fileName] = fileCache = [fileMtime, {}, {}, {}];
|
|
348
347
|
}
|
|
349
348
|
let diagnostics;
|
|
350
349
|
if (process.argv.includes('--fix')) {
|
|
@@ -353,12 +352,11 @@ class Project {
|
|
|
353
352
|
else {
|
|
354
353
|
diagnostics = await linterWorker.lint(fileName, fileCache);
|
|
355
354
|
}
|
|
355
|
+
diagnostics = diagnostics.filter(diagnostic => diagnostic.category !== ts.DiagnosticCategory.Suggestion);
|
|
356
356
|
if (diagnostics.length) {
|
|
357
|
-
hasFix ||=
|
|
357
|
+
hasFix ||= await linterWorker.hasCodeFixes(fileName);
|
|
358
358
|
for (const diagnostic of diagnostics) {
|
|
359
|
-
|
|
360
|
-
continue;
|
|
361
|
-
}
|
|
359
|
+
hasFix ||= !!fileCache[1][diagnostic.code];
|
|
362
360
|
let output = ts.formatDiagnosticsWithColorAndContext([diagnostic], {
|
|
363
361
|
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
364
362
|
getCanonicalFileName: ts.sys.useCaseSensitiveFileNames ? x => x : x => x.toLowerCase(),
|
|
@@ -379,7 +377,7 @@ class Project {
|
|
|
379
377
|
}
|
|
380
378
|
}
|
|
381
379
|
}
|
|
382
|
-
else if (!(await linterWorker.hasRules(fileName, fileCache[
|
|
380
|
+
else if (!(await linterWorker.hasRules(fileName, fileCache[3]))) {
|
|
383
381
|
excluded++;
|
|
384
382
|
}
|
|
385
383
|
else {
|
|
@@ -408,10 +406,10 @@ class Project {
|
|
|
408
406
|
function updateSpinner() {
|
|
409
407
|
if (processFiles.size === 1) {
|
|
410
408
|
const fileName = processFiles.values().next().value;
|
|
411
|
-
spinner.message(`[${processed + processFiles.size}/${allFilesNum}] ${path.relative(process.cwd(), fileName)}`);
|
|
409
|
+
spinner.message(darkGray(`[${processed + processFiles.size}/${allFilesNum}] ${path.relative(process.cwd(), fileName)}`));
|
|
412
410
|
}
|
|
413
411
|
else {
|
|
414
|
-
spinner.message(`[${processed + processFiles.size}/${allFilesNum}] Processing ${processFiles.size} files`);
|
|
412
|
+
spinner.message(darkGray(`[${processed + processFiles.size}/${allFilesNum}] Processing ${processFiles.size} files`));
|
|
415
413
|
}
|
|
416
414
|
}
|
|
417
415
|
function log(msg, code) {
|
package/lib/worker.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ declare function setup(tsconfig: string, languages: string[], configFile: string
|
|
|
18
18
|
declare function lintAndFix(fileName: string, fileCache: core.FileLintCache): readonly [ts.DiagnosticWithLocation[], core.FileLintCache];
|
|
19
19
|
declare function lint(fileName: string, fileCache: core.FileLintCache): readonly [ts.DiagnosticWithLocation[], core.FileLintCache];
|
|
20
20
|
declare function hasCodeFixes(fileName: string): boolean;
|
|
21
|
-
declare function hasRules(fileName: string, minimatchCache: core.FileLintCache[
|
|
21
|
+
declare function hasRules(fileName: string, minimatchCache: core.FileLintCache[3]): readonly [boolean, Record<string, boolean>];
|
|
22
22
|
export {};
|
package/lib/worker.js
CHANGED
|
@@ -204,12 +204,11 @@ function lintAndFix(fileName, fileCache) {
|
|
|
204
204
|
if (Object.values(fileCache[1]).some(fixes => fixes > 0)) {
|
|
205
205
|
// Reset the cache if there are any fixes applied.
|
|
206
206
|
fileCache[1] = {};
|
|
207
|
-
fileCache[2]
|
|
208
|
-
fileCache[3].length = 0;
|
|
207
|
+
fileCache[2] = {};
|
|
209
208
|
}
|
|
210
209
|
diagnostics = linter.lint(fileName, fileCache);
|
|
211
210
|
let fixes = linter
|
|
212
|
-
.getCodeFixes(fileName, 0, Number.MAX_VALUE, diagnostics, fileCache[
|
|
211
|
+
.getCodeFixes(fileName, 0, Number.MAX_VALUE, diagnostics, fileCache[3])
|
|
213
212
|
.filter(fix => fix.fixId === 'tsslint');
|
|
214
213
|
if (language) {
|
|
215
214
|
fixes = fixes.map(fix => {
|
|
@@ -231,8 +230,7 @@ function lintAndFix(fileName, fileCache) {
|
|
|
231
230
|
ts.sys.writeFile(fileName, newSnapshot.getText(0, newSnapshot.getLength()));
|
|
232
231
|
fileCache[0] = fs.statSync(fileName).mtimeMs;
|
|
233
232
|
fileCache[1] = {};
|
|
234
|
-
fileCache[2]
|
|
235
|
-
fileCache[3].length = 0;
|
|
233
|
+
fileCache[2] = {};
|
|
236
234
|
}
|
|
237
235
|
if (shouldRetry) {
|
|
238
236
|
diagnostics = linter.lint(fileName, fileCache);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tsslint": "./bin/tsslint.js"
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@clack/prompts": "^0.8.2",
|
|
19
|
-
"@tsslint/config": "1.4.
|
|
20
|
-
"@tsslint/core": "1.4.
|
|
19
|
+
"@tsslint/config": "1.4.4",
|
|
20
|
+
"@tsslint/core": "1.4.4",
|
|
21
21
|
"@volar/language-core": "~2.4.0",
|
|
22
22
|
"@volar/typescript": "~2.4.0",
|
|
23
23
|
"glob": "^10.4.1"
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@vue/language-core": "latest"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "7e4401c6734fd2b8d09d9aa45584e83e3ecf9e48"
|
|
32
32
|
}
|