Commit f8664b1
Fix TypeScript ESLint Phase 2a: Simple non-breaking fixes (27 errors) (#793)
## Summary
This PR addresses simple, safe ESLint fixes that don't change any
runtime behavior or APIs.
Part of #789 - TypeScript ESLint Phase 2a: Simple Non-Breaking Fixes
Related to #783 - TypeScript ESLint Technical Debt resolution
Follows PR #788 - Phase 1 completion
## Changes Made
### 1. Remove Unused ESLint Directives (4 errors)
**File:** `package/utils/debug.ts`
Removed unused `// eslint-disable-next-line no-console` comments. These
directives are no longer needed since the `no-console` rule is not
triggering for these console methods in a debug utility module.
**Impact:** Cleanup only - no functional changes
### 2. Fix Explicit `any` Types (4 errors)
**Files:**
- `package/utils/getStyleRule.ts` - Replaced `any[]` with `unknown[]`
for loader arrays
- `package/utils/helpers.ts` - Replaced `error: any` with `error:
unknown` and added proper type assertion
- `package/utils/requireOrError.ts` - Replaced `any` return type with
`unknown`
**Impact:** Internal only - improves type safety without changing
behavior
### 3. Fix Redundant Type Constituents (19 errors)
**Files:**
- `package/types.ts` - Simplified `DevServerConfig` interface type
unions
- `package/webpackDevServerConfig.ts` - Simplified webpack dev server
config type unions
**Examples:**
```typescript
// Before:
allowed_hosts?: "all" | "auto" | string | string[]
host?: "local-ip" | "local-ipv4" | "local-ipv6" | string
port?: "auto" | string | number
static?: boolean | string | unknown
watch_files?: string | string[] | unknown
// After:
allowed_hosts?: string | string[]
host?: string
port?: string | number
static?: unknown
watch_files?: unknown
```
**Reasoning:**
- When a union includes `string`, specific string literals like `"all"`
or `"auto"` are redundant because `string` already includes all possible
strings
- When a union includes `unknown`, all other types are redundant because
`unknown` is the top type that includes everything
**Impact:** Type definitions become cleaner and more accurate. No
runtime changes, no API changes.
## Error Reduction
- **Before**: 247 ESLint errors
- **After**: 220 ESLint errors
- **Fixed**: 27 errors (10.9% reduction)
## Testing
- ✅ All existing linting passes with standard ignore patterns
- ✅ TypeScript compilation succeeds (`tsc --noEmit`)
- ✅ Pre-commit hooks pass (type checking, linting, prettier)
- ✅ Security validation tests pass
- 1 parent 2ca0cb3 commit f8664b1
File tree
6 files changed
+16
-22
lines changed- package
- utils
6 files changed
+16
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | 96 | | |
98 | | - | |
| 97 | + | |
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | 102 | | |
104 | | - | |
105 | | - | |
| 103 | + | |
106 | 104 | | |
107 | 105 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | | - | |
33 | 30 | | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
37 | 34 | | |
38 | | - | |
39 | 35 | | |
40 | 36 | | |
41 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
0 commit comments