Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,34 @@
"extends": [
"@gravity-ui/eslint-config",
"@gravity-ui/eslint-config/prettier",
"@gravity-ui/eslint-config/client"
"@gravity-ui/eslint-config/client",
"@gravity-ui/eslint-config/import-order"
],
"root": true,
"env": {
"node": true,
"jest": true
}
},
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/prefer-ts-expect-error": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{"prefer": "type-imports", "fixStyle": "separate-type-imports"}
]
}
}
]
}
5,047 changes: 2,839 additions & 2,208 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@babel/preset-typescript": "^7.18.6",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@gravity-ui/eslint-config": "^3.1.1",
"@gravity-ui/eslint-config": "^3.3.0",
"@gravity-ui/prettier-config": "^1.1.0",
"@gravity-ui/stylelint-config": "^4.0.1",
"@gravity-ui/tsconfig": "^1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/core/components/Form/Controller/Controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React from 'react';

import omit from 'lodash/omit';

import {FormValue, Spec} from '../../../types';
import type {FormValue, Spec} from '../../../types';
import {useControllerMirror, useDynamicFormsCtx, useSearch} from '../hooks';
import {ControllerMirror, FieldValue, ValidateError} from '../types';
import type {ControllerMirror, FieldValue, ValidateError} from '../types';

import {ControllerStore} from './types';
import type {ControllerStore} from './types';
import {callUnmout, getFieldMethods, initializeStore, updateStore} from './utils';

export interface ControllerProps<DirtyValue extends FieldValue, SpecType extends Spec> {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/Controller/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FormValue, Spec} from '../../../types';
import {
import type {FormValue, Spec} from '../../../types';
import type {
DynamicFormConfig,
DynamicFormMutatorsStore,
DynamicFormsContext,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/core/components/Form/Controller/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {isValidElementType} from 'react-is';

import {SpecTypes} from '../../../constants';
import {isArraySpec, isCorrectSpec, isNumberSpec, isObjectSpec} from '../../../helpers';
import {FormValue, Spec} from '../../../types';
import type {FormValue, Spec} from '../../../types';
import {EMPTY_MUTATOR, OBJECT_ARRAY_CNT, OBJECT_ARRAY_FLAG} from '../constants';
import {
import type {
BaseValidateError,
FieldArrayValue,
FieldObjectValue,
Expand All @@ -29,7 +29,7 @@ import {
} from '../types';
import {isArrayItem, isCorrectConfig, transformArrIn, transformArrOut} from '../utils';

import {
import type {
ControllerStore,
GetComponentsParams,
GetComponentsReturn,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/DynamicField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {isValidElementType} from 'react-is';
import type {MonacoEditorProps} from 'react-monaco-editor/lib/types';

import {isCorrectSpec} from '../../helpers';
import {Spec, StringSpec} from '../../types';
import type {Spec, StringSpec} from '../../types';

import {Controller} from './Controller';
import {
Expand All @@ -20,7 +20,7 @@ import {
useSearchStore,
useStore,
} from './hooks';
import {DynamicFormConfig, DynamicFormMutators, FieldValue, WonderMirror} from './types';
import type {DynamicFormConfig, DynamicFormMutators, FieldValue, WonderMirror} from './types';
import {getDefaultSearchFunction, isCorrectConfig} from './utils';

export interface DynamicFieldProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import React from 'react';

import {ThemeProvider} from '@gravity-ui/uikit';
import {act, render} from '@testing-library/react';
import {FormApi} from 'final-form';
import type {FormApi} from 'final-form';
import noop from 'lodash/noop';
import values from 'lodash/values';
import {Form, useForm} from 'react-final-form';

import {ErrorMessages, dynamicConfig} from '../../../../kit';
import {SpecTypes} from '../../../constants';
import {ObjectSpec} from '../../../types';
import type {ObjectSpec} from '../../../types';
import {DynamicField} from '../DynamicField';
import {FieldArrayValue, WonderMirror} from '../types';
import type {FieldArrayValue, WonderMirror} from '../types';
import {transformArrOut} from '../utils';

const name = 'name';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';

import {act, render} from '@testing-library/react';
import {FormApi} from 'final-form';
import type {FormApi} from 'final-form';
import cloneDeep from 'lodash/cloneDeep';
import noop from 'lodash/noop';
import {Form, useForm} from 'react-final-form';

import {ErrorMessages, dynamicConfig} from '../../../../../kit';
import {SpecTypes} from '../../../../constants';
import {ObjectSpec} from '../../../../types';
import type {ObjectSpec} from '../../../../types';
import {DynamicField} from '../../DynamicField';
import {WonderMirror} from '../../types';
import type {WonderMirror} from '../../types';

const spec: ObjectSpec = {type: SpecTypes.Object, viewSpec: {type: ''}};
const value = {name: {key: 'value'}};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React from 'react';

import {render} from '@testing-library/react';

import noop from 'lodash/noop';

import {Form} from 'react-final-form';

import {dynamicConfig} from '../../../../../kit';
import {SpecTypes} from '../../../../constants';
import {ObjectSpec} from '../../../../types';
import type {ObjectSpec} from '../../../../types';
import {DynamicField} from '../../DynamicField';
import {WonderMirror} from '../../types';
import type {WonderMirror} from '../../types';

const spec: ObjectSpec = {
type: SpecTypes.Object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import isObjectLike from 'lodash/isObjectLike';
import noop from 'lodash/noop';
import {Form} from 'react-final-form';

import {Spec} from '../../../../../core';
import type {Spec} from '../../../../../core';
import {dynamicConfig} from '../../../../../kit';
import {SpecTypes} from '../../../../constants';
import {ObjectSpec} from '../../../../types';
import type {ObjectSpec} from '../../../../types';
import {DynamicField} from '../../DynamicField';
import {FieldValue, WonderMirror} from '../../types';
import type {FieldValue, WonderMirror} from '../../types';

const spec: ObjectSpec = {
type: SpecTypes.Object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {Form} from 'react-final-form';

import {dynamicConfig} from '../../../../../kit';
import {SpecTypes} from '../../../../constants';
import {ObjectSpec} from '../../../../types';
import type {ObjectSpec} from '../../../../types';
import {DynamicField} from '../../DynamicField';
import {WonderMirror} from '../../types';
import type {WonderMirror} from '../../types';

const spec: ObjectSpec = {type: SpecTypes.Object, viewSpec: {type: ''}};
const value = {name: {key: 'value'}};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import {ControllerMirror, WonderMirror} from '../types';
import type {ControllerMirror, WonderMirror} from '../types';

export const useControllerMirror = (
name: string,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/components/Form/hooks/useCreateContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import once from 'lodash/once';

import {DynamicFormsContext} from '../types';
import type {DynamicFormsContext} from '../types';

const createContext = once(() => React.createContext({} as unknown as DynamicFormsContext));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import once from 'lodash/once';

import {SearchContext} from '../types';
import type {SearchContext} from '../types';

const createContext = once(() => React.createContext({} as unknown as SearchContext));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import {DynamicFieldMirror, WonderMirror} from '../types';
import type {DynamicFieldMirror, WonderMirror} from '../types';

export const useDynamicFieldMirror = (params: DynamicFieldMirror, __mirror?: WonderMirror) => {
if (__mirror?.field) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/components/Form/hooks/useIntegrationFF.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import isFunction from 'lodash/isFunction';
import values from 'lodash/values';
import {Field as FinalFormField, useForm} from 'react-final-form';

import {AsyncValidateError, BaseValidateError, DynamicFieldStore, FieldValue} from '../types';
import type {AsyncValidateError, BaseValidateError, DynamicFieldStore, FieldValue} from '../types';
import {transformArrOut} from '../utils';

export const useIntegrationFF = (
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/hooks/useMutators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import isObjectLike from 'lodash/isObjectLike';
import keys from 'lodash/keys';
import set from 'lodash/set';

import {FormValue} from '../../../types';
import {
import type {FormValue} from '../../../types';
import type {
BaseValidateError,
DynamicFormMutators,
DynamicFormMutatorsStore,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/hooks/useSearch/useSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';

import {block} from '../../../../../kit/utils';
import {Spec} from '../../../../types';
import {FieldValue} from '../../types';
import type {Spec} from '../../../../types';
import type {FieldValue} from '../../types';
import {useSearchContext} from '../useSearchContext';

import './useSearch.scss';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/components/Form/hooks/useStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import omit from 'lodash/omit';
import set from 'lodash/set';
import {useFormState} from 'react-final-form';

import {DynamicFieldStore, FieldObjectValue, FieldValue, ValidateError} from '../types';
import type {DynamicFieldStore, FieldObjectValue, FieldValue, ValidateError} from '../types';
import {transformArrIn} from '../utils';

export const useStore = (name: string) => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/array.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ArraySpec, ArrayValue} from '../../../types';
import type {ArraySpec, ArrayValue} from '../../../types';

import {
import type {
FieldArrayValue,
IndependentInputEntity,
IndependentInputProps,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/boolean.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {BooleanSpec} from '../../../types';
import type {BooleanSpec} from '../../../types';

import {
import type {
IndependentInputEntity,
IndependentInputProps,
IndependentInputType,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {FormValue, Spec} from '../../../types';
import type {FormValue, Spec} from '../../../types';

import {
import type {
ArrayConfig,
BooleanConfig,
FieldValue,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/core/components/Form/types/context.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import type React from 'react';

import type {MonacoEditorProps} from 'react-monaco-editor/lib/types';

import {StringSpec} from '../../../types';
import type {StringSpec} from '../../../types';

import {
import type {
DynamicFieldStore,
DynamicFormConfig,
DynamicFormMutators,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/field.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import type React from 'react';

import {FieldValue, ValidateError} from './';
import type {FieldValue, ValidateError} from './';

export interface FieldRenderProps<Value extends FieldValue> {
input: {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/core/components/Form/types/input.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import type React from 'react';

import {Spec} from '../../../types';
import type {Spec} from '../../../types';

import {FieldRenderProps, FieldValue, LayoutType} from './';
import type {FieldRenderProps, FieldValue, LayoutType} from './';

export type InputProps<
Value extends FieldValue,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/core/components/Form/types/layout.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import type React from 'react';

import {Spec} from '../../../types';
import type {Spec} from '../../../types';

import {FieldValue, InputProps} from './';
import type {FieldValue, InputProps} from './';

export type LayoutProps<
Value extends FieldValue,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/mirror.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useIntegrationFF, useSearch, useSearchStore, useStore} from '../hooks';
import type {useIntegrationFF, useSearch, useSearchStore, useStore} from '../hooks';

import {FieldRenderProps} from './field';
import type {FieldRenderProps} from './field';

export interface ControllerMirror {
useField?: FieldRenderProps<any>;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/mutators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
ArraySpec,
BooleanSpec,
FormValue,
Expand All @@ -7,7 +7,7 @@ import {
StringSpec,
} from '../../../types';

import {BaseValidateError} from './';
import type {BaseValidateError} from './';

export type SpecMutator = Partial<
| (Omit<ArraySpec, 'viewSpec'> & {viewSpec: Partial<ArraySpec['viewSpec']>})
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/number.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {NumberSpec} from '../../../types';
import type {NumberSpec} from '../../../types';

import {
import type {
IndependentInputEntity,
IndependentInputProps,
IndependentInputType,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/object.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ObjectSpec, ObjectValue} from '../../../types';
import type {ObjectSpec, ObjectValue} from '../../../types';

import {
import type {
FieldObjectValue,
IndependentInputEntity,
IndependentInputProps,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/components/Form/types/search.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Spec} from '../../../types';
import type {Spec} from '../../../types';

import {FieldValue} from './value';
import type {FieldValue} from './value';

export interface SearchContext {
setField: (name: string, search: boolean) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/components/Form/types/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FieldObjectValue, ValidateError} from '../types';
import type {FieldObjectValue, ValidateError} from '../types';

export interface DynamicFieldStore {
name: string;
Expand Down
Loading