[PR #5126] [MERGED] chore: add ESLint to /server #5310

Closed
opened 2026-06-05 15:20:56 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5126
Author: @angelplusultra
Created: 3/3/2026
Status: Merged
Merged: 3/5/2026
Merged by: @timothycarambat

Base: masterHead: eslint-server


📝 Commits (10+)

  • 5f44280 add eslint config to server
  • 3cb4480 add break statements to switch case
  • ff3ce72 add support for browser globals and turn off empty catch blocks
  • e94bfa0 disable lines with useless try/catch wrappers
  • 05ff17c format
  • d713dab fix no-undef errors
  • 746ae51 disbale lines violating no-unsafe-finally
  • 0231e4c ignore syncStaticLists.mjs
  • 74da87a use proper null check for creatorId instead of unreachable nullish coalescing
  • 393c61a remove unneeded typescript eslint comment

📊 Changes

61 files changed (+481 additions, -375 deletions)

View changed files

📝 server/endpoints/admin.js (+0 -1)
📝 server/endpoints/api/openai/helpers.js (+1 -1)
📝 server/endpoints/system.js (+1 -1)
📝 server/endpoints/workspaces.js (+1 -1)
📝 server/endpoints/workspacesParsedFiles.js (+1 -0)
server/eslint.config.mjs (+38 -0)
📝 server/jobs/cleanup-orphan-documents.js (+1 -1)
📝 server/jobs/helpers/index.js (+12 -8)
📝 server/jobs/sync-watched-documents.js (+115 -59)
📝 server/models/documents.js (+1 -1)
📝 server/models/embedChats.js (+1 -1)
📝 server/models/embedConfig.js (+2 -2)
📝 server/models/mobileDevice.js (+1 -1)
📝 server/models/systemSettings.js (+4 -5)
📝 server/models/user.js (+5 -1)
📝 server/package.json (+5 -3)
📝 server/swagger/index.js (+8 -8)
📝 server/swagger/utils.js (+34 -36)
📝 server/utils/AiProviders/azureOpenAi/index.js (+1 -1)
📝 server/utils/AiProviders/bedrock/index.js (+1 -1)

...and 41 more files

📄 Description

Pull Request Type

  • feat (New feature)
  • 🐛 fix (Bug fix)
  • ♻️ refactor (Code refactoring without changing behavior)
  • 💄 style (UI style changes)
  • 🔨 chore (Build, CI, maintenance)
  • 📝 docs (Documentation updates)

Relevant Issues

resolves #

Description

Adds an ESLint + Prettier configuration to the server/ package and fixes all errors surfaced by the new linting rules.

ESLint setup (5f442809, ff3ce727, 116e7891, 0231e4c5, a0ce0566, e59aeb76):

  • Add eslint.config.mjs with recommended rules, prettier integration, and unused-imports plugin
  • Add browser globals support and disable no-empty for catch blocks
  • Downgrade no-unused-private-class-members to a warning
  • Ignore syncStaticLists.mjs (top-level await incompatible with prettier parser)
  • Add lint script to package.json
  • Promote unused-imports/no-unused-vars from warning to error

no-undef fixes (d713dab3, 74da87a3):

  • endpoints/system.js — move engine destructuring outside try block so it's accessible in catch
  • utils/files/logo.js — add missing const for customLogoPath
  • utils/agents/ephemeral.js / utils/agents/index.js — fix undefined default params (handler, socket) to null
  • utils/AiProviders/sambanova/index.js — add missing clientAbortedHandler import
  • utils/AiProviders/genericOpenAi/index.js — add missing uuidv4 import
  • models/embedConfig.js — fix bare id reference to use embedId param

no-constant-binary-expression fix (74da87a3):

  • models/embedConfig.js — replace unreachable Number(creatorId) ?? null with proper null check

unused-imports/no-unused-vars fixes (18158ea7):

  • Many various fixes

no-unsafe-finally fix (746ae514):

  • endpoints/workspacesParsedFiles.js — disable rule on offending line

no-fallthrough fixes (3cb44801):

  • Add missing break statements to switch cases

Formatting (05ff17c6, e94bfa07, c7689620, 393c61a9):

  • Auto-format jobs/helpers/index.js and jobs/sync-watched-documents.js via prettier
  • Disable lines with useless try/catch wrappers
  • Remove unneeded TypeScript ESLint comment

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • I have tested my code functionality

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/5126 **Author:** [@angelplusultra](https://github.com/angelplusultra) **Created:** 3/3/2026 **Status:** ✅ Merged **Merged:** 3/5/2026 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `eslint-server` --- ### 📝 Commits (10+) - [`5f44280`](https://github.com/Mintplex-Labs/anything-llm/commit/5f44280932d09e373f75d21c93182421beff452f) add eslint config to server - [`3cb4480`](https://github.com/Mintplex-Labs/anything-llm/commit/3cb4480155e376120c3f1f31db0751556cea8471) add break statements to switch case - [`ff3ce72`](https://github.com/Mintplex-Labs/anything-llm/commit/ff3ce727edd984b7e463c1021108de218de7a4c9) add support for browser globals and turn off empty catch blocks - [`e94bfa0`](https://github.com/Mintplex-Labs/anything-llm/commit/e94bfa07266253e595c77bcfcbe17662fd2f9cbc) disable lines with useless try/catch wrappers - [`05ff17c`](https://github.com/Mintplex-Labs/anything-llm/commit/05ff17c6615c33e65527ec69105945b74891f550) format - [`d713dab`](https://github.com/Mintplex-Labs/anything-llm/commit/d713dab3eb37af05f50b80d88bb69da18f66f498) fix no-undef errors - [`746ae51`](https://github.com/Mintplex-Labs/anything-llm/commit/746ae514c385d1b153449bb69e026e1be3aa4968) disbale lines violating no-unsafe-finally - [`0231e4c`](https://github.com/Mintplex-Labs/anything-llm/commit/0231e4c5dccc8b8b146c68555714474d15de2d2f) ignore syncStaticLists.mjs - [`74da87a`](https://github.com/Mintplex-Labs/anything-llm/commit/74da87a38cd898ad814a8dc756e718def926f504) use proper null check for creatorId instead of unreachable nullish coalescing - [`393c61a`](https://github.com/Mintplex-Labs/anything-llm/commit/393c61a9a3913cf0167bfd6fad0973239ca58319) remove unneeded typescript eslint comment ### 📊 Changes **61 files changed** (+481 additions, -375 deletions) <details> <summary>View changed files</summary> 📝 `server/endpoints/admin.js` (+0 -1) 📝 `server/endpoints/api/openai/helpers.js` (+1 -1) 📝 `server/endpoints/system.js` (+1 -1) 📝 `server/endpoints/workspaces.js` (+1 -1) 📝 `server/endpoints/workspacesParsedFiles.js` (+1 -0) ➕ `server/eslint.config.mjs` (+38 -0) 📝 `server/jobs/cleanup-orphan-documents.js` (+1 -1) 📝 `server/jobs/helpers/index.js` (+12 -8) 📝 `server/jobs/sync-watched-documents.js` (+115 -59) 📝 `server/models/documents.js` (+1 -1) 📝 `server/models/embedChats.js` (+1 -1) 📝 `server/models/embedConfig.js` (+2 -2) 📝 `server/models/mobileDevice.js` (+1 -1) 📝 `server/models/systemSettings.js` (+4 -5) 📝 `server/models/user.js` (+5 -1) 📝 `server/package.json` (+5 -3) 📝 `server/swagger/index.js` (+8 -8) 📝 `server/swagger/utils.js` (+34 -36) 📝 `server/utils/AiProviders/azureOpenAi/index.js` (+1 -1) 📝 `server/utils/AiProviders/bedrock/index.js` (+1 -1) _...and 41 more files_ </details> ### 📄 Description ### Pull Request Type - [ ] ✨ feat (New feature) - [ ] 🐛 fix (Bug fix) - [ ] ♻️ refactor (Code refactoring without changing behavior) - [ ] 💄 style (UI style changes) - [x] 🔨 chore (Build, CI, maintenance) - [ ] 📝 docs (Documentation updates) ### Relevant Issues resolves # ### Description Adds an ESLint + Prettier configuration to the `server/` package and fixes all errors surfaced by the new linting rules. **ESLint setup (5f442809, ff3ce727, 116e7891, 0231e4c5, a0ce0566, e59aeb76):** - Add `eslint.config.mjs` with recommended rules, prettier integration, and unused-imports plugin - Add browser globals support and disable `no-empty` for catch blocks - Downgrade `no-unused-private-class-members` to a warning - Ignore `syncStaticLists.mjs` (top-level `await` incompatible with prettier parser) - Add `lint` script to `package.json` - Promote `unused-imports/no-unused-vars` from warning to error **`no-undef` fixes (d713dab3, 74da87a3):** - `endpoints/system.js` — move `engine` destructuring outside `try` block so it's accessible in `catch` - `utils/files/logo.js` — add missing `const` for `customLogoPath` - `utils/agents/ephemeral.js` / `utils/agents/index.js` — fix undefined default params (`handler`, `socket`) to `null` - `utils/AiProviders/sambanova/index.js` — add missing `clientAbortedHandler` import - `utils/AiProviders/genericOpenAi/index.js` — add missing `uuidv4` import - `models/embedConfig.js` — fix bare `id` reference to use `embedId` param **`no-constant-binary-expression` fix (74da87a3):** - `models/embedConfig.js` — replace unreachable `Number(creatorId) ?? null` with proper null check **`unused-imports/no-unused-vars` fixes (18158ea7):** - Many various fixes **`no-unsafe-finally` fix (746ae514):** - `endpoints/workspacesParsedFiles.js` — disable rule on offending line **`no-fallthrough` fixes (3cb44801):** - Add missing `break` statements to switch cases **Formatting (05ff17c6, e94bfa07, c7689620, 393c61a9):** - Auto-format `jobs/helpers/index.js` and `jobs/sync-watched-documents.js` via prettier - Disable lines with useless try/catch wrappers - Remove unneeded TypeScript ESLint comment ### Developer Validations - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] I have tested my code functionality --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 15:20:56 -04:00
yindo closed this issue 2026-06-05 15:20:56 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5310