@tsslint/typescript-plugin 1.1.4 → 1.1.6

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 +19 -16
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -159,8 +159,8 @@ function decorateLanguageService(ts, tsconfig, info) {
159
159
  const diag = {
160
160
  category,
161
161
  source: 'tsslint',
162
- code: 0,
163
- messageText: `Failed to build/load TSSLint config. (${error.text})`,
162
+ code: error.id ?? 0,
163
+ messageText: error.text,
164
164
  file: jsonConfigFile,
165
165
  start: configOptionSpan.start,
166
166
  length: configOptionSpan.length,
@@ -168,20 +168,23 @@ function decorateLanguageService(ts, tsconfig, info) {
168
168
  if (error.location) {
169
169
  const fileName = path.resolve(error.location.file).replace('http-url:', '');
170
170
  const fileText = ts.sys.readFile(error.location.file);
171
- const sourceFile = fileText !== undefined
172
- ? ts.createSourceFile(fileName, fileText, ts.ScriptTarget.Latest, true)
173
- : undefined;
174
- diag.relatedInformation = [{
175
- category,
176
- code: error.id,
177
- messageText: error.text,
178
- file: sourceFile,
179
- start: sourceFile?.getPositionOfLineAndCharacter(error.location.line - 1, error.location.column),
180
- length: error.location.lineText.length,
181
- }];
182
- }
183
- else {
184
- diag.messageText += `\n\n${error.text}`;
171
+ if (fileText !== undefined) {
172
+ if (error.id === 'config-import-error') {
173
+ diag.messageText = `Error importing config file.`;
174
+ }
175
+ else {
176
+ diag.messageText = `Error building config file.`;
177
+ }
178
+ const sourceFile = ts.createSourceFile(fileName, fileText, ts.ScriptTarget.Latest, true);
179
+ diag.relatedInformation = [{
180
+ category,
181
+ code: error.id,
182
+ messageText: error.text,
183
+ file: sourceFile,
184
+ start: sourceFile.getPositionOfLineAndCharacter(error.location.line - 1, error.location.column),
185
+ length: error.location.lineText.length,
186
+ }];
187
+ }
185
188
  }
186
189
  return diag;
187
190
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsslint/typescript-plugin",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
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.1.4"
15
+ "@tsslint/core": "1.1.6"
16
16
  },
17
17
  "devDependencies": {
18
- "@tsslint/config": "1.1.4"
18
+ "@tsslint/config": "1.1.6"
19
19
  },
20
- "gitHead": "03d4e7480fc96c6322d436d34a4af73cb5bc25f2"
20
+ "gitHead": "040024b0c2a08ded87940935090b4aaaebd8c7c4"
21
21
  }