MCPcopy Index your code
hub / github.com/srcbookdev/srcbook / tsLinter

Function tsLinter

packages/web/src/components/cells/code.tsx:38–56  ·  view source on GitHub ↗
(
  cell: CodeCellType,
  getTsServerDiagnostics: (id: string) => TsServerDiagnosticType[],
  getTsServerSuggestions: (id: string) => TsServerDiagnosticType[],
)

Source from the content-addressed store, hash-verified

36import { Dialog, DialogContent } from '@srcbook/components/src/components/ui/dialog';
37
38function tsLinter(
39 cell: CodeCellType,
40 getTsServerDiagnostics: (id: string) => TsServerDiagnosticType[],
41 getTsServerSuggestions: (id: string) => TsServerDiagnosticType[],
42) {
43 const semanticDiagnostics = getTsServerDiagnostics(cell.id);
44 const syntaticDiagnostics = getTsServerSuggestions(cell.id);
45 const diagnostics = [...syntaticDiagnostics, ...semanticDiagnostics].filter(
46 isDiagnosticWithLocation,
47 );
48
49 const cm_diagnostics = diagnostics.map((diagnostic) => {
50 return convertTSDiagnosticToCM(diagnostic, cell.source);
51 });
52
53 return linter(async (): Promise<readonly Diagnostic[]> => {
54 return cm_diagnostics;
55 });
56}
57
58function tsCategoryToSeverity(
59 diagnostic: Pick<TsServerDiagnosticType, 'category' | 'code'>,

Callers 1

ControlledCodeCellFunction · 0.85

Calls 1

convertTSDiagnosticToCMFunction · 0.85

Tested by

no test coverage detected