Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .depcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright IBM Corp. 2025
# Assisted by CursorAI

# Ignore these dependencies that are used but not detected by depcheck
ignores:
# VSCode API is imported as 'vscode' but the package is '@types/vscode'
- "vscode"
# React dependencies used in webview libs (external bundles, not npm dependencies)
- "react"
- "@graphiql/react"
# Test runner used by vscode-test command but not directly imported
- "@vscode/test-electron"
# Depcheck itself is used via npx in scripts
- "depcheck"

# Ignore these patterns - webview libs are bundled separately
ignorePatterns:
- "webview/**"
- "dist/**"
- "out/**"
- "*.vsix"

# Skip missing dependencies check for known false positives
skipMissing: false

# Custom parsers for different file types
parsers:
"**/*.ts": "typescript"
"**/*.js": "es6"
"**/*.mjs": "es6"

# Detectors to use
detectors:
- "requireCallExpression"
- "importDeclaration"
- "exportDeclaration"
43 changes: 43 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright IBM Corp. 2025
# Assisted by CursorAI

name: Lint

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Check for unused exports with ts-prune
run: npm run lint:prune

- name: Check for unused dependencies with depcheck
run: npm run lint:deps

- name: Run type checking
run: npm run check-types
160 changes: 160 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,15 @@
"check-types": "tsc --noEmit",
"lint": "eslint src",
"lint:prune": "ts-prune --error",
"lint:deps": "depcheck",
"lint:all": "npm run lint && npm run lint:prune && npm run lint:deps",
"ci:lint": "npm run lint && npm run lint:prune && npm run lint:deps && npm run check-types",
"test": "vscode-test"
},
"devDependencies": {
"@types/mocha": "^10.0.10",
"@types/node": "20.x",
"@types/sinon": "^17.0.3",
"@types/vscode": "^1.100.0",
"@typescript-eslint/eslint-plugin": "^8.31.1",
"@typescript-eslint/parser": "^8.31.1",
Expand All @@ -138,7 +142,9 @@
"depcheck": "^1.4.7",
"esbuild": "^0.25.3",
"eslint": "^9.25.1",
"mocha": "^10.8.2",
"npm-run-all": "^4.1.5",
"sinon": "^19.0.2",
"ts-prune": "^0.10.3",
"typescript": "^5.8.3"
},
Expand Down
32 changes: 32 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,38 @@ npm run compile
npm run watch
```

### Code Quality & Linting

This project uses multiple linting tools to ensure code quality:

```bash
# Run ESLint for code style and best practices
npm run lint

# Check for unused TypeScript exports
npm run lint:prune

# Check for unused dependencies
npm run lint:deps

# Run type checking
npm run check-types

# Run all linting tools (used in CI)
npm run ci:lint
```

**CI Integration**: All linting tools run automatically in GitHub Actions on every push and pull request. The CI will fail if any of these tools report issues:

- **ESLint** - Enforces code style, prevents console statements, ensures proper imports
- **ts-prune** - Finds unused exports to keep the codebase clean
- **depcheck** - Identifies unused dependencies and missing dependencies

Configuration files:
- ESLint: `eslint.config.mjs`
- depcheck: `.depcheckrc`
- TypeScript: `tsconfig.json`

### Testing

The extension uses the standard VS Code testing framework with Mocha. The tests are located in the `src/test` directory. View the README.md file in that directory for more details.
Expand Down
12 changes: 0 additions & 12 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@ export let EXTENSION_URI: vscode.Uri;
export let runtimeDiag: vscode.DiagnosticCollection;


/**
* Gets or creates a terminal for StepZen operations
* @param name The name to give the terminal if creating a new one
* @returns An existing or newly created terminal instance
*/
export function getOrCreateStepZenTerminal(name: string = UI.TERMINAL_NAME): vscode.Terminal {
if (!stepzenTerminal) {
stepzenTerminal = vscode.window.createTerminal(name);
}
return stepzenTerminal;
}

/**
* Resolve the workspace folder that owns the given URI (or the active editor if none supplied).
*/
Expand Down
Loading