Skip to content

Commit

Permalink
refactor(vscode): run TypeScript compiler on the extension
Browse files Browse the repository at this point in the history
As part of the linting step, run the `tsc` TypeScript compiler on the
code base to ensure the type usage is actually correct, as esbuild only
strips type information.

Also, apply the default tsconfig.json from fresh Bun projects (`bun
init`).
  • Loading branch information
dnaka91 committed Mar 5, 2024
1 parent dda49f6 commit d926afa
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
Binary file modified bun.lockb
Binary file not shown.
9 changes: 5 additions & 4 deletions vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,24 +230,25 @@
"esbuild": "esbuild src/extension.ts --outfile=dist/extension.js --external:vscode --format=cjs --platform=node --bundle",
"watch": "bun run esbuild --watch",
"build": "bun run esbuild --minify",
"lint": "biome check --apply src/*.ts",
"lint": "tsc && biome check --apply src/*.ts",
"schemas": "js-yaml schemas/mabo.yaml > schemas/mabo.json",
"syntaxes": "js-yaml syntaxes/mabo.tmLanguage.yaml > syntaxes/mabo.tmLanguage.json",
"vscode:prepublish": "bun run schemas && bun run syntaxes && bun run build",
"package": "vsce package"
},
"engines": {
"node": ">=21",
"vscode": "^1.86.0"
"vscode": "^1.82.0"
},
"dependencies": {
"vscode-languageclient": "^9.0.1"
},
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@types/vscode": "~1.86.0",
"@types/vscode": "~1.82.0",
"@vscode/vsce": "~2.24.0",
"esbuild": "^0.20.1",
"js-yaml": "^4.1.0"
"js-yaml": "^4.1.0",
"typescript": "^5.3.3"
}
}
8 changes: 4 additions & 4 deletions vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ExtensionContext, commands, workspace } from "vscode";
import { type ExtensionContext, commands, workspace } from "vscode";
import {
Executable,
type Executable,
LanguageClient,
LanguageClientOptions,
ServerOptions,
type LanguageClientOptions,
type ServerOptions,
TransportKind,
} from "vscode-languageclient/node";

Expand Down
27 changes: 27 additions & 0 deletions vscode-extension/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,

// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,

// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}

0 comments on commit d926afa

Please sign in to comment.