Closed
Description
Input:
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
Form,
} from 'react-final-form';
import type {
FormProps as FinalFormProps,
} from 'react-final-form';
import {
useMemo,
useCallback,
} from 'react';
import type {
ReactElement,
ReactNode,
} from 'react';
import {
serialize as formSchemaSerialize,
parse as formSchemaParse,
mapFieldErrors as formSchemaMapFieldErrors,
} from '@vtaits/form-schema';
import type {
GetFieldSchema,
} from '@vtaits/form-schema';
Result:
9:1 error `react` import should occur before import of `react-final-form` import/order
17:1 error `@vtaits/form-schema` import should occur before import of `react-final-form` import/order
Trying to fix:
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
useMemo,
useCallback,
} from 'react';
import type {
ReactElement,
ReactNode,
} from 'react';
import {
serialize as formSchemaSerialize,
parse as formSchemaParse,
mapFieldErrors as formSchemaMapFieldErrors,
} from '@vtaits/form-schema';
import type {
GetFieldSchema,
} from '@vtaits/form-schema';
import {
Form,
} from 'react-final-form';
import type {
FormProps as FinalFormProps,
} from 'react-final-form';
Result:
11:1 error `@vtaits/form-schema` import should occur before import of `react` import/order
19:1 error `react-final-form` import should occur before import of `react` import/order
2nd try:
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
serialize as formSchemaSerialize,
parse as formSchemaParse,
mapFieldErrors as formSchemaMapFieldErrors,
} from '@vtaits/form-schema';
import type {
GetFieldSchema,
} from '@vtaits/form-schema';
import {
Form,
} from 'react-final-form';
import type {
FormProps as FinalFormProps,
} from 'react-final-form';
import {
useMemo,
useCallback,
} from 'react';
import type {
ReactElement,
ReactNode,
} from 'react';
Result:
11:1 error `react-final-form` import should occur before import of `@vtaits/form-schema` import/order
17:1 error `react` import should occur before import of `@vtaits/form-schema` import/order
I don't know internal magic, maybe reason of bug is typescript or monorepo. You can test it locally:
Repo:
https://github.com/vtaits/form-schema
File: