c737028dd6
## Summary Moves the custom ESLint rules from `tools/eslint-rules` to `packages/twenty-eslint-rules` for better organization within the monorepo packages structure. ## Changes - Move `eslint-rules` from `tools/` to `packages/twenty-eslint-rules` - Use `loadWorkspaceRules` from `@nx/eslint-plugin` to load custom rules - Update all ESLint configs to use the `twenty/` rule prefix instead of `@nx/workspace-` - Update `project.json`, `jest.config.mjs` with new paths - Update `package.json` workspaces and `nx.json` cache inputs - Update Dockerfile reference ## Technical Details The custom ESLint rules are now loaded using Nx's `loadWorkspaceRules` utility which: - Handles TypeScript transpilation automatically - Allows loading workspace rules from any directory - Provides a cleaner approach than the previous `@nx/workspace-` convention ## Testing - Verified all 17 custom ESLint rules load correctly from the new location - Verified linting works on dependent packages (twenty-front, twenty-server, etc.)
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
// allows you to do things like:
|
|
// expect(element).toHaveTextContent(/react/i)
|
|
// learn more: https://github.com/testing-library/jest-dom
|
|
import '@testing-library/jest-dom';
|
|
|
|
import { i18n } from '@lingui/core';
|
|
import { SOURCE_LOCALE } from 'twenty-shared/translations';
|
|
import { messages as enMessages } from '~/locales/generated/en';
|
|
|
|
// Initialize i18n for all tests
|
|
i18n.load({ [SOURCE_LOCALE]: enMessages });
|
|
i18n.activate(SOURCE_LOCALE);
|
|
|
|
// Add Jest matchers for toThrowError and other missing methods
|
|
declare global {
|
|
namespace jest {
|
|
interface Matchers<R> {
|
|
toThrowError(error?: string | RegExp | Error): R;
|
|
toMatchSnapshot(propertyMatchers?: any): R;
|
|
}
|
|
}
|
|
|
|
namespace Vi {
|
|
interface Assertion {
|
|
toMatchSnapshot(propertyMatchers?: any): void;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* The structuredClone global function is not available in jsdom, it needs to be mocked for now.
|
|
*
|
|
* The most naive way to mock structuredClone is to use JSON.stringify and JSON.parse. This works
|
|
* for arguments with simple types like primitives, arrays and objects, but doesn't work with functions,
|
|
* Map, Set, etc.
|
|
*/
|
|
global.structuredClone = (val) => {
|
|
return JSON.parse(JSON.stringify(val));
|
|
};
|