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:
Félix Malfait
2025-12-23 22:57:51 +01:00
committed by GitHub
parent 781b96e80b
commit b27a97f2c5
725 changed files with 1114 additions and 1041 deletions
@@ -1,6 +1,6 @@
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { COMMAND_MENU_DEFAULT_ICON } from '@/workflow/workflow-trigger/constants/CommandMenuDefaultIcon';
import { getManualTriggerDefaultSettings } from '../getManualTriggerDefaultSettings';
import { getManualTriggerDefaultSettings } from '@/workflow/workflow-trigger/utils/getManualTriggerDefaultSettings';
const mockObjectMetadataItems: ObjectMetadataItem[] = [
{
@@ -1,5 +1,5 @@
import { type WorkflowAction } from '@/workflow/types/Workflow';
import { getRootStepIds } from '../getRootStepIds';
import { getRootStepIds } from '@/workflow/workflow-trigger/utils/getRootStepIds';
describe('getRootStepIds', () => {
it('should return empty array for empty steps', () => {
@@ -1,7 +1,7 @@
import { COMMAND_MENU_DEFAULT_ICON } from '@/workflow/workflow-trigger/constants/CommandMenuDefaultIcon';
import { DatabaseTriggerDefaultLabel } from '@/workflow/workflow-trigger/constants/DatabaseTriggerDefaultLabel';
import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems';
import { getTriggerDefaultDefinition } from '../getTriggerDefaultDefinition';
import { getTriggerDefaultDefinition } from '@/workflow/workflow-trigger/utils/getTriggerDefaultDefinition';
describe('getTriggerDefaultDefinition', () => {
it('throws if the activeNonSystemObjectMetadataItems list is empty', () => {
@@ -1,5 +1,5 @@
import { type WorkflowTrigger } from '@/workflow/types/Workflow';
import { getTriggerHeaderType } from '../getTriggerHeaderType';
import { getTriggerHeaderType } from '@/workflow/workflow-trigger/utils/getTriggerHeaderType';
describe('getTriggerHeaderType', () => {
describe('DATABASE_EVENT triggers', () => {
@@ -1,6 +1,6 @@
import { type Theme } from '@emotion/react';
import { COLOR_LIGHT } from 'twenty-ui/theme';
import { getTriggerIconColor } from '../getTriggerIconColor';
import { getTriggerIconColor } from '@/workflow/workflow-trigger/utils/getTriggerIconColor';
describe('getTriggerIconColor', () => {
const mockTheme: Theme = {
@@ -5,7 +5,7 @@ import { getOrdinalNumber } from '~/utils/format/getOrdinalNumber';
import { isListValue } from '~/utils/validation/isListValue';
import { isNumericRange } from '~/utils/validation/isNumericRange';
import { isStepValue } from '~/utils/validation/isStepValue';
import { type CronDescriptionOptions } from '../types/cronDescriptionOptions';
import { type CronDescriptionOptions } from '@/workflow/workflow-trigger/utils/cron-to-human/types/cronDescriptionOptions';
export const getDayOfMonthDescription = (
dayOfMonth: string,
@@ -5,7 +5,7 @@ import { isDefined } from 'twenty-shared/utils';
import { isListValue } from '~/utils/validation/isListValue';
import { isNumericRange } from '~/utils/validation/isNumericRange';
import { isStepValue } from '~/utils/validation/isStepValue';
import { type CronDescriptionOptions } from '../types/cronDescriptionOptions';
import { type CronDescriptionOptions } from '@/workflow/workflow-trigger/utils/cron-to-human/types/cronDescriptionOptions';
const getDayName = (
dayNum: number,
@@ -5,7 +5,7 @@ import { formatTime as formatCronTime } from '~/utils/format/formatTime';
import { isListValue } from '~/utils/validation/isListValue';
import { isNumericRange } from '~/utils/validation/isNumericRange';
import { isStepValue } from '~/utils/validation/isStepValue';
import { type CronDescriptionOptions } from '../types/cronDescriptionOptions';
import { type CronDescriptionOptions } from '@/workflow/workflow-trigger/utils/cron-to-human/types/cronDescriptionOptions';
export const getHoursDescription = (
hours: string,
@@ -4,7 +4,7 @@ import { isDefined } from 'twenty-shared/utils';
import { isListValue } from '~/utils/validation/isListValue';
import { isNumericRange } from '~/utils/validation/isNumericRange';
import { isStepValue } from '~/utils/validation/isStepValue';
import { type CronDescriptionOptions } from '../types/cronDescriptionOptions';
import { type CronDescriptionOptions } from '@/workflow/workflow-trigger/utils/cron-to-human/types/cronDescriptionOptions';
export const getMinutesDescription = (
minutes: string,
@@ -5,7 +5,7 @@ import { isDefined } from 'twenty-shared/utils';
import { isListValue } from '~/utils/validation/isListValue';
import { isNumericRange } from '~/utils/validation/isNumericRange';
import { isStepValue } from '~/utils/validation/isStepValue';
import { type CronDescriptionOptions } from '../types/cronDescriptionOptions';
import { type CronDescriptionOptions } from '@/workflow/workflow-trigger/utils/cron-to-human/types/cronDescriptionOptions';
const getMonthName = (
monthNum: number,
@@ -1,6 +1,6 @@
import { isDefined } from 'twenty-shared/utils';
import { type CronFieldType } from '../types/cronExpressionParts';
import { type CronFieldType } from '@/workflow/workflow-trigger/utils/cron-to-human/types/cronExpressionParts';
type FieldRange = {
min: number;