fix(backend): resolve lint warnings and stabilize Turbo env cache for DB_FILE_NAME#39
Conversation
- Updated packageManager in package.json to pnpm@10.33.0. - Upgraded typescript-eslint and related packages to version 8.58.2 in pnpm-lock.yaml and package.json. - Added new global environment variable DB_FILE_NAME in turbo.json. - Improved enum validation in drizzle.ts for better type safety. - Enhanced ESLint configuration in base.js to include globals and updated rules for unused variables.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRefined enum validation cast in backend utils, bumped project pnpm metadata, removed pinned pnpm versions from CI steps, merged Node globals and added rule overrides in ESLint configs (and bumped a devDependency), and added Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…onfigurations - Updated .github/workflows/license-header.yml and .github/workflows/release.yml to remove the explicit version setting for pnpm in the setup step, allowing for the latest version to be used.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/eslint-config/base.js`:
- Around line 22-37: The package is missing an export for the Vite ESLint config
and the Vite config file drops Node globals; add an export entry for "./vite":
"./vite.js" in package.json exports, and update vite.js (the config that
currently sets languageOptions.globals = globals.browser) to either spread the
baseConfig (baseConfig) or explicitly merge ...globals.node with globals.browser
so Node globals (globals.node) are available for files like
apps/web/vite.config.ts that call process.cwd(); also audit react-internal.js
and next.js to ensure they are not applied to files that need Node globals (or
else merge Node globals similarly).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8110c5f5-f0aa-49a4-8672-966ed3b4ee9c
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
apps/backend/src/utils/drizzle.tspackage.jsonpackages/eslint-config/base.jspackages/eslint-config/package.jsonturbo.json
| { | ||
| languageOptions: { | ||
| globals: { | ||
| ...globals.node, | ||
| }, | ||
| }, | ||
| rules: { | ||
| '@typescript-eslint/no-unused-vars': [ | ||
| 'warn', | ||
| { | ||
| argsIgnorePattern: '^_', | ||
| caughtErrorsIgnorePattern: '^_', | ||
| }, | ||
| ], | ||
| }, | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check how downstream configs handle globals and whether they need Node globals
# Find all eslint config files that extend baseConfig
rg -l 'baseConfig' --glob '*.js' packages/eslint-config/
# Check if any frontend code references Node globals like process
rg -n '\bprocess\.' --type ts --type js -g '!node_modules' apps/ packages/ | head -30Repository: TeamCoderz/WordyMe
Length of output: 451
🏁 Script executed:
#!/bin/bash
# Read the downstream config files that override globals
echo "=== react-internal.js ==="
cat packages/eslint-config/react-internal.js | head -50
echo -e "\n=== next.js ==="
cat packages/eslint-config/next.js | head -50
# Check ESLint config in apps/web (frontend)
echo -e "\n=== Apps/web ESLint config ==="
find apps/web -name 'eslint.config.*' -o -name '.eslintrc*' | xargs cat 2>/dev/null || echo "No eslintrc found in apps/web"
# Check ESLint config in apps/backend
echo -e "\n=== Apps/backend ESLint config ==="
find apps/backend -name 'eslint.config.*' -o -name '.eslintrc*' | xargs cat 2>/dev/null || echo "No eslintrc found in apps/backend"
# Check if there's a root ESLint config
echo -e "\n=== Root ESLint config ==="
cat eslint.config.js 2>/dev/null | head -100Repository: TeamCoderz/WordyMe
Length of output: 2936
🏁 Script executed:
#!/bin/bash
# List all JS files in eslint-config
echo "=== All JS files in packages/eslint-config/ ==="
ls -la packages/eslint-config/*.js
# Search for vite in eslint-config directory
echo -e "\n=== Searching for 'vite' in eslint-config ==="
rg -i 'vite' packages/eslint-config/
# Check the full base.js to see what's exported
echo -e "\n=== Full base.js file ==="
cat packages/eslint-config/base.js
# Check what `@repo/eslint-config` exports
echo -e "\n=== Check package.json for eslint-config exports ==="
cat packages/eslint-config/package.json | grep -A 20 '"exports"'Repository: TeamCoderz/WordyMe
Length of output: 2194
🏁 Script executed:
#!/bin/bash
# Read the full vite.js file
echo "=== Full vite.js file ==="
cat packages/eslint-config/vite.jsRepository: TeamCoderz/WordyMe
Length of output: 1221
Multiple globals configuration issues need attention.
The globals.node in base.js is properly set, but several downstream configs either override or omit it:
-
vite.jsis missing from package.json exports —apps/webimports@repo/eslint-config/vitebut the export is not declared. This will cause module resolution failures. -
vite.jsloses Node globals entirely — It setsglobals: globals.browseronly and does not spreadbaseConfig, so Node globals are unavailable. However,apps/web/vite.config.tsusesprocess.cwd()(line 10), which requires Node globals for linting. -
react-internal.jsandnext.jsoverride Node globals — Both configs spreadbaseConfigbut then replacelanguageOptions.globalswith browser/serviceworker globals only. This is acceptable if these configs are used exclusively for frontend code that doesn't reference Node APIs.
Action items:
- Add
"./vite": "./vite.js"to package.json exports - Update
vite.jsto spreadbaseConfigor explicitly include...globals.nodealongsideglobals.browser - Verify that
react-internal.jsandnext.jsare not applied to any files needing Node globals (e.g., build config files)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/eslint-config/base.js` around lines 22 - 37, The package is missing
an export for the Vite ESLint config and the Vite config file drops Node
globals; add an export entry for "./vite": "./vite.js" in package.json exports,
and update vite.js (the config that currently sets languageOptions.globals =
globals.browser) to either spread the baseConfig (baseConfig) or explicitly
merge ...globals.node with globals.browser so Node globals (globals.node) are
available for files like apps/web/vite.config.ts that call process.cwd(); also
audit react-internal.js and next.js to ensure they are not applied to files that
need Node globals (or else merge Node globals similarly).
…tions - Introduced a new Vite configuration file for ESLint. - Updated the ESLint configuration to include Node globals alongside browser globals for improved compatibility.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/eslint-config/vite.js (1)
19-22: Consider scoping Node globals to config files only.Lines 19-22 merge
globals.nodeinto the browser-targeted scope (applied to all**/*.{ts,tsx}files). While no violations currently exist in frontend source, this pattern unnecessarily permits Node-only identifiers likeprocess,Buffer, and__dirnamein browser code, reducing lint safety for catching runtime incompatibilities.The
apps/web/vite.config.tslegitimately uses Node APIs (process.cwd(),__dirname), so separate config blocks would allow Node globals only where needed.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/eslint-config/vite.js` around lines 19 - 22, The current override merges globals.node into the browser-targeted scope (globals with ...globals.browser and ...globals.node), which lets Node identifiers like process, Buffer, and __dirname appear in frontend files; split this into two overrides: keep ...globals.browser for the frontend pattern (e.g., **/*.{ts,tsx}) and create a separate override that adds ...globals.node only for config files (e.g., vite config such as apps/web/vite.config.ts and other build/config scripts), so Node globals are allowed only in files that legitimately use process.cwd(), __dirname, etc.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/eslint-config/vite.js`:
- Around line 19-22: The current override merges globals.node into the
browser-targeted scope (globals with ...globals.browser and ...globals.node),
which lets Node identifiers like process, Buffer, and __dirname appear in
frontend files; split this into two overrides: keep ...globals.browser for the
frontend pattern (e.g., **/*.{ts,tsx}) and create a separate override that adds
...globals.node only for config files (e.g., vite config such as
apps/web/vite.config.ts and other build/config scripts), so Node globals are
allowed only in files that legitimately use process.cwd(), __dirname, etc.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 90fd4693-1150-4148-9c27-5f47837793fa
📒 Files selected for processing (2)
packages/eslint-config/package.jsonpackages/eslint-config/vite.js
✅ Files skipped from review due to trivial changes (1)
- packages/eslint-config/package.json
…neConfig - Refactored the ESLint configuration for Vite to utilize the defineConfig function for improved clarity and structure. - Enhanced global definitions by separating browser and Node globals into distinct language options. - Maintained existing rules and plugins while ensuring compatibility with TypeScript and React.
Lint Stability and Cache Correctness Improvements
Summary
This change set resolves backend lint warnings and improves task cache correctness for environment-driven database configuration. The update is scoped to lint/config hygiene and does not introduce runtime behavior changes.
Changes Implemented
DB_FILE_NAMEto Turbo global environment inputs inturbo.jsonso cache invalidation correctly tracks database path changes.packages/eslint-config/base.jsto:process,console, etc.) for JS/MJS linting contexts_via minimal@typescript-eslint/no-unused-varsoverridesany-based enum validation inapps/backend/src/utils/drizzle.tswith a typed string-array check, preserving behavior while improving type safety.Impact and Risk
DB_FILE_NAMEchanges.Validation
pnpm lint(backend) now returns clean output for prior warning set.typescript-eslint@8.57.xis a separate version-alignment item and not part of these functional lint fixes.Summary by CodeRabbit
Chores
Style
Bug Fixes