vzcode 0.72.0 → 0.74.0

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.
@@ -16,7 +16,7 @@ const debug = false;
16
16
  // to support TypeScript completions on non-TS files.
17
17
  const getTSFileName = (fileName: string) => {
18
18
  if (fileName.endsWith('.js')) {
19
- return fileName.replace('.js', '.ts');
19
+ return fileName.replace('.js', '.tsx');
20
20
  }
21
21
  if (fileName.endsWith('.jsx')) {
22
22
  return fileName.replace('.jsx', '.tsx');
@@ -38,6 +38,21 @@ const initializeFileSystem = async () => {
38
38
  }
39
39
  const compilerOptions: ts.CompilerOptions = {
40
40
  lib: ['dom', 'esnext'],
41
+
42
+ // Disable warnings around "Any type".
43
+ noImplicitAny: false,
44
+
45
+ // Disable warnings around "Implicit any in parameter".
46
+ noImplicitThis: false,
47
+
48
+ // Allow JavaScript files to be processed
49
+ allowJs: true,
50
+
51
+ // Disable type checking for JavaScript files
52
+ // checkJs: false,
53
+
54
+ // Skip type checking of declaration files
55
+ skipLibCheck: true,
41
56
  };
42
57
 
43
58
  // `true` breaks in a Web Worker because
@@ -219,46 +234,46 @@ onmessage = async ({ data }) => {
219
234
 
220
235
  // Be less aggressive for non-TS files,
221
236
  // e.g. files that end in .js or .jsx.
222
- if (!isTS(fileName)) {
223
- // This code is for errors like:
224
- // "Binding element 'data' implicitly has an 'any' type."
225
- const LINT_ERROR_CODE_ANY = 7031;
226
-
227
- // This code is for errors like:
228
- // "Parameter 'selection' implicitly has an 'any' type.""
229
- const LINT_ERROR_CODE_ANY_PARAM = 7006;
230
-
231
- // This code is for errors like:
232
- // "Cannot find module 'd3' or its corresponding type declarations."
233
- const LINT_ERROR_CODE_IMPORT = 2307;
234
-
235
- // This code is for errors like:
236
- // "Variable 'mic' implicitly has type 'any' in some locations where its type cannot be determined."
237
- const LINT_ERROR_CODE_ANY_TYPE = 7034;
238
-
239
- // "Element implicitly has an 'any' type because expression
240
- // of type '"test"' can't be used to index type '{}'."
241
- const LINT_ERROR_CODE_ANY_TYPE_KEYS = 7053;
242
-
243
- // "Property 'id' does not exist on type { ... }"
244
- // Happens on objects with dynamic keys.
245
- // Not valid in TypeScript, but common in JavaScript.
246
- const LINT_ERROR_CODE_NON_EXISTENT_PROPERTY = 2339;
247
-
248
- if (debug) {
249
- console.log(tsErrors);
250
- }
251
- tsErrors = tsErrors.filter(
252
- (error: { code: number }) =>
253
- error.code !== LINT_ERROR_CODE_ANY &&
254
- error.code !== LINT_ERROR_CODE_IMPORT &&
255
- error.code !== LINT_ERROR_CODE_ANY_PARAM &&
256
- error.code !== LINT_ERROR_CODE_ANY_TYPE &&
257
- error.code !== LINT_ERROR_CODE_ANY_TYPE_KEYS &&
258
- error.code !==
259
- LINT_ERROR_CODE_NON_EXISTENT_PROPERTY,
260
- );
237
+ // if (!isTS(fileName)) {
238
+ // This code is for errors like:
239
+ // "Binding element 'data' implicitly has an 'any' type."
240
+ const LINT_ERROR_CODE_ANY = 7031;
241
+
242
+ // This code is for errors like:
243
+ // "Parameter 'selection' implicitly has an 'any' type.""
244
+ const LINT_ERROR_CODE_ANY_PARAM = 7006;
245
+
246
+ // This code is for errors like:
247
+ // "Cannot find module 'd3' or its corresponding type declarations."
248
+ const LINT_ERROR_CODE_IMPORT = 2307;
249
+
250
+ // This code is for errors like:
251
+ // "Variable 'mic' implicitly has type 'any' in some locations where its type cannot be determined."
252
+ const LINT_ERROR_CODE_ANY_TYPE = 7034;
253
+
254
+ // "Element implicitly has an 'any' type because expression
255
+ // of type '"test"' can't be used to index type '{}'."
256
+ const LINT_ERROR_CODE_ANY_TYPE_KEYS = 7053;
257
+
258
+ // "Property 'id' does not exist on type { ... }"
259
+ // Happens on objects with dynamic keys.
260
+ // Not valid in TypeScript, but common in JavaScript.
261
+ const LINT_ERROR_CODE_NON_EXISTENT_PROPERTY = 2339;
262
+
263
+ if (debug) {
264
+ console.log(tsErrors);
261
265
  }
266
+ tsErrors = tsErrors.filter(
267
+ (error: { code: number }) =>
268
+ error.code !== LINT_ERROR_CODE_ANY &&
269
+ error.code !== LINT_ERROR_CODE_IMPORT &&
270
+ error.code !== LINT_ERROR_CODE_ANY_PARAM &&
271
+ error.code !== LINT_ERROR_CODE_ANY_TYPE &&
272
+ error.code !== LINT_ERROR_CODE_ANY_TYPE_KEYS &&
273
+ error.code !==
274
+ LINT_ERROR_CODE_NON_EXISTENT_PROPERTY,
275
+ );
276
+ // }
262
277
  tsErrors = convertToCodeMirrorDiagnostic(tsErrors);
263
278
  }
264
279