@tsslint/cli 2.0.2 → 2.0.3
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 +23 -9
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -11,13 +11,13 @@ const os = require("os");
|
|
|
11
11
|
const languagePlugins = require("./lib/languagePlugins.js");
|
|
12
12
|
process.env.TSSLINT_CLI = '1';
|
|
13
13
|
const _reset = '\x1b[0m';
|
|
14
|
-
const purple = (s) => '\x1b[35m' + s + _reset;
|
|
15
|
-
const cyan = (s) => '\x1b[36m' + s + _reset;
|
|
16
14
|
const darkGray = (s) => '\x1b[90m' + s + _reset;
|
|
17
15
|
const lightRed = (s) => '\x1b[91m' + s + _reset;
|
|
18
16
|
const lightGreen = (s) => '\x1b[92m' + s + _reset;
|
|
19
17
|
const lightYellow = (s) => '\x1b[93m' + s + _reset;
|
|
20
18
|
const lightBlue = (s) => '\x1b[94m' + s + _reset;
|
|
19
|
+
const purple = (s) => '\x1b[95m' + s + _reset;
|
|
20
|
+
const cyan = (s) => '\x1b[96m' + s + _reset;
|
|
21
21
|
// https://talyian.github.io/ansicolors/
|
|
22
22
|
const tsColor = (s) => '\x1b[34m' + s + _reset;
|
|
23
23
|
const tsMacroColor = (s) => '\x1b[38;5;135m' + s + _reset;
|
|
@@ -106,6 +106,7 @@ class Project {
|
|
|
106
106
|
let errors = 0;
|
|
107
107
|
let warnings = 0;
|
|
108
108
|
let messages = 0;
|
|
109
|
+
let suggestions = 0;
|
|
109
110
|
let cached = 0;
|
|
110
111
|
if (isTTY) {
|
|
111
112
|
const write = process.stdout.write.bind(process.stdout);
|
|
@@ -304,6 +305,7 @@ class Project {
|
|
|
304
305
|
[errors, 'errors', lightRed],
|
|
305
306
|
[warnings, 'warnings', lightYellow],
|
|
306
307
|
[messages, 'messages', lightBlue],
|
|
308
|
+
[suggestions, 'suggestions', darkGray],
|
|
307
309
|
[excluded, 'excluded', darkGray],
|
|
308
310
|
];
|
|
309
311
|
let summary = data
|
|
@@ -361,17 +363,28 @@ class Project {
|
|
|
361
363
|
else {
|
|
362
364
|
project.cache[fileName] = fileCache = [fileStat.mtimeMs, {}, {}];
|
|
363
365
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
+
const diagnostics = await linterWorker.lint(fileName, process.argv.includes('--fix'), fileCache);
|
|
367
|
+
const formatHost = {
|
|
368
|
+
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
369
|
+
getCanonicalFileName: ts.sys.useCaseSensitiveFileNames ? x => x : x => x.toLowerCase(),
|
|
370
|
+
getNewLine: () => ts.sys.newLine,
|
|
371
|
+
};
|
|
366
372
|
if (diagnostics.length) {
|
|
367
373
|
hasFix ||= await linterWorker.hasCodeFixes(fileName);
|
|
368
374
|
for (const diagnostic of diagnostics) {
|
|
369
375
|
hasFix ||= !!fileCache[1][diagnostic.code]?.[0];
|
|
370
|
-
let output
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
376
|
+
let output;
|
|
377
|
+
if (diagnostic.category === ts.DiagnosticCategory.Suggestion) {
|
|
378
|
+
output = ts.formatDiagnosticsWithColorAndContext([{
|
|
379
|
+
...diagnostic,
|
|
380
|
+
category: ts.DiagnosticCategory.Message,
|
|
381
|
+
}], formatHost);
|
|
382
|
+
output = output.replace(/\[94mmessage/, '[90msuggestion');
|
|
383
|
+
output = output.replace(/\[94m/g, '[90m');
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
output = ts.formatDiagnosticsWithColorAndContext([diagnostic], formatHost);
|
|
387
|
+
}
|
|
375
388
|
output = output.trimEnd();
|
|
376
389
|
if (typeof diagnostic.code === 'string') {
|
|
377
390
|
output = output.replace(`TS${diagnostic.code}`, diagnostic.code);
|
|
@@ -389,6 +402,7 @@ class Project {
|
|
|
389
402
|
log(output);
|
|
390
403
|
}
|
|
391
404
|
else {
|
|
405
|
+
suggestions++;
|
|
392
406
|
log(output);
|
|
393
407
|
}
|
|
394
408
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
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": "2.0.
|
|
20
|
-
"@tsslint/core": "2.0.
|
|
19
|
+
"@tsslint/config": "2.0.3",
|
|
20
|
+
"@tsslint/core": "2.0.3",
|
|
21
21
|
"@volar/language-core": "~2.4.0",
|
|
22
22
|
"@volar/language-hub": "0.0.1",
|
|
23
23
|
"@volar/typescript": "~2.4.0",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"@vue-vine/language-service": "latest",
|
|
32
32
|
"@vue/language-core": "latest"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "1950a26843ec8ca974ea4f10efa4b6ad36e2ffbf"
|
|
35
35
|
}
|