File tree Expand file tree Collapse file tree 3 files changed +44
-2
lines changed Expand file tree Collapse file tree 3 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' agentic-node-ts-starter ' : minor
3+ ---
4+
5+ feat: Enable TypeScript ESLint rules requiring type information
6+
7+ - Added TypeScript ESLint type-aware rules (@typescript-eslint/recommended-type-checked )
8+ - Configured ESLint to use TypeScript compiler for enhanced type checking
9+ - Type-aware rules now catch floating promises, unsafe type assertions, and other subtle type-safety issues
10+ - Rules apply to src/** /\* .ts and tests/** /\* .ts files
11+ - Minimal performance impact (~ 1.5s for full project lint)
12+ - Improved code quality and runtime safety through compile-time checks
13+
14+ Closes #61
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4545
4646- ** Test-as-contract** : Property-based testing with fast-check for invariants, unit tests with Vitest
4747- ** Type safety** : Strict TypeScript with runtime validation using Zod for external boundaries
48+ - ** Advanced linting** : TypeScript ESLint with type-aware rules for catching subtle type-safety issues
4849- ** Module system** : ES modules (` "type": "module" ` ) with NodeNext resolution
4950- ** Claude Commands** : Custom commands in ` .claude/commands/ ` for common workflows
5051- ** Git Hooks** : Custom pre-commit verification via ` .claude/hooks/ `
@@ -153,7 +154,10 @@ Available slash commands in `.claude/commands/`:
153154- ** Node Version** : >=22.0.0 (engines requirement)
154155- ** TypeScript** : Strict mode with NodeNext module resolution
155156- ** Testing** : Vitest with V8 coverage provider
156- - ** Linting** : ESLint 9 with TypeScript support
157+ - ** Linting** : ESLint 9 with TypeScript support and type-aware rules enabled
158+ - Catches floating promises, unsafe type assertions, and other type-safety issues
159+ - Type-aware rules apply to ` src/**/*.ts ` and ` tests/**/*.ts ` files
160+ - Performance impact: ~ 1.5s for full project lint (acceptable trade-off for improved safety)
157161- ** Formatting** : Prettier 3 with ESLint integration
158162- ** Versioning** : Changesets for automated version management
159163
Original file line number Diff line number Diff line change 22import tseslint from '@typescript-eslint/eslint-plugin' ;
33import tsParser from '@typescript-eslint/parser' ;
44import eslintConfigPrettier from 'eslint-config-prettier' ;
5+ import { fileURLToPath } from 'node:url' ;
6+ import { dirname } from 'node:path' ;
7+
8+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
59
610/** @type {import('eslint').Linter.FlatConfig[] } */
711export default [
12+ // Base configuration for all JS/TS files
813 {
914 files : [ '**/*.{ts,tsx,js}' ] ,
1015 languageOptions : {
1116 parser : tsParser ,
12- parserOptions : { ecmaVersion : 2024 , sourceType : 'module' } ,
17+ parserOptions : {
18+ ecmaVersion : 2024 ,
19+ sourceType : 'module' ,
20+ } ,
1321 } ,
1422 plugins : { '@typescript-eslint' : tseslint } ,
1523 rules : {
@@ -18,6 +26,22 @@ export default [
1826 'no-debugger' : 'error' ,
1927 } ,
2028 } ,
29+ // Type-aware rules for TypeScript files only
30+ {
31+ files : [ 'src/**/*.ts' , 'tests/**/*.ts' ] ,
32+ languageOptions : {
33+ parser : tsParser ,
34+ parserOptions : {
35+ ecmaVersion : 2024 ,
36+ sourceType : 'module' ,
37+ project : true ,
38+ tsconfigRootDir : __dirname ,
39+ } ,
40+ } ,
41+ rules : {
42+ ...tseslint . configs [ 'recommended-type-checked' ] . rules ,
43+ } ,
44+ } ,
2145 // Keep Prettier last
2246 eslintConfigPrettier ,
2347] ;
You can’t perform that action at this time.
0 commit comments