Compare commits

...
Author SHA1 Message Date
Sonarly Claude Code 9aae3716e2 fix: add dependsOn for twenty-oxlint-rules:build to lint:diff-with-main target
https://sonarly.com/issue/35975?type=bug

The `lint:diff-with-main` Nx target fails on fresh clones because it requires the oxlint plugin from `twenty-oxlint-rules/dist/`, but this target is missing the `dependsOn` configuration that would automatically build it first.

Fix: Added `"dependsOn": ["twenty-oxlint-rules:build"]` to the `lint:diff-with-main` target in `nx.json`.

The `lint:diff-with-main` Nx target uses oxlint with a custom JS plugin from `packages/twenty-oxlint-rules/dist/oxlint-plugin.mjs`. Without the `dependsOn` configuration, Nx doesn't know to build the plugin package first, causing the command to fail on fresh clones with "Cannot find module '../twenty-oxlint-rules/dist/oxlint-plugin.mjs'".

This fix ensures that when a developer runs `npx nx lint:diff-with-main twenty-server` (or any other package), Nx will automatically build the `twenty-oxlint-rules` package first, generating the required `dist/oxlint-plugin.mjs` file.

The fix follows the same pattern as the `lint` target (line 55), which already has the correct `dependsOn` including `twenty-oxlint-rules:build`.
2026-05-08 00:02:20 +00:00
+1
View File
@@ -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)$"