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
@@ -5,7 +5,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI
|
||||
import { type RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
|
||||
import { type ToReferenceFunction } from '@apollo/client/cache/core/types/common';
|
||||
|
||||
import { createCacheEdgeWithRecordRef } from '../createCacheEdgeWithRecordRef';
|
||||
import { createCacheEdgeWithRecordRef } from '@/object-record/cache/utils/createCacheEdgeWithRecordRef';
|
||||
|
||||
describe('createCacheEdgeWithRecordRef', () => {
|
||||
it('should create an edge with reference when toReference returns a reference', () => {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { filterRecordOnGqlFields } from '../filterRecordOnGqlFields';
|
||||
import { filterRecordOnGqlFields } from '@/object-record/cache/utils/filterRecordOnGqlFields';
|
||||
|
||||
describe('filterRecordOnGqlFields', () => {
|
||||
it('should filter fields based on recordGqlFields with true values', () => {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
||||
import { RelationType } from 'twenty-shared/types';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { getFieldMetadataFromGqlField } from '../getFieldMetadataFromGqlField';
|
||||
import { getFieldMetadataFromGqlField } from '@/object-record/cache/utils/getFieldMetadataFromGqlField';
|
||||
|
||||
const objectMetadataItemGenerator = (relationType: RelationType) => {
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { getRecordFromRecordNode } from '../getRecordFromRecordNode';
|
||||
import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode';
|
||||
|
||||
describe('getRecordFromRecordNode', () => {
|
||||
it('should convert a simple record node', () => {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI
|
||||
import { getPeopleRecordConnectionMock } from '~/testing/mock-data/people';
|
||||
|
||||
import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems';
|
||||
import { getRecordNodeFromRecord } from '../getRecordNodeFromRecord';
|
||||
import { getRecordNodeFromRecord } from '@/object-record/cache/utils/getRecordNodeFromRecord';
|
||||
|
||||
const peopleMock = getPeopleRecordConnectionMock();
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { isObjectRecordConnection } from '../isObjectRecordConnection';
|
||||
import { isObjectRecordConnection } from '@/object-record/cache/utils/isObjectRecordConnection';
|
||||
|
||||
describe('isObjectRecordConnection', () => {
|
||||
it('should return true for valid connection with edges', () => {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { isObjectRecordConnectionWithRefs } from '../isObjectRecordConnectionWithRefs';
|
||||
import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/isObjectRecordConnectionWithRefs';
|
||||
|
||||
describe('isObjectRecordConnectionWithRefs', () => {
|
||||
it('should return true for valid connection with edges', () => {
|
||||
|
||||
Reference in New Issue
Block a user