@tsslint/core 1.0.1 → 1.0.2
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 +42 -28
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -54,16 +54,16 @@ function createLinter(ctx, config, withStack) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
return result;
|
|
57
|
-
function reportError(message, start, end,
|
|
58
|
-
return report(ts.DiagnosticCategory.Error, message, start, end,
|
|
57
|
+
function reportError(message, start, end, traceOffset = 0) {
|
|
58
|
+
return report(ts.DiagnosticCategory.Error, message, start, end, traceOffset);
|
|
59
59
|
}
|
|
60
|
-
function reportWarning(message, start, end,
|
|
61
|
-
return report(ts.DiagnosticCategory.Warning, message, start, end,
|
|
60
|
+
function reportWarning(message, start, end, traceOffset = 0) {
|
|
61
|
+
return report(ts.DiagnosticCategory.Warning, message, start, end, traceOffset);
|
|
62
62
|
}
|
|
63
|
-
function reportSuggestion(message, start, end,
|
|
64
|
-
return report(ts.DiagnosticCategory.Suggestion, message, start, end,
|
|
63
|
+
function reportSuggestion(message, start, end, traceOffset = 0) {
|
|
64
|
+
return report(ts.DiagnosticCategory.Suggestion, message, start, end, traceOffset);
|
|
65
65
|
}
|
|
66
|
-
function report(category, message, start, end,
|
|
66
|
+
function report(category, message, start, end, traceOffset) {
|
|
67
67
|
const error = {
|
|
68
68
|
category,
|
|
69
69
|
code: currentRuleId,
|
|
@@ -74,9 +74,33 @@ function createLinter(ctx, config, withStack) {
|
|
|
74
74
|
source: 'tsslint',
|
|
75
75
|
relatedInformation: [],
|
|
76
76
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if (withStack) {
|
|
78
|
+
const stacks = traceOffset === false
|
|
79
|
+
? []
|
|
80
|
+
: ErrorStackParser.parse(new Error());
|
|
81
|
+
if (typeof traceOffset === 'number') {
|
|
82
|
+
const baseOffset = 2 + traceOffset;
|
|
83
|
+
if (config.debug) {
|
|
84
|
+
for (let i = baseOffset; i < stacks.length; i++) {
|
|
85
|
+
pushRelatedInformation(error, stacks[i]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
if (stacks.length > baseOffset) {
|
|
90
|
+
pushRelatedInformation(error, stacks[baseOffset]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (withStack) {
|
|
95
|
+
error.relatedInformation?.push({
|
|
96
|
+
category: ts.DiagnosticCategory.Message,
|
|
97
|
+
code: 0,
|
|
98
|
+
file: configSourceFile,
|
|
99
|
+
start: 0,
|
|
100
|
+
length: 0,
|
|
101
|
+
messageText: 'TSSLint configuration file',
|
|
102
|
+
});
|
|
103
|
+
}
|
|
80
104
|
}
|
|
81
105
|
result.push(error);
|
|
82
106
|
return {
|
|
@@ -122,24 +146,14 @@ function createLinter(ctx, config, withStack) {
|
|
|
122
146
|
pos = stackFile?.getPositionOfLineAndCharacter(stack.lineNumber - 1, stack.columnNumber - 1) ?? 0;
|
|
123
147
|
}
|
|
124
148
|
catch { }
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
error.relatedInformation?.push({
|
|
135
|
-
category: ts.DiagnosticCategory.Message,
|
|
136
|
-
code: 0,
|
|
137
|
-
file: configSourceFile,
|
|
138
|
-
start: 0,
|
|
139
|
-
length: 0,
|
|
140
|
-
messageText: '',
|
|
141
|
-
});
|
|
142
|
-
}
|
|
149
|
+
error.relatedInformation?.push({
|
|
150
|
+
category: ts.DiagnosticCategory.Message,
|
|
151
|
+
code: 0,
|
|
152
|
+
file: stackFile,
|
|
153
|
+
start: pos,
|
|
154
|
+
length: 0,
|
|
155
|
+
messageText: 'Reported at',
|
|
156
|
+
});
|
|
143
157
|
}
|
|
144
158
|
}
|
|
145
159
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"source-map-support": "^0.5.21"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tsslint/config": "1.0.
|
|
19
|
+
"@tsslint/config": "1.0.2"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "e9bbdd4eba295de6bcb663e02c305f2b48893d6f"
|
|
22
22
|
}
|