From a3b0a342079f90e88b22c1f91c114a4a4fb45838 Mon Sep 17 00:00:00 2001 From: bitloi <89318445+bitloi@users.noreply.github.com> Date: Mon, 11 May 2026 19:03:49 -0300 Subject: [PATCH] Fix lint:diff-with-main oxlint rules build dependency (#20389) ## Summary Closes #20382. `lint:diff-with-main` can load `.oxlintrc.json` files that reference `../twenty-oxlint-rules/dist/oxlint-plugin.mjs`, but the diff-lint targets did not build `twenty-oxlint-rules` first. On fresh clones, that generated plugin file is missing and oxlint fails before linting. This PR adds `twenty-oxlint-rules:build` before diff lint for: - the root `lint:diff-with-main` target default - the custom `twenty-front:lint:diff-with-main` target - the custom `twenty-server:lint:diff-with-main` target It also adds regression coverage for: - the default diff-lint target dependency - the custom front/server diff-lint target dependencies - preserving `twenty-website-new` custom dependencies because it does not load the Twenty oxlint plugin ## Tests - `npx vitest run --config packages/twenty-oxlint-rules/vitest.config.mts workspace/lint-diff-with-main-targets.spec.ts` - `node_modules/.bin/nx test twenty-oxlint-rules` - `node_modules/.bin/nx typecheck twenty-oxlint-rules` - `node_modules/.bin/nx build twenty-oxlint-rules` - `node_modules/.bin/nx lint:diff-with-main twenty-server` - `node_modules/.bin/nx lint:diff-with-main twenty-front` - `npx oxlint -c packages/twenty-oxlint-rules/.oxlintrc.json packages/twenty-oxlint-rules/workspace/lint-diff-with-main-targets.spec.ts` - `git diff --check` ## Notes - `twenty-website-new:lint:diff-with-main` dependency shape remains unchanged. Full local execution is blocked by missing local `unzip`, which the existing `check-lottie-frames` script requires. ## Docs / Changelog No docs or manual changelog update needed. This fixes Nx task wiring for an existing documented command. --------- Co-authored-by: Charles Bochet --- nx.json | 1 + packages/twenty-front/project.json | 1 + packages/twenty-server/project.json | 1 + 3 files changed, 3 insertions(+) diff --git a/nx.json b/nx.json index 2d0b277451..2a18e74d02 100644 --- a/nx.json +++ b/nx.json @@ -57,6 +57,7 @@ "lint:diff-with-main": { "executor": "nx:run-commands", "cache": false, + "dependsOn": ["twenty-oxlint-rules:build"], "options": { "command": "FILES=$(git diff --name-only --diff-filter=d main -- {projectRoot}/ | grep -E '{args.pattern}'); [ -z \"$FILES\" ] && echo 'No changed files.' || (npx oxlint -c {projectRoot}/.oxlintrc.json $FILES && (prettier --check $FILES || (echo 'ERROR: Prettier formatting check failed! Fix with: npx nx lint:diff-with-main --configuration=fix' && false)))", "pattern": "\\.(ts|tsx|js|jsx)$" diff --git a/packages/twenty-front/project.json b/packages/twenty-front/project.json index f144c326c3..8b2167c0ad 100644 --- a/packages/twenty-front/project.json +++ b/packages/twenty-front/project.json @@ -87,6 +87,7 @@ }, "lint:diff-with-main": { "executor": "nx:run-commands", + "dependsOn": ["twenty-oxlint-rules:build"], "options": { "cwd": "{projectRoot}", "command": "FILES=$(git diff --name-only --relative --diff-filter=d main...HEAD -- src/ | grep -E '\\.(ts|tsx)$'); [ -z \"$FILES\" ] && echo 'No changed files.' || (npx oxlint --type-aware -c .oxlintrc.json $FILES && (prettier --check $FILES || (echo 'ERROR: Prettier formatting check failed! Fix with: npx nx lint:diff-with-main twenty-front --configuration=fix' && false)))" diff --git a/packages/twenty-server/project.json b/packages/twenty-server/project.json index 3bb631d0e5..08dfe39d20 100644 --- a/packages/twenty-server/project.json +++ b/packages/twenty-server/project.json @@ -169,6 +169,7 @@ }, "lint:diff-with-main": { "executor": "nx:run-commands", + "dependsOn": ["twenty-oxlint-rules:build"], "options": { "cwd": "{projectRoot}", "command": "FILES=$(git diff --name-only --relative --diff-filter=d main...HEAD -- src/ | grep -E '\\.(ts|tsx)$'); [ -z \"$FILES\" ] && echo 'No changed files.' || (npx oxlint --type-aware -c .oxlintrc.json $FILES && (prettier --check $FILES || (echo 'ERROR: Prettier formatting check failed! Fix with: npx nx lint:diff-with-main twenty-server --configuration=fix' && false)))"