Skip to content

Commit c93ccf9

Browse files
committed
fix: typing
1 parent d0b248e commit c93ccf9

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@
153153
"coc.nvim": "^0.0.80"
154154
},
155155
"devDependencies": {
156+
"@commitlint/cli": "^13.1.0",
157+
"@commitlint/config-conventional": "^13.1.0",
156158
"@luma-dev/eslint-config-base": "^0.5.0",
157159
"@luma-dev/eslint-config-jest": "^0.2.3",
158160
"@luma-dev/prettier-config": "^0.1.0",
@@ -167,16 +169,14 @@
167169
"@types/jest": "^27.0.1",
168170
"@types/node": "10.12.0",
169171
"better-typescript-lib": "^1.1.0",
172+
"commitlint": "^13.1.0",
170173
"deep-equal": "^2.0.5",
171174
"esbuild": "^0.12.28",
172175
"esbuild-node-externals": "^1.3.0",
173176
"eslint": "^7.32.0",
174177
"husky": "^7.0.2",
175178
"jest": "^27.2.0",
176179
"npm-run-all": "^4.1.5",
177-
"@commitlint/cli": "^13.1.0",
178-
"@commitlint/config-conventional": "^13.1.0",
179-
"commitlint": "^13.1.0",
180180
"onchange": "^7.1.0",
181181
"prettier": "^2.4.0",
182182
"semantic-release": "^17.4.7",

src/entrypoints/coc.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable import/prefer-default-export */
22
import type { ExtensionContext } from 'coc.nvim';
33
import { workspace, commands } from 'coc.nvim';
4-
import assert from 'assert';
54
import { autoInitializeWorkspace, manualInitializeWorkspace } from '../commands';
65
import { EXTENSION_NS, getSettings } from '../settings';
76

@@ -21,7 +20,7 @@ const initialize = async (_context: ExtensionContext): Promise<void> => {
2120
export const activate = async (context: ExtensionContext): Promise<void> => {
2221
// Setup vim runtime settings as vim plugin.
2322
const rtp = await workspace.nvim.getOption('runtimepath');
24-
assert(typeof rtp === 'string');
23+
if (typeof rtp !== 'string') throw new Error('[coc-tsdetect] Failed to get runtimepath.');
2524
const paths = rtp.split(',');
2625
if (!paths.includes(context.extensionPath)) {
2726
await workspace.nvim.command(`execute 'noautocmd set runtimepath^='.fnameescape('${context.extensionPath}')`);

src/settings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { workspace } from 'coc.nvim';
2-
import assert from 'assert';
32

43
export const EXTENSION_NS = 'tsdetect';
54

@@ -23,8 +22,9 @@ export const getSettings = (): Settings => {
2322
const result: any = Object.create(null);
2423
settingsKeys.forEach((key) => {
2524
const value = settings.inspect(key);
26-
assert(value);
27-
result[key] = value.workspaceValue ?? value.globalValue ?? value.defaultValue;
25+
if (value) {
26+
result[key] = value.workspaceValue ?? value.globalValue ?? value.defaultValue;
27+
}
2828
});
2929
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
3030
return result;

0 commit comments

Comments
 (0)