[PR #4923] [MERGED] feat: Enable essential ESLint rules and refactor frontend lint config #4821

Closed
opened 2026-02-22 18:36:36 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4923
Author: @angelplusultra
Created: 1/28/2026
Status: Merged
Merged: 1/29/2026
Merged by: @timothycarambat

Base: masterHead: 4917-enable-essential-rules-and-apply-fixes-in-frontend-eslint


📝 Commits (10+)

  • 3ec7471 Install eslint-plugin-unsued-imports
  • 0e8552b Refactor eslint to a sane working config
  • 16ab167 enable jsx-no-target-blank | disable no-escaped-entities
  • 5ce2fe0 disable react/display-name react-hooks/immutability and react-hooks/preserve-manual-memoization
  • 31085d6 chore: remove unused imports (#4925)
  • d86a989 fix: resolve react-hooks ESLint errors (#4929)
  • 0b162de fix: add rel=noreferrer to target=_blank links (#4928)
  • c63e8ae fix: resolve undefined variable errors in frontend (#4927)
  • d9ee52d chore: Remove unused variables in frontend (#4924)
  • 0d5dd25 Merge branch 'master' into 4917-enable-essential-rules-and-apply-fixes-in-frontend-eslint

📊 Changes

46 files changed (+117 additions, -117 deletions)

View changed files

📝 frontend/eslint.config.js (+51 -17)
📝 frontend/package.json (+1 -0)
📝 frontend/src/components/ChatBubble/index.jsx (+1 -1)
frontend/src/components/DataConnectorOption/index.jsx (+0 -25)
📝 frontend/src/components/LLMSelection/DPAISOptions/index.jsx (+1 -4)
📝 frontend/src/components/LLMSelection/NvidiaNimOptions/managed.jsx (+1 -1)
📝 frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx (+1 -1)
📝 frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Chartable/CustomCell.jsx (+1 -13)
📝 frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx (+2 -1)
📝 frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/index.jsx (+1 -1)
📝 frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/PromptReply/index.jsx (+1 -1)
📝 frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/LLMSelector/utils.js (+1 -1)
📝 frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SpeechToText/index.jsx (+1 -1)
📝 frontend/src/components/WorkspaceChat/ChatContainer/index.jsx (+1 -1)
📝 frontend/src/components/lib/ModelTable/index.jsx (+17 -17)
📝 frontend/src/components/lib/MonoProviderIcon/index.jsx (+1 -0)
📝 frontend/src/hooks/useProviderEndpointAutoDiscovery.js (+1 -1)
📝 frontend/src/locales/normalizeEn.mjs (+2 -1)
📝 frontend/src/locales/verifyTranslations.mjs (+1 -0)
📝 frontend/src/main.jsx (+1 -1)

...and 26 more files

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #4917

What is in this change?

Refactors frontend ESLint configuration and enables essential rules that were previously disabled.

New ESLint Plugin

  • Added eslint-plugin-unused-imports for automatic detection and removal of unused imports

Rules Enabled

Rule Level Purpose
no-undef error Catch undefined variable references
react/jsx-no-target-blank error Security: prevent reverse tabnabbing attacks
unused-imports/no-unused-imports error Remove dead import statements
unused-imports/no-unused-vars warn Flag unused variables (ignores _ prefixed)

Rules Disabled

Rule Reason
react/prop-types Project uses JSDoc/TypeScript patterns instead
react/no-unescaped-entities Too noisy for apostrophes in JSX text
react/display-name Anonymous components are acceptable in this codebase
react-hooks/exhaustive-deps Too restrictive for current patterns
react-hooks/set-state-in-effect Not applicable to current patterns
react-hooks/immutability Not applicable to current patterns
react-hooks/preserve-manual-memoization Not applicable to current patterns

Config Improvements

  • Properly spreads recommended rules from React and React Hooks plugins
  • Cleaner structure using the ESLint flat config array format
  • Removed deprecated defineConfig wrapper

Additional Information

This PR sets up the ESLint configuration only. Subsequent PRs will contain the actual fixes for each violated rule:

  • PR for no-undef violations (#4927 )
  • PR for react/jsx-no-target-blank violations (#4928 )
  • PR for unused vars cleanup (#4924 )
  • PR for unused imports cleanup (#4925 )
  • PR for react-hooks/* errors (#4929 )

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 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/4923 **Author:** [@angelplusultra](https://github.com/angelplusultra) **Created:** 1/28/2026 **Status:** ✅ Merged **Merged:** 1/29/2026 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `4917-enable-essential-rules-and-apply-fixes-in-frontend-eslint` --- ### 📝 Commits (10+) - [`3ec7471`](https://github.com/Mintplex-Labs/anything-llm/commit/3ec74716fb04c8d4dd3d5c786220555c0270ce6c) Install eslint-plugin-unsued-imports - [`0e8552b`](https://github.com/Mintplex-Labs/anything-llm/commit/0e8552bfb86cda0ffb160438dd8de7ad5b8d11e9) Refactor eslint to a sane working config - [`16ab167`](https://github.com/Mintplex-Labs/anything-llm/commit/16ab1676552199fb737fe0d534b8467369b1c632) enable jsx-no-target-blank | disable no-escaped-entities - [`5ce2fe0`](https://github.com/Mintplex-Labs/anything-llm/commit/5ce2fe038c76bd09e3ed79726576f6420f23d3fd) disable react/display-name react-hooks/immutability and react-hooks/preserve-manual-memoization - [`31085d6`](https://github.com/Mintplex-Labs/anything-llm/commit/31085d6b255b9892e860b44032adfe9f9781469b) chore: remove unused imports (#4925) - [`d86a989`](https://github.com/Mintplex-Labs/anything-llm/commit/d86a9896b8790437d48c64b2e086bfdfc6639777) fix: resolve react-hooks ESLint errors (#4929) - [`0b162de`](https://github.com/Mintplex-Labs/anything-llm/commit/0b162deaac2982400f99c3108a815d433f7ada98) fix: add rel=noreferrer to target=_blank links (#4928) - [`c63e8ae`](https://github.com/Mintplex-Labs/anything-llm/commit/c63e8ae08c9b8019cd5fedf41f57f772b200d7f1) fix: resolve undefined variable errors in frontend (#4927) - [`d9ee52d`](https://github.com/Mintplex-Labs/anything-llm/commit/d9ee52d50a4193a5282dcaa4b5e841d4aa1fb4a4) chore: Remove unused variables in frontend (#4924) - [`0d5dd25`](https://github.com/Mintplex-Labs/anything-llm/commit/0d5dd25277ad6fe3aa8bd13206c7d47c29f66f2b) Merge branch 'master' into 4917-enable-essential-rules-and-apply-fixes-in-frontend-eslint ### 📊 Changes **46 files changed** (+117 additions, -117 deletions) <details> <summary>View changed files</summary> 📝 `frontend/eslint.config.js` (+51 -17) 📝 `frontend/package.json` (+1 -0) 📝 `frontend/src/components/ChatBubble/index.jsx` (+1 -1) ➖ `frontend/src/components/DataConnectorOption/index.jsx` (+0 -25) 📝 `frontend/src/components/LLMSelection/DPAISOptions/index.jsx` (+1 -4) 📝 `frontend/src/components/LLMSelection/NvidiaNimOptions/managed.jsx` (+1 -1) 📝 `frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx` (+1 -1) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Chartable/CustomCell.jsx` (+1 -13) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx` (+2 -1) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/index.jsx` (+1 -1) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/PromptReply/index.jsx` (+1 -1) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/LLMSelector/utils.js` (+1 -1) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/SpeechToText/index.jsx` (+1 -1) 📝 `frontend/src/components/WorkspaceChat/ChatContainer/index.jsx` (+1 -1) 📝 `frontend/src/components/lib/ModelTable/index.jsx` (+17 -17) 📝 `frontend/src/components/lib/MonoProviderIcon/index.jsx` (+1 -0) 📝 `frontend/src/hooks/useProviderEndpointAutoDiscovery.js` (+1 -1) 📝 `frontend/src/locales/normalizeEn.mjs` (+2 -1) 📝 `frontend/src/locales/verifyTranslations.mjs` (+1 -0) 📝 `frontend/src/main.jsx` (+1 -1) _...and 26 more files_ </details> ### 📄 Description ### Pull Request Type - [x] ✨ feat - [ ] 🐛 fix - [x] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues resolves #4917 ### What is in this change? Refactors frontend ESLint configuration and enables essential rules that were previously disabled. **New ESLint Plugin** - Added `eslint-plugin-unused-imports` for automatic detection and removal of unused imports **Rules Enabled** | Rule | Level | Purpose | |------|-------|---------| | `no-undef` | error | Catch undefined variable references | | `react/jsx-no-target-blank` | error | Security: prevent reverse tabnabbing attacks | | `unused-imports/no-unused-imports` | error | Remove dead import statements | | `unused-imports/no-unused-vars` | warn | Flag unused variables (ignores `_` prefixed) | **Rules Disabled** | Rule | Reason | |------|--------| | `react/prop-types` | Project uses JSDoc/TypeScript patterns instead | | `react/no-unescaped-entities` | Too noisy for apostrophes in JSX text | | `react/display-name` | Anonymous components are acceptable in this codebase | | `react-hooks/exhaustive-deps` | Too restrictive for current patterns | | `react-hooks/set-state-in-effect` | Not applicable to current patterns | | `react-hooks/immutability` | Not applicable to current patterns | | `react-hooks/preserve-manual-memoization` | Not applicable to current patterns | **Config Improvements** - Properly spreads recommended rules from React and React Hooks plugins - Cleaner structure using the ESLint flat config array format - Removed deprecated `defineConfig` wrapper ### Additional Information This PR sets up the ESLint configuration only. Subsequent PRs will contain the actual fixes for each violated rule: - PR for `no-undef` violations (#4927 ) - PR for `react/jsx-no-target-blank` violations (#4928 ) - PR for unused vars cleanup (#4924 ) - PR for unused imports cleanup (#4925 ) - PR for `react-hooks/*` errors (#4929 ) ### Developer Validations - [x] I ran `yarn lint` from the root of the repo & committed changes - [ ] Relevant documentation has been updated - [x] I have tested my code functionality - [ ] Docker build succeeds locally --- <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-02-22 18:36:36 -05:00
yindo closed this issue 2026-02-22 18:36:36 -05:00
yindo changed title from [PR #4923] feat: Enable essential ESLint rules and refactor frontend lint config to [PR #4923] [MERGED] feat: Enable essential ESLint rules and refactor frontend lint config 2026-06-05 15:20:33 -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#4821