@tsslint/typescript-plugin 1.0.14 → 1.0.15
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 +49 -52
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -160,22 +160,6 @@ function decorateLanguageService(ts, tsconfig, info) {
|
|
|
160
160
|
if (!configFile) {
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
let configImportPath;
|
|
164
|
-
try {
|
|
165
|
-
configImportPath = require.resolve('@tsslint/config/lib/watch', { paths: [path.dirname(configFile)] });
|
|
166
|
-
}
|
|
167
|
-
catch (err) {
|
|
168
|
-
configFileDiagnostics = [{
|
|
169
|
-
category: ts.DiagnosticCategory.Error,
|
|
170
|
-
code: 0,
|
|
171
|
-
messageText: String(err),
|
|
172
|
-
file: jsonConfigFile,
|
|
173
|
-
start: 0,
|
|
174
|
-
length: 0,
|
|
175
|
-
}];
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
const { watchConfigFile } = require(configImportPath);
|
|
179
163
|
const projectContext = {
|
|
180
164
|
configFile,
|
|
181
165
|
tsconfig,
|
|
@@ -183,44 +167,57 @@ function decorateLanguageService(ts, tsconfig, info) {
|
|
|
183
167
|
languageService: info.languageService,
|
|
184
168
|
typescript: ts,
|
|
185
169
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
170
|
+
try {
|
|
171
|
+
configFileBuildContext = await (0, core_1.watchConfigFile)(configFile, (_config, { errors, warnings }) => {
|
|
172
|
+
config = _config;
|
|
173
|
+
configFileDiagnostics = [
|
|
174
|
+
...errors.map(error => [error, ts.DiagnosticCategory.Error]),
|
|
175
|
+
...warnings.map(error => [error, ts.DiagnosticCategory.Warning]),
|
|
176
|
+
].map(([error, category]) => {
|
|
177
|
+
const diag = {
|
|
178
|
+
category,
|
|
179
|
+
source: 'tsslint',
|
|
180
|
+
code: 0,
|
|
181
|
+
messageText: 'Failed to build/load TSSLint config.',
|
|
182
|
+
file: jsonConfigFile,
|
|
183
|
+
start: configOptionSpan.start,
|
|
184
|
+
length: configOptionSpan.length,
|
|
185
|
+
};
|
|
186
|
+
if (error.location) {
|
|
187
|
+
const fileName = path.resolve(error.location.file);
|
|
188
|
+
const fileText = ts.sys.readFile(error.location.file);
|
|
189
|
+
const sourceFile = ts.createSourceFile(fileName, fileText ?? '', ts.ScriptTarget.Latest, true);
|
|
190
|
+
diag.relatedInformation = [{
|
|
191
|
+
category,
|
|
192
|
+
code: error.id,
|
|
193
|
+
messageText: error.text,
|
|
194
|
+
file: sourceFile,
|
|
195
|
+
start: sourceFile.getPositionOfLineAndCharacter(error.location.line - 1, error.location.column),
|
|
196
|
+
length: error.location.lineText.length,
|
|
197
|
+
}];
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
diag.messageText += `\n\n${error.text}`;
|
|
201
|
+
}
|
|
202
|
+
return diag;
|
|
203
|
+
});
|
|
204
|
+
if (config) {
|
|
205
|
+
linter = (0, core_1.createLinter)(projectContext, config, true);
|
|
216
206
|
}
|
|
217
|
-
|
|
207
|
+
info.project.refreshDiagnostics();
|
|
208
|
+
}, true, ts.sys.createHash);
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
configFileDiagnostics.push({
|
|
212
|
+
category: ts.DiagnosticCategory.Error,
|
|
213
|
+
source: 'tsslint',
|
|
214
|
+
code: 'config-build-error',
|
|
215
|
+
messageText: String(err),
|
|
216
|
+
file: jsonConfigFile,
|
|
217
|
+
start: configOptionSpan.start,
|
|
218
|
+
length: configOptionSpan.length,
|
|
218
219
|
});
|
|
219
|
-
|
|
220
|
-
linter = (0, core_1.createLinter)(projectContext, config, true);
|
|
221
|
-
}
|
|
222
|
-
info.project.refreshDiagnostics();
|
|
223
|
-
}, true, ts.sys.createHash);
|
|
220
|
+
}
|
|
224
221
|
}
|
|
225
222
|
}
|
|
226
223
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/typescript-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"directory": "packages/typescript-plugin"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@tsslint/core": "1.0.
|
|
15
|
+
"@tsslint/core": "1.0.15"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tsslint/config": "1.0.
|
|
18
|
+
"@tsslint/config": "1.0.15"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "58de9acb2cb7a1d7e93a5fb983fec54bf083f7b9"
|
|
21
21
|
}
|