Migrate from ESLint to OxLint (#18443)

## Summary

Fully replaces ESLint with OxLint across the entire monorepo:

- **Replaced all ESLint configs** (`eslint.config.mjs`) with OxLint
configs (`.oxlintrc.json`) for every package: `twenty-front`,
`twenty-server`, `twenty-emails`, `twenty-ui`, `twenty-shared`,
`twenty-sdk`, `twenty-zapier`, `twenty-docs`, `twenty-website`,
`twenty-apps/*`, `create-twenty-app`
- **Migrated custom lint rules** from ESLint plugin format to OxLint JS
plugin system (`@oxlint/plugins`), including
`styled-components-prefixed-with-styled`, `no-hardcoded-colors`,
`sort-css-properties-alphabetically`,
`graphql-resolvers-should-be-guarded`,
`rest-api-methods-should-be-guarded`, `max-consts-per-file`, and
Jotai-related rules
- **Migrated custom rule tests** from ESLint `RuleTester` + Jest to
`oxlint/plugins-dev` `RuleTester` + Vitest
- **Removed all ESLint dependencies** from `package.json` files and
regenerated lockfiles
- **Updated Nx targets** (`lint`, `lint:diff-with-main`, `fmt`) in
`nx.json` and per-project `project.json` to use `oxlint` commands with
proper `dependsOn` for plugin builds
- **Updated CI workflows** (`.github/workflows/ci-*.yaml`) — no more
ESLint executor
- **Updated IDE setup**: replaced `dbaeumer.vscode-eslint` with
`oxc.oxc-vscode` extension, configured `source.fixAll.oxc` and
format-on-save with Prettier
- **Replaced all `eslint-disable` comments** with `oxlint-disable`
equivalents across the codebase
- **Updated docs** (`twenty-docs`) to reference OxLint instead of ESLint
- **Renamed** `twenty-eslint-rules` package to `twenty-oxlint-rules`

### Temporarily disabled rules (tracked in `OXLINT_MIGRATION_TODO.md`)

| Rule | Package | Violations | Auto-fixable |
|------|---------|-----------|-------------|
| `twenty/sort-css-properties-alphabetically` | twenty-front | 578 | Yes
|
| `typescript/consistent-type-imports` | twenty-server | 3814 | Yes |
| `twenty/max-consts-per-file` | twenty-server | 94 | No |

### Dropped plugins (no OxLint equivalent)

`eslint-plugin-project-structure`, `lingui/*`, `@stylistic/*`,
`import/order`, `prefer-arrow/prefer-arrow-functions`,
`eslint-plugin-mdx`, `@next/eslint-plugin-next`,
`eslint-plugin-storybook`, `eslint-plugin-react-refresh`. Partial
coverage for `jsx-a11y` and `unused-imports`.

### Additional fixes (pre-existing issues exposed by merge)

- Fixed `EmailThreadPreview.tsx` broken import from main rename
(`useOpenEmailThreadInSidePanel`)
- Restored truthiness guard in `getActivityTargetObjectRecords.ts`
- Fixed `AgentTurnResolver` return types to match entity (virtual
`fileMediaType`/`fileUrl` are resolved via `@ResolveField()`)

## Test plan

- [x] `npx nx lint twenty-front` passes
- [x] `npx nx lint twenty-server` passes
- [x] `npx nx lint twenty-docs` passes
- [x] Custom oxlint rules validated with Vitest: `npx nx test
twenty-oxlint-rules`
- [x] `npx nx typecheck twenty-front` passes
- [x] `npx nx typecheck twenty-server` passes
- [x] CI workflows trigger correctly with `dependsOn:
["twenty-oxlint-rules:build"]`
- [x] IDE linting works with `oxc.oxc-vscode` extension
This commit is contained in:
Charles Bochet
2026-03-06 01:03:50 +01:00
committed by GitHub
parent b421efbff7
commit 9d57bc39e5
880 changed files with 4711 additions and 9687 deletions
@@ -139,7 +139,7 @@ export class ClickHouseService implements OnModuleInit, OnModuleDestroy {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
public async insert<T extends Record<string, any>>(
table: string,
values: T[],
@@ -170,7 +170,7 @@ export class ClickHouseService implements OnModuleInit, OnModuleDestroy {
// Method to execute a select query
public async select<T>(
query: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
params?: Record<string, any>,
clientId?: string,
): Promise<T[]> {
@@ -237,7 +237,7 @@ export class ClickHouseService implements OnModuleInit, OnModuleDestroy {
public async executeCommand(
query: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
params?: Record<string, any>,
clientId?: string,
): Promise<boolean> {
@@ -263,7 +263,7 @@ export class ClickHouseService implements OnModuleInit, OnModuleDestroy {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
private async insertInChunks<T extends Record<string, any>>(
client: ClickHouseClient,
table: string,
@@ -1,4 +1,4 @@
/* eslint-disable no-console */
/* oxlint-disable no-console */
import fs from 'fs';
import path from 'path';
@@ -1,4 +1,4 @@
/* eslint-disable no-console */
/* oxlint-disable no-console */
import { createClient, ClickHouseLogLevel } from '@clickhouse/client';
import { config } from 'dotenv';
@@ -21,7 +21,7 @@ export class CommandLogger {
this.verboseFlag = options.verbose ?? false;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
log(message: string, ...optionalParams: [...any, string?]) {
this.logger.log(message, ...optionalParams);
}
@@ -30,17 +30,17 @@ export class CommandLogger {
this.logger.error(message, stack, context);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
warn(message: string, ...optionalParams: [...any, string?]) {
this.logger.warn(message, ...optionalParams);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
debug(message: string, ...optionalParams: [...any, string?]) {
this.logger.debug(message, ...optionalParams);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
verbose(message: string, ...optionalParams: [...any, string?]) {
if (this.verboseFlag) {
this.logger.log(message, ...optionalParams);
@@ -13,7 +13,7 @@ export class KanbanFieldMetadataIdentifierView1760965667836
`ALTER TABLE "core"."view" ADD CONSTRAINT "FK_b3cc95732479f7a1337350c398f" FOREIGN KEY ("kanbanAggregateOperationFieldMetadataId") REFERENCES "core"."fieldMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
} catch (error) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
`Swallowing KanbanFieldMetadataIdentifierView1760965667836 error: ${error.message}. Upgrade:1-10:clean-orphaned-kanban-aggregate-operation-field-metadata-id upgrade command will handle fallback`,
);
@@ -27,7 +27,7 @@ export class WorkspaceCustomApplicationIdNonNullable1763977334519
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in WorkspaceCustomApplicationIdNonNullable1763977334519',
rollbackError,
@@ -35,7 +35,7 @@ export class WorkspaceCustomApplicationIdNonNullable1763977334519
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing WorkspaceCustomApplicationIdNonNullable1763977334519 error',
e,
@@ -30,7 +30,7 @@ export class UpdateRoleTargetsUniqueConstraint1764329720503
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in UpdateRoleTargetsUniqueConstraint1764329720503',
rollbackError,
@@ -38,7 +38,7 @@ export class UpdateRoleTargetsUniqueConstraint1764329720503
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing UpdateRoleTargetsUniqueConstraint1764329720503 error',
e,
@@ -21,7 +21,7 @@ export class AddWorkspaceForeignKeys1767002571103
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in AddWorkspaceForeignKeys1767002571103',
rollbackError,
@@ -29,7 +29,7 @@ export class AddWorkspaceForeignKeys1767002571103
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error('Swallowing AddWorkspaceForeignKeys1767002571103 error', e);
}
}
@@ -25,7 +25,7 @@ export class MakeFieldMetadataUniversalIdentifierAndApplicationIdNotNullable1767
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeFieldMetadataUniversalIdentifierAndApplicationIdNotNullable1767277454048',
rollbackError,
@@ -33,7 +33,7 @@ export class MakeFieldMetadataUniversalIdentifierAndApplicationIdNotNullable1767
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeFieldMetadataUniversalIdentifierAndApplicationIdNotNullable1767277454048 error',
e,
@@ -25,7 +25,7 @@ export class MakeObjectMetadataUniversalIdentifierAndApplicationIdNotNullable176
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeObjectMetadataUniversalIdentifierAndApplicationIdNotNullable1768212224801',
rollbackError,
@@ -33,7 +33,7 @@ export class MakeObjectMetadataUniversalIdentifierAndApplicationIdNotNullable176
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeObjectMetadataUniversalIdentifierAndApplicationIdNotNullable1768212224801 error',
e,
@@ -24,7 +24,7 @@ export class MakeViewUniversalIdentifierAndApplicationIdNotNullable1768213174271
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeViewUniversalIdentifierAndApplicationIdNotNullable1768213174271',
rollbackError,
@@ -32,7 +32,7 @@ export class MakeViewUniversalIdentifierAndApplicationIdNotNullable1768213174271
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeViewUniversalIdentifierAndApplicationIdNotNullable1768213174271 error',
e,
@@ -25,7 +25,7 @@ export class MakeViewFieldUniversalIdentifierAndApplicationIdNotNullable17682131
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeViewFieldUniversalIdentifierAndApplicationIdNotNullable1768213174272',
rollbackError,
@@ -33,7 +33,7 @@ export class MakeViewFieldUniversalIdentifierAndApplicationIdNotNullable17682131
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeViewFieldUniversalIdentifierAndApplicationIdNotNullable1768213174272 error',
e,
@@ -25,7 +25,7 @@ export class MakeViewFilterUniversalIdentifierAndApplicationIdNotNullable1768213
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeViewFilterUniversalIdentifierAndApplicationIdNotNullable1768213174273',
rollbackError,
@@ -33,7 +33,7 @@ export class MakeViewFilterUniversalIdentifierAndApplicationIdNotNullable1768213
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeViewFilterUniversalIdentifierAndApplicationIdNotNullable1768213174273 error',
e,
@@ -24,7 +24,7 @@ export class MakeAgentUniversalIdentifierAndApplicationIdNotNullable176821317427
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeAgentUniversalIdentifierAndApplicationIdNotNullable1768213174274',
rollbackError,
@@ -32,7 +32,7 @@ export class MakeAgentUniversalIdentifierAndApplicationIdNotNullable176821317427
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeAgentUniversalIdentifierAndApplicationIdNotNullable1768213174274 error',
e,
@@ -25,7 +25,7 @@ export class MakeViewGroupUniversalIdentifierAndApplicationIdNotNullable17682131
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeViewGroupUniversalIdentifierAndApplicationIdNotNullable1768213174274',
rollbackError,
@@ -33,7 +33,7 @@ export class MakeViewGroupUniversalIdentifierAndApplicationIdNotNullable17682131
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeViewGroupUniversalIdentifierAndApplicationIdNotNullable1768213174274 error',
e,
@@ -24,7 +24,7 @@ export class MakeRoleUniversalIdentifierAndApplicationIdNotNullable1768213174275
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeRoleUniversalIdentifierAndApplicationIdNotNullable1768213174275',
rollbackError,
@@ -32,7 +32,7 @@ export class MakeRoleUniversalIdentifierAndApplicationIdNotNullable1768213174275
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeRoleUniversalIdentifierAndApplicationIdNotNullable1768213174275 error',
e,
@@ -19,7 +19,7 @@ export class UpdateFileTable1768572831179 implements MigrationInterface {
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in UpdateFileTable1768572831179',
rollbackError,
@@ -27,7 +27,7 @@ export class UpdateFileTable1768572831179 implements MigrationInterface {
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error('Swallowing UpdateFileTable1768572831179 error', e);
}
}
@@ -25,7 +25,7 @@ export class MakeIndexMetadataUniversalIdentifierAndApplicationIdNotNullable1768
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeIndexMetadataUniversalIdentifierAndApplicationIdNotNullable1768830235328',
rollbackError,
@@ -33,7 +33,7 @@ export class MakeIndexMetadataUniversalIdentifierAndApplicationIdNotNullable1768
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeIndexMetadataUniversalIdentifierAndApplicationIdNotNullable1768830235328 error',
e,
@@ -25,7 +25,7 @@ export class MakeRemainingEntitiesUniversalIdentifierAndApplicationIdNotNullable
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeRemainingEntitiesUniversalIdentifierAndApplicationIdNotNullable1768916632478',
rollbackError,
@@ -33,7 +33,7 @@ export class MakeRemainingEntitiesUniversalIdentifierAndApplicationIdNotNullable
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeRemainingEntitiesUniversalIdentifierAndApplicationIdNotNullable1768916632478 error',
e,
@@ -24,7 +24,7 @@ export class MakeWebhookUnivesralIdentiferAndApplicationIdNotNull1769525557511
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in MakeWebhookUnivesralIdentiferAndApplicationIdNotNull1769525557511',
rollbackError,
@@ -32,7 +32,7 @@ export class MakeWebhookUnivesralIdentiferAndApplicationIdNotNull1769525557511
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing MakeWebhookUnivesralIdentiferAndApplicationIdNotNull1769525557511 error',
e,
@@ -21,7 +21,7 @@ export class AddFileEntityUniqueConstraint1770032815802
await queryRunner.query(`ROLLBACK TO SAVEPOINT ${savepointName}`);
await queryRunner.query(`RELEASE SAVEPOINT ${savepointName}`);
} catch (rollbackError) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Failed to rollback to savepoint in AddFileEntityUniqueConstraint1770032815802',
rollbackError,
@@ -29,7 +29,7 @@ export class AddFileEntityUniqueConstraint1770032815802
throw rollbackError;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(
'Swallowing AddFileEntityUniqueConstraint1770032815802 error',
e,