@tsslint/typescript-plugin 1.0.13 → 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.
Files changed (2) hide show
  1. package/index.js +49 -52
  2. 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
- configFileBuildContext = await watchConfigFile(configFile, (_config, { errors, warnings }) => {
187
- config = _config;
188
- configFileDiagnostics = [
189
- ...errors.map(error => [error, ts.DiagnosticCategory.Error]),
190
- ...warnings.map(error => [error, ts.DiagnosticCategory.Warning]),
191
- ].map(([error, category]) => {
192
- const diag = {
193
- category,
194
- source: 'tsslint',
195
- code: 0,
196
- messageText: 'Failed to build TSSLint config.',
197
- file: jsonConfigFile,
198
- start: configOptionSpan.start,
199
- length: configOptionSpan.length,
200
- };
201
- if (error.location) {
202
- const fileName = path.resolve(error.location.file);
203
- const fileText = ts.sys.readFile(error.location.file);
204
- const sourceFile = ts.createSourceFile(fileName, fileText ?? '', ts.ScriptTarget.Latest, true);
205
- diag.relatedInformation = [{
206
- category,
207
- code: error.id,
208
- messageText: error.text,
209
- file: sourceFile,
210
- start: sourceFile.getPositionOfLineAndCharacter(error.location.line - 1, error.location.column),
211
- length: error.location.lineText.length,
212
- }];
213
- }
214
- else {
215
- diag.messageText += `\n\n${error.text}`;
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
- return diag;
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
- if (config) {
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.13",
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.13"
15
+ "@tsslint/core": "1.0.15"
16
16
  },
17
17
  "devDependencies": {
18
- "@tsslint/config": "1.0.13"
18
+ "@tsslint/config": "1.0.15"
19
19
  },
20
- "gitHead": "47f0f4bdbb68d8343c2967d46bd4b7bf9fb00e7e"
20
+ "gitHead": "58de9acb2cb7a1d7e93a5fb983fec54bf083f7b9"
21
21
  }