@tsslint/typescript-plugin 1.0.15 → 1.0.17

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.
Files changed (2) hide show
  1. package/index.js +13 -29
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -33,33 +33,15 @@ function decorateLanguageService(ts, tsconfig, info) {
33
33
  if (!isProjectFileName(fileName)) {
34
34
  return result;
35
35
  }
36
- if (configFileDiagnostics.length || config?.debug) {
36
+ if (configFileDiagnostics.length) {
37
37
  const sourceFile = info.languageService.getProgram()?.getSourceFile(fileName);
38
38
  if (sourceFile) {
39
- if (configFileDiagnostics.length) {
40
- result = result.concat(configFileDiagnostics.map(diagnostic => ({
41
- ...diagnostic,
42
- file: sourceFile,
43
- start: 0,
44
- length: 0,
45
- })));
46
- }
47
- if (config?.debug) {
48
- result.push({
49
- category: ts.DiagnosticCategory.Suggestion,
50
- source: 'tsslint',
51
- code: 'debug-info',
52
- messageText: JSON.stringify({
53
- rules: Object.keys(config?.rules ?? {}),
54
- plugins: config.plugins?.length,
55
- configFile,
56
- tsconfig,
57
- }, null, 2),
58
- file: sourceFile,
59
- start: 0,
60
- length: 0,
61
- });
62
- }
39
+ result = result.concat(configFileDiagnostics.map(diagnostic => ({
40
+ ...diagnostic,
41
+ file: sourceFile,
42
+ start: 0,
43
+ length: 0,
44
+ })));
63
45
  }
64
46
  }
65
47
  if (linter) {
@@ -178,21 +160,23 @@ function decorateLanguageService(ts, tsconfig, info) {
178
160
  category,
179
161
  source: 'tsslint',
180
162
  code: 0,
181
- messageText: 'Failed to build/load TSSLint config.',
163
+ messageText: `Failed to build/load TSSLint config. (${error.text})`,
182
164
  file: jsonConfigFile,
183
165
  start: configOptionSpan.start,
184
166
  length: configOptionSpan.length,
185
167
  };
186
168
  if (error.location) {
187
- const fileName = path.resolve(error.location.file);
169
+ const fileName = path.resolve(error.location.file).replace('http-url:', '');
188
170
  const fileText = ts.sys.readFile(error.location.file);
189
- const sourceFile = ts.createSourceFile(fileName, fileText ?? '', ts.ScriptTarget.Latest, true);
171
+ const sourceFile = fileText !== undefined
172
+ ? ts.createSourceFile(fileName, fileText, ts.ScriptTarget.Latest, true)
173
+ : undefined;
190
174
  diag.relatedInformation = [{
191
175
  category,
192
176
  code: error.id,
193
177
  messageText: error.text,
194
178
  file: sourceFile,
195
- start: sourceFile.getPositionOfLineAndCharacter(error.location.line - 1, error.location.column),
179
+ start: sourceFile?.getPositionOfLineAndCharacter(error.location.line - 1, error.location.column),
196
180
  length: error.location.lineText.length,
197
181
  }];
198
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsslint/typescript-plugin",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
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"
15
+ "@tsslint/core": "1.0.17"
16
16
  },
17
17
  "devDependencies": {
18
- "@tsslint/config": "1.0.15"
18
+ "@tsslint/config": "1.0.17"
19
19
  },
20
- "gitHead": "58de9acb2cb7a1d7e93a5fb983fec54bf083f7b9"
20
+ "gitHead": "5ffa59ffc098b272ff18579d9fc57f1658978a5e"
21
21
  }