Skip to content

Commit 25f6cd8

Browse files
committed
WIP cleanup and security updates
1 parent 328f986 commit 25f6cd8

File tree

10 files changed

+393
-457
lines changed

10 files changed

+393
-457
lines changed

TODO.md

Lines changed: 35 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -1,180 +1,48 @@
1-
# VSCode Coder Extension - Next Steps & Improvements
1+
# VSCode Coder Extension - Next Steps
22

3-
## Current Status 🎯
3+
## Current Status
44

5-
**✅ MAJOR ACCOMPLISHMENTS COMPLETED:**
5+
**COMPLETED:**
6+
- Perfect type safety (all lint errors eliminated)
7+
- Excellent test coverage (420 tests passing)
8+
- Clean webpack builds (4.52 MiB bundle)
9+
- Zero lint/formatting issues
610

7-
- **Perfect Type Safety**: All 279 lint errors eliminated (100% reduction)
8-
- **Excellent Test Coverage**: 84.5% overall coverage with 420 tests passing
9-
- **Zero Technical Debt**: Clean, maintainable codebase achieved
11+
## Priority Tasks
1012

11-
---
12-
13-
## Priority 1: Critical Issues (Immediate Action Required) 🔥
14-
15-
### 1. **Build System Failures**
16-
17-
- **Issue**: Webpack build failing with 403 TypeScript errors
18-
- **Impact**: Cannot create production builds or releases
19-
- **Task**: Fix webpack configuration to exclude test files from production build
20-
- **Effort**: ~2-4 hours
21-
22-
### 2. **Security Vulnerabilities**
23-
24-
- **Issue**: 4 high-severity vulnerabilities in dependencies
25-
- **Impact**: Security risk in development tools
26-
- **Task**: Run `yarn audit fix` and update vulnerable packages
27-
- **Effort**: ~1-2 hours
28-
29-
### 3. **Lint Formatting Issues** ✅ COMPLETED
13+
### 1. **Security Vulnerabilities** 🔥
14+
- **Issue**: 4 high-severity + 3 moderate vulnerabilities
15+
- **Task**: `yarn audit fix` and update vulnerable packages
16+
- **Effort**: 1-2 hours
3017

31-
- **Issue**: 4 Prettier formatting errors preventing clean builds
32-
- **Task**: Run `yarn lint:fix` to auto-format
33-
- **Effort**: ~5 minutes
34-
- **Status**: ✅ All formatting issues resolved
18+
### 2. **Dependency Updates**
19+
- **@types/vscode**: 1.74.0 → 1.101.0 (VSCode API access)
20+
- **vitest**: 0.34.6 → 3.2.3 (performance improvements)
21+
- **typescript**: 5.4.5 → 5.8.3 (latest features)
22+
- **Effort**: 4-6 hours
3523

36-
---
37-
38-
## Priority 2: Dependency & Security Improvements 📦
24+
### 3. **Bundle Optimization** 🚀
25+
- Current: 4.52 MiB bundle
26+
- Add webpack-bundle-analyzer
27+
- Target: < 1MB for faster loading
28+
- **Effort**: 3-4 hours
3929

40-
### 4. **Dependency Updates (Staged Approach)**
30+
### 4. **Enhanced TypeScript**
31+
- Enable strict features: `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`
32+
- **Effort**: 2-3 hours
4133

42-
- **@types/vscode**: 1.74.0 → 1.101.0 (27 versions behind - access to latest VSCode APIs)
43-
- **vitest**: 0.34.6 → 3.2.3 (major version - better performance & features)
44-
- **eslint**: 8.57.1 → 9.29.0 (major version - new rules & performance)
45-
- **typescript**: 5.4.5 → 5.8.3 (latest features & bug fixes)
46-
- **Effort**: ~4-6 hours (staged testing required)
34+
## Lower Priority
4735

48-
### 5. **Package Security Hardening**
36+
### Developer Experience
37+
- Pre-commit hooks (husky + lint-staged)
38+
- E2E testing with Playwright
39+
- **Effort**: 6-8 hours
4940

50-
- Add `yarn audit` to CI pipeline
51-
- Clean up package.json resolutions
52-
- Consider migration to pnpm for better security
53-
- **Effort**: ~2-3 hours
41+
### Architecture
42+
- Dependency injection for testability
43+
- Centralized configuration management
44+
- **Effort**: 8-12 hours
5445

5546
---
5647

57-
## Priority 3: Performance & Quality 🚀
58-
59-
### 6. **Bundle Size Optimization**
60-
61-
- Add webpack-bundle-analyzer for inspection
62-
- Implement code splitting for large dependencies
63-
- Target < 1MB bundle size for faster extension loading
64-
- **Effort**: ~3-4 hours
65-
- **Impact**: 30%+ performance improvement
66-
67-
### 7. **Enhanced TypeScript Configuration**
68-
69-
- Enable strict mode features: `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`
70-
- Add `noImplicitReturns` and `noFallthroughCasesInSwitch`
71-
- **Effort**: ~2-3 hours
72-
- **Impact**: Better type safety and developer experience
73-
74-
### 8. **Error Handling Standardization**
75-
76-
- Implement centralized error boundary pattern
77-
- Standardize error logging with structured format
78-
- Add error telemetry for production debugging
79-
- **Effort**: ~4-6 hours
80-
81-
---
82-
83-
## Priority 4: Developer Experience 🛠️
84-
85-
### 9. **Development Workflow Improvements**
86-
87-
- **Pre-commit hooks**: Add husky + lint-staged for automatic formatting
88-
- **Hot reload**: Improve development experience with faster rebuilds
89-
- **Development container**: Add devcontainer.json for consistent environment
90-
- **Effort**: ~3-4 hours
91-
- **Impact**: Significantly improved developer productivity
92-
93-
### 10. **Testing Infrastructure Enhancements**
94-
95-
- **E2E Testing**: Add Playwright for real VSCode extension testing
96-
- **Performance Benchmarks**: Track extension startup and operation performance
97-
- **Integration Tests**: Test against different Coder versions
98-
- **Effort**: ~6-8 hours
99-
- **Impact**: Higher confidence in releases
100-
101-
---
102-
103-
## Priority 5: Architecture & Design 🏗️
104-
105-
### 11. **Module Boundaries & Coupling**
106-
107-
- Implement dependency injection for better testability
108-
- Extract common interfaces and types
109-
- Reduce coupling between `remote.ts` and `commands.ts`
110-
- **Effort**: ~6-8 hours
111-
- **Impact**: Better maintainability and extensibility
112-
113-
### 12. **Configuration Management**
114-
115-
- Centralized configuration class with validation
116-
- Schema-based configuration with runtime validation
117-
- Better defaults and configuration migration support
118-
- **Effort**: ~4-5 hours
119-
120-
---
121-
122-
## Priority 6: Documentation & Observability 📚
123-
124-
### 13. **Documentation Improvements**
125-
126-
- **API Documentation**: Document internal APIs and architecture
127-
- **Development Guide**: Setup, debugging, and contribution guide
128-
- **Architecture Decision Records**: Document design decisions
129-
- **Effort**: ~4-6 hours
130-
131-
### 14. **Monitoring & Observability**
132-
133-
- Performance metrics collection
134-
- Error reporting and monitoring
135-
- Health checks for external dependencies
136-
- **Effort**: ~5-7 hours
137-
138-
---
139-
140-
## Recommended Implementation Timeline
141-
142-
### **Week 1: Critical & High-Impact (Priority 1-2)**
143-
144-
1. ⏳ Fix webpack build issues
145-
2. ⏳ Update security vulnerabilities
146-
3. ✅ Fix formatting issues - **COMPLETED**
147-
4. ⏳ Update critical dependencies (TypeScript, Vitest)
148-
149-
### **Week 2: Performance & Quality (Priority 3)**
150-
151-
1. Bundle size optimization
152-
2. Enhanced TypeScript configuration
153-
3. Error handling standardization
154-
155-
### **Week 3: Developer Experience (Priority 4)**
156-
157-
1. Pre-commit hooks and workflow improvements
158-
2. E2E testing infrastructure
159-
3. Performance benchmarking
160-
161-
### **Week 4: Architecture & Polish (Priority 5-6)**
162-
163-
1. Module boundary improvements
164-
2. Configuration management
165-
3. Documentation updates
166-
4. Monitoring setup
167-
168-
---
169-
170-
## Expected Outcomes
171-
172-
**Completing Priority 1-3 tasks will achieve:**
173-
174-
-**Build Reliability**: 100% successful builds
175-
-**Security Posture**: Elimination of known vulnerabilities
176-
-**Performance**: 30%+ faster extension loading
177-
-**Developer Experience**: Significantly improved workflow
178-
-**Code Quality**: Production-ready enterprise standards
179-
180-
**Current codebase is already excellent - these improvements will make it truly exceptional!** 🚀
48+
**Current Status**: Build system working perfectly, all tests passing. Focus on security fixes first.

eslint.config.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
const js = require("@eslint/js")
2+
const tsParser = require("@typescript-eslint/parser")
3+
const tsPlugin = require("@typescript-eslint/eslint-plugin")
4+
const prettierPlugin = require("eslint-plugin-prettier")
5+
const importPlugin = require("eslint-plugin-import")
6+
7+
module.exports = [
8+
{
9+
ignores: ["out", "dist", "**/*.d.ts", "**/*.md"]
10+
},
11+
{
12+
files: ["**/*.ts"],
13+
languageOptions: {
14+
parser: tsParser,
15+
parserOptions: {
16+
ecmaVersion: 2020,
17+
sourceType: "module",
18+
project: true
19+
},
20+
globals: {
21+
Buffer: "readonly",
22+
setTimeout: "readonly",
23+
clearTimeout: "readonly",
24+
setInterval: "readonly",
25+
clearInterval: "readonly",
26+
setImmediate: "readonly",
27+
AbortController: "readonly",
28+
URL: "readonly",
29+
URLSearchParams: "readonly",
30+
ReadableStream: "readonly",
31+
ReadableStreamDefaultController: "readonly",
32+
MessageEvent: "readonly",
33+
global: "readonly",
34+
__filename: "readonly",
35+
__dirname: "readonly",
36+
NodeJS: "readonly",
37+
Thenable: "readonly",
38+
process: "readonly",
39+
fs: "readonly",
40+
semver: "readonly"
41+
}
42+
},
43+
plugins: {
44+
"@typescript-eslint": tsPlugin,
45+
"prettier": prettierPlugin,
46+
"import": importPlugin
47+
},
48+
rules: {
49+
...js.configs.recommended.rules,
50+
...tsPlugin.configs.recommended.rules,
51+
curly: "error",
52+
eqeqeq: "error",
53+
"no-throw-literal": "error",
54+
"no-console": "error",
55+
"prettier/prettier": "error",
56+
"import/order": [
57+
"error",
58+
{
59+
alphabetize: {
60+
order: "asc"
61+
},
62+
groups: [["builtin", "external", "internal"], "parent", "sibling"]
63+
}
64+
],
65+
"import/no-unresolved": "off",
66+
"@typescript-eslint/no-unused-vars": [
67+
"error",
68+
{
69+
varsIgnorePattern: "^_"
70+
}
71+
]
72+
}
73+
}
74+
]

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,19 +288,20 @@
288288
"@types/glob": "^7.1.3",
289289
"@types/node": "^22.14.1",
290290
"@types/node-forge": "^1.3.11",
291+
"@types/semver": "^7.7.0",
291292
"@types/ua-parser-js": "0.7.36",
292293
"@types/vscode": "^1.73.0",
293294
"@types/ws": "^8.18.1",
294-
"@typescript-eslint/eslint-plugin": "^7.0.0",
295-
"@typescript-eslint/parser": "^6.21.0",
295+
"@typescript-eslint/eslint-plugin": "^8.34.0",
296+
"@typescript-eslint/parser": "^8.34.0",
296297
"@vitest/coverage-v8": "^0.34.6",
297298
"@vitest/ui": "^0.34.6",
298299
"@vscode/test-electron": "^2.5.2",
299300
"@vscode/vsce": "^2.21.1",
300301
"bufferutil": "^4.0.9",
301302
"coder": "https://github.com/coder/coder#main",
302303
"dayjs": "^1.11.13",
303-
"eslint": "^8.57.1",
304+
"eslint": "^9.29.0",
304305
"eslint-config-prettier": "^9.1.0",
305306
"eslint-plugin-import": "^2.31.0",
306307
"eslint-plugin-md": "^1.0.19",

src/remote.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class Remote {
149149
const devBinaryPath = path.join(os.tmpdir(), "coder");
150150
await fs.stat(devBinaryPath);
151151
return devBinaryPath;
152-
} catch (ex) {
152+
} catch {
153153
return await this.storage.fetchBinary(workspaceRestClient, label);
154154
}
155155
}
@@ -169,7 +169,7 @@ export class Remote {
169169
let version: semver.SemVer | null = null;
170170
try {
171171
version = semver.parse(await cli.version(binaryPath));
172-
} catch (e) {
172+
} catch {
173173
version = semver.parse(buildInfo.version);
174174
}
175175

@@ -656,7 +656,7 @@ export class Remote {
656656
this.storage.getUserSettingsPath(),
657657
"utf8",
658658
);
659-
} catch (ex) {
659+
} catch {
660660
// Ignore! It's probably because the file doesn't exist.
661661
}
662662

@@ -1081,7 +1081,7 @@ export class Remote {
10811081
const parsed = JSON.parse(content);
10821082
try {
10831083
updateStatus(parsed);
1084-
} catch (ex) {
1084+
} catch {
10851085
// Ignore
10861086
}
10871087
} catch {

src/sshConfig.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/ban-ts-comment */
21
import { it, afterEach, vi, expect } from "vitest";
32
import { SSHConfig } from "./sshConfig";
43

src/sshConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class SSHConfig {
107107
async load() {
108108
try {
109109
this.raw = await this.fileSystem.readFile(this.filePath, "utf-8");
110-
} catch (ex) {
110+
} catch {
111111
// Probably just doesn't exist!
112112
this.raw = "";
113113
}

src/sshSupport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function sshSupportsSetEnv(): boolean {
66
const spawned = childProcess.spawnSync("ssh", ["-V"]);
77
// The version string outputs to stderr.
88
return sshVersionSupportsSetEnv(spawned.stderr.toString().trim());
9-
} catch (error) {
9+
} catch {
1010
return false;
1111
}
1212
}

src/storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class Storage {
8080
public async getSessionToken(): Promise<string | undefined> {
8181
try {
8282
return await this.secrets.get("sessionToken");
83-
} catch (ex) {
83+
} catch {
8484
// The VS Code session store has become corrupt before, and
8585
// will fail to get the session token...
8686
return undefined;

src/workspacesProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class WorkspaceProvider
9393
let hadError = false;
9494
try {
9595
this.workspaces = await this.fetch();
96-
} catch (error) {
96+
} catch {
9797
hadError = true;
9898
this.workspaces = [];
9999
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy