Compare commits

..

1 Commits

Author SHA1 Message Date
viet-anh.n
cafba21523 Configure ESLint, Prettier, and TypeScript strict mode
- Add package.json with ESLint v9, typescript-eslint, eslint-plugin-react,
  eslint-plugin-react-hooks, eslint-config-prettier, Prettier, and TypeScript
  as devDependencies; includes lint, format, and format:check npm scripts
- Add eslint.config.js (flat config) with TypeScript recommended rules,
  React + React Hooks plugin rules, and prettier conflict suppression
- Add tsconfig.json with strict: true, ES2020 target, DOM libs, react-jsx
- Add .prettierrc with single quotes, 2-space indent, ES5 trailing commas
- Update CLAUDE.md to document new tooling and commands

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 10:35:51 +00:00
5 changed files with 89 additions and 6 deletions

6
.prettierrc Normal file
View File

@ -0,0 +1,6 @@
{
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 80
}

View File

@ -6,15 +6,23 @@ Greenfield project. Implementation is driven by the Vexa AI-SDLC pipeline (Jira
``` ```
/ /
├── index.html # Calculator UI (semantic HTML5) ├── index.html # Calculator UI (semantic HTML5)
├── styles.css # Responsive CSS layout and styling ├── styles.css # Responsive CSS layout and styling
├── README.md # Project overview ├── package.json # Dev dependencies and npm scripts
└── CLAUDE.md # This file ├── eslint.config.js # ESLint flat config (TypeScript + React rules)
├── tsconfig.json # TypeScript compiler config (strict mode)
├── .prettierrc # Prettier formatting config
├── README.md # Project overview
└── CLAUDE.md # This file
``` ```
## Build Commands ## Build Commands
No build system has been configured yet. Update this section once a language/framework is chosen and dependencies are added. No build step configured yet. Install dependencies with:
```bash
npm install
```
## Test Commands ## Test Commands
@ -24,6 +32,14 @@ No test suite has been configured yet. Update this section once testing infrastr
No dev server or REPL is configured yet. Update this section once the implementation begins. No dev server or REPL is configured yet. Update this section once the implementation begins.
## Lint and Format Commands
```bash
npm run lint # Run ESLint
npm run format # Format all files with Prettier
npm run format:check # Check formatting without writing (CI)
```
## Architecture Notes ## Architecture Notes
- **Domain**: Simple Calculator — arithmetic operations (add, subtract, multiply, divide at minimum). - **Domain**: Simple Calculator — arithmetic operations (add, subtract, multiply, divide at minimum).
@ -32,4 +48,6 @@ No dev server or REPL is configured yet. Update this section once the implementa
## Code Style ## Code Style
No linter or formatter has been configured yet. Update this section once tooling is set up. - **Linter**: ESLint v9 (flat config) with `typescript-eslint` recommended rules, `eslint-plugin-react`, `eslint-plugin-react-hooks`, and `eslint-config-prettier`.
- **Formatter**: Prettier — single quotes, 2-space indent, ES5 trailing commas, 80-char line width.
- **TypeScript**: `strict: true` enabled in `tsconfig.json`.

24
eslint.config.js Normal file
View File

@ -0,0 +1,24 @@
import tseslint from 'typescript-eslint';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import prettierConfig from 'eslint-config-prettier';
export default [
...tseslint.configs.recommended,
{
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin,
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
},
settings: {
react: {
version: 'detect',
},
},
},
prettierConfig,
];

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "test-simple-calculator",
"version": "1.0.0",
"private": true,
"scripts": {
"lint": "eslint .",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-react": "^7.0.0",
"eslint-plugin-react-hooks": "^5.0.0",
"prettier": "^3.0.0",
"typescript": "^5.0.0"
}
}

15
tsconfig.json Normal file
View File

@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true
},
"include": ["src", "*.ts", "*.tsx"]
}