chore: Centralize linting and formatting tooling (ESLint, Prettier, Ruff, Dart)
Summary
Centralize and modernize linting/formatting configuration across the entire monorepo: ESLint 10 + Prettier 3 for JavaScript/Vue, Ruff for Python (OPEA services), Flutter/Dart for mobile, and Claude Code hooks for automatic enforcement.
Changes
1. ESLint 10 + Prettier 3 (JavaScript/Vue)
- Migrate all 4 JS components to ESLint 10 flat config (
eslint.config.js) - Add
eslint-config-prettieras last config entry (disables formatting rules that conflict with Prettier) - Add
eslint-plugin-vuewithflat/recommendedpreset for frontend - Centralize Prettier config at repo root (
.prettierrc) - Extract shared ESLint rules in
components/shared/eslint-rules-base.js - Add
.editorconfigfor IDE-level consistency - Remove deprecated
.eslintignorefiles (migrated intoeslint.config.jsignores) - Remove per-component
.prettierrcfiles (conflicted with root config) - Add
globalspackage for Jest globals in test files - Add root-level orchestration scripts (
lint,lint:fix,format,format:check)
Components covered: gov-chat-frontend, gov-chat-backend, document-repository, shared/lib
2. Ruff (Python — OPEA services)
- Add
genie-ai-overlay/pyproject.tomlwith Ruff configuration- Target: Python 3.10 (matches lowest runtime version across Dockerfiles)
- Line length: 120, double quotes
- Rules: E, F, I, UP, B, SIM (pycodestyle, pyflakes, isort, pyupgrade, bugbear, simplify)
- Ignores: E402 (OPEA
os.getenv()-before-import pattern), E741 (ML variable names)
- Add Python lint/format scripts to root
package.json(lint:py,lint:py:fix,format:py,format:py:check) - Update documentation:
black/flake8references replaced withruff
Components covered: genie-ai-overlay/ (chatqna, dataprep, retriever, reranker, core)
3. Flutter/Dart (Mobile)
- Add lint/format scripts to root
package.json(lint:dart,format:dart,format:dart:check) - Add PostToolUse hook for
dart analyzeon.dartfiles (timeout 60s) - Update
CLAUDE.mdlinting section with Dart commands - Existing
analysis_options.yamlwithflutter_lintsalready in place
Components covered: mobile/genie_ai_mobile/
4. Claude Code integration
- Add
.claude/settings.jsonwith PostToolUse hooks:- ESLint on
.js/.vuefiles (walks up to find nearesteslint.config.js) - Ruff on
.pyfiles (usesruffvia PATH — cross-platform) -
dart analyzeon.dartfiles (usesdartvia PATH — cross-platform)
- ESLint on
- Update
CLAUDE.mdlinting section with complete JS + Python + Dart commands
Files changed
| File | Change |
|---|---|
.prettierrc, .prettierignore, .editorconfig
|
New — centralized config |
components/shared/eslint-rules-base.js |
New — shared ESLint rules |
components/*/eslint.config.js (x4) |
New — ESLint 10 flat config |
components/*/package.json (x4) |
Updated — ESLint 10 deps, lint scripts |
components/*/.eslintignore (x3) |
Deleted — migrated to flat config |
components/*/.prettierrc (x3) |
Deleted — centralized to root |
genie-ai-overlay/pyproject.toml |
New — Ruff config |
package.json |
Updated — root orchestration scripts (JS + Python + Dart) |
.claude/settings.json |
New — PostToolUse hooks (ESLint + Ruff + Dart) |
CLAUDE.md, STANDARDS.md, project-context.md
|
Updated — tooling references |
Test plan
-
npm run lint— ESLint runs on all 4 JS components (~328 existing errors, not config issues) -
npm run format:check— Prettier checks pass on all 4 JS components -
npm run lint:py— Ruff checks Python code (92 existing errors) -
npm run format:py:check— Ruff format checks Python code (14 files to reformat) -
npm run lint:dart—dart analyzeruns on Flutter project (3908 issues, mostly missing deps) -
npm run format:dart:check—dart formatchecks (64 files to reformat) -
Hook ESLint on .js— pipe-tested, fires correctly -
Hook Ruff on .py— pipe-tested, fires correctly -
Hook Dart on .dart— pipe-tested, fires correctly
Note
Existing lint errors (~328 JS, 4.RAG_System Python, 3908 Dart) are not fixed in this MR — only tooling configuration is committed. Lint error fixes will be addressed in separate MRs.
Closes #412 (closed) Closes #449 (closed) Closes #493 (closed)
Edited by Jérôme Revillard