Skip to content

Commit 903cef7

Browse files
committed
refactor: Use type imports for AJV where possible
This makes it clearer where the actual AJV implementation is used and where we only depend on the typing.
1 parent 6af8825 commit 903cef7

File tree

9 files changed

+15
-9
lines changed

9 files changed

+15
-9
lines changed

packages/angular/src/library/jsonforms-root.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ import {
4444
ValidationMode,
4545
defaultMiddleware,
4646
} from '@jsonforms/core';
47-
import Ajv, { ErrorObject } from 'ajv';
47+
import type Ajv from 'ajv';
48+
import type { ErrorObject } from 'ajv';
4849
import { JsonFormsAngularService, USE_STATE_VALUE } from './jsonforms.service';
4950
import { Subscription } from 'rxjs';
5051

packages/core/src/reducers/core.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ import {
4343
UpdateCoreAction,
4444
} from '../actions';
4545
import { JsonFormsCore, Reducer, ValidationMode } from '../store';
46-
import Ajv, { ErrorObject } from 'ajv';
46+
import type Ajv from 'ajv';
47+
import type { ErrorObject } from 'ajv';
4748
import isFunction from 'lodash/isFunction';
4849
import { createAjv, validate } from '../util';
4950

packages/core/src/store/jsonFormsCore.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import Ajv, { ErrorObject } from 'ajv';
1+
import type Ajv from 'ajv';
2+
import type { ErrorObject } from 'ajv';
23
import { JsonSchema, UISchemaElement } from '../models';
34
import get from 'lodash/get';
45
import { errorsAt } from '../util';

packages/core/src/store/store.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
import type { Store } from './type';
2727
import { RankedTester, UISchemaTester } from '../testers';
2828
import { JsonSchema, UISchemaElement } from '../models';
29-
import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
29+
import type Ajv from 'ajv';
30+
import type { ErrorObject, ValidateFunction } from 'ajv';
3031
import { JsonFormsI18nState } from './i18nTypes';
3132

3233
/**

packages/material-renderers/src/util/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
import isEmpty from 'lodash/isEmpty';
2626
import React, { ComponentType } from 'react';
27-
import Ajv from 'ajv';
27+
import type Ajv from 'ajv';
2828
import type { UISchemaElement } from '@jsonforms/core';
2929
import {
3030
getAjv,

packages/vanilla-renderers/src/util/props.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
THE SOFTWARE.
2424
*/
2525

26-
import Ajv from 'ajv';
26+
import type Ajv from 'ajv';
2727
import React, { ComponentType, useMemo } from 'react';
2828
import isEmpty from 'lodash/isEmpty';
2929
import type {

packages/vue-vuetify/dev/validate/keywords.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Ajv from 'ajv';
1+
import type Ajv from 'ajv';
22
import keywords from 'ajv-keywords';
33
import dynamicDefaults from 'ajv-keywords/dist/definitions/dynamicDefaults';
44
import tranform from './transform';

packages/vue-vuetify/tests/unit/util/TestComponent.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import {
2929
type JsonFormsChangeEvent,
3030
type MaybeReadonly,
3131
} from '@jsonforms/vue';
32-
import Ajv, { type ErrorObject } from 'ajv';
32+
import type Ajv from 'ajv';
33+
import type { ErrorObject } from 'ajv';
3334
import { defineComponent, reactive, type PropType } from 'vue';
3435
import { VApp } from 'vuetify/components';
3536

packages/vue/src/components/JsonForms.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import {
2929
import { JsonFormsChangeEvent, MaybeReadonly } from '../types';
3030
import DispatchRenderer from './DispatchRenderer.vue';
3131
32-
import Ajv, { ErrorObject } from 'ajv';
32+
import type Ajv from 'ajv';
33+
import type { ErrorObject } from 'ajv';
3334
3435
// TODO fix @typescript-eslint/ban-types
3536
// eslint-disable-next-line @typescript-eslint/ban-types

0 commit comments

Comments
 (0)