feat: enforce @/ alias for imports and fix all relative parent imports (#16787)
## Summary This PR enforces the use of `@/` alias for imports instead of relative parent imports (`../`). ## Changes ### ESLint Configuration - Added `no-restricted-imports` pattern in `eslint.config.react.mjs` to block `../*` imports with the message "Relative parent imports are not allowed. Use @/ alias instead." - Removed the non-working `import/no-relative-parent-imports` rule (doesn't work properly in ESLint flat config) ### VS Code Settings - Added `javascript.preferences.importModuleSpecifier: non-relative` to `.vscode/settings.json` (TypeScript setting was already there) ### Code Fixes - Fixed **941 relative parent imports** across **706 files** in `packages/twenty-front` - All `../` imports converted to use `@/` alias ## Why - Consistent import style across the codebase - Easier to move files without breaking imports - Better IDE support for auto-imports - Clearer understanding of where imports come from
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { dialogInternalComponentState } from '@/ui/feedback/dialog-manager/states/dialogInternalComponentState';
|
||||
import { useDialogManager } from '../hooks/useDialogManager';
|
||||
import { useDialogManager } from '@/ui/feedback/dialog-manager/hooks/useDialogManager';
|
||||
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { Dialog } from './Dialog';
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks
|
||||
|
||||
import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';
|
||||
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
|
||||
import { dialogInternalComponentState } from '../states/dialogInternalComponentState';
|
||||
import { type DialogOptions } from '../types/DialogOptions';
|
||||
import { dialogInternalComponentState } from '@/ui/feedback/dialog-manager/states/dialogInternalComponentState';
|
||||
import { type DialogOptions } from '@/ui/feedback/dialog-manager/types/DialogOptions';
|
||||
|
||||
export const useDialogManager = () => {
|
||||
const componentInstanceId = useAvailableComponentInstanceIdOrThrow(
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { type DialogOptions } from '../types/DialogOptions';
|
||||
import { type DialogOptions } from '@/ui/feedback/dialog-manager/types/DialogOptions';
|
||||
|
||||
type DialogState = {
|
||||
maxQueue: number;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type DialogProps } from '../components/Dialog';
|
||||
import { type DialogProps } from '@/ui/feedback/dialog-manager/components/Dialog';
|
||||
|
||||
export type DialogOptions = DialogProps & {
|
||||
id: string;
|
||||
|
||||
+4
-1
@@ -3,7 +3,10 @@ import { fn } from '@storybook/test';
|
||||
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
|
||||
|
||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||
import { SnackBar, SnackBarVariant } from '../SnackBar';
|
||||
import {
|
||||
SnackBar,
|
||||
SnackBarVariant,
|
||||
} from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
||||
import {
|
||||
CatalogDecorator,
|
||||
type CatalogStory,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { type SnackBarProps } from '../components/SnackBar';
|
||||
import { type SnackBarProps } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
||||
|
||||
export type SnackBarOptions = SnackBarProps & {
|
||||
id: string;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { t } from '@lingui/core/macro';
|
||||
import { AppPath } from 'twenty-shared/types';
|
||||
import { getAppPath, isDefined } from 'twenty-shared/utils';
|
||||
import { getConflictingRecordFromApolloError } from '~/utils/get-conflicting-record-from-apollo-error.util';
|
||||
import { type SnackBarOptions } from '../states/snackBarInternalComponentState';
|
||||
import { type SnackBarOptions } from '@/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState';
|
||||
|
||||
export const buildErrorAction = (
|
||||
apolloError?: ApolloError,
|
||||
|
||||
Reference in New Issue
Block a user