Skip to content

Commit 280e66c

Browse files
committed
cleaning up types and imports
1 parent 750607f commit 280e66c

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

packages/components/src/modifiers/hds-code-editor.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ type HdsCodeEditorBlurHandler = (
3434
event: FocusEvent
3535
) => void;
3636

37-
export type HdsCodeEditorLintDiagnostic = Pick<
38-
DiagnosticType,
39-
'from' | 'to' | 'message' | 'severity'
40-
>;
41-
4237
export interface HdsCodeEditorSignature {
4338
Args: {
4439
Named: {
@@ -51,7 +46,7 @@ export interface HdsCodeEditorSignature {
5146
value?: string;
5247
onInput?: (newVal: string) => void;
5348
onBlur?: HdsCodeEditorBlurHandler;
54-
onLint?: (diagnostics: HdsCodeEditorLintDiagnostic[]) => void;
49+
onLint?: (diagnostics: DiagnosticType[]) => void;
5550
onSetup?: (editor: EditorViewType) => unknown;
5651
};
5752
};

packages/components/src/modifiers/hds-code-editor/linters/json-linter.ts

+2-18
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import RSVP from 'rsvp';
22

33
import type { Diagnostic as DiagnosticType } from '@codemirror/lint';
4-
import type {
5-
HdsCodeEditorLintDiagnostic,
6-
HdsCodeEditorSignature,
7-
} from '../../hds-code-editor';
4+
import type { HdsCodeEditorSignature } from '../../hds-code-editor';
85
import type { Extension, Text } from '@codemirror/state';
96

107
export enum HdsCodeEditorJsonLintingError {
@@ -16,17 +13,6 @@ export enum HdsCodeEditorJsonLintingError {
1613
ValueExpected = 'Value expected',
1714
}
1815

19-
export function parseDiagnostics(
20-
diagnostics: DiagnosticType[]
21-
): HdsCodeEditorLintDiagnostic[] {
22-
return diagnostics.map((diagnostic) => ({
23-
from: diagnostic.from,
24-
to: diagnostic.to,
25-
message: diagnostic.message,
26-
severity: diagnostic.severity,
27-
}));
28-
}
29-
3016
export function findNextToken(
3117
doc: Text,
3218
index: number,
@@ -147,9 +133,7 @@ export default async function jsonLinter(
147133
}
148134
});
149135

150-
if (onLint) {
151-
onLint(parseDiagnostics(diagnostics));
152-
}
136+
onLint?.(diagnostics);
153137

154138
return diagnostics;
155139
});

0 commit comments

Comments
 (0)