From 0f8a62db4814a10cbc10b3ac2ab87285435b2a56 Mon Sep 17 00:00:00 2001 From: ai-implementer Date: Tue, 21 Jul 2026 05:54:30 +0000 Subject: [PATCH] [QOTD-4] Configure ESLint with @typescript-eslint recommended rules Add eslint.config.mjs (flat config) using @typescript-eslint/eslint-plugin flat/recommended rules. Add npm run lint script (exits 0 on current codebase). Co-Authored-By: Claude Sonnet 4.6 --- CLAUDE.md | 8 ++++---- eslint.config.mjs | 12 ++++++++++++ package.json | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 eslint.config.mjs diff --git a/CLAUDE.md b/CLAUDE.md index 2264f74..4a74376 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -42,8 +42,10 @@ quote-of-the-day-api/ ├── src/ # TypeScript source │ └── placeholder.test.ts # harness smoke test ├── dist/ # compiled output (git-ignored) +├── eslint.config.mjs # ESLint flat config (@typescript-eslint recommended) ├── package.json ├── package-lock.json +├── tsconfig.json ├── .gitignore ├── README.md # Project overview (currently a stub) └── CLAUDE.md # This file @@ -61,9 +63,7 @@ quote-of-the-day-api/ ## Code Style -> Update this section once a linter/formatter config is committed (`.eslintrc`, etc.). - -- **TypeScript**: `strict: true`, `target: "ES2020"` recommended in `tsconfig.json` -- **Linting**: ESLint with `@typescript-eslint` rules; `npm run lint` must exit cleanly +- **TypeScript**: `strict: true`, `target: "ES2020"` in `tsconfig.json` +- **Linting**: ESLint 10 flat config (`eslint.config.mjs`) using `@typescript-eslint/eslint-plugin` `flat/recommended` rules; run `npm run lint` — must exit 0 - Follow the conventions of the chosen language's ecosystem formatter (e.g., Prettier for JS/TS). - Keep controllers thin; put business logic in service or domain layers. diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..5bda166 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,12 @@ +import tsPlugin from '@typescript-eslint/eslint-plugin'; +import tsParser from '@typescript-eslint/parser'; + +export default [ + ...tsPlugin.configs['flat/recommended'], + { + files: ['**/*.ts'], + languageOptions: { + parser: tsParser, + }, + }, +]; diff --git a/package.json b/package.json index 29dbab1..0095d51 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "build": "tsc", "dev": "ts-node src/index.ts", + "lint": "eslint src", "test": "vitest run", "test:watch": "vitest" },