Skip to content

Commit 2a3a7c1

Browse files
committed
Tighten up eslintrc slightly
1 parent 7139de3 commit 2a3a7c1

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

.eslintrc.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ module.exports = {
5454
'@typescript-eslint/no-implied-eval': 'error',
5555
'@typescript-eslint/no-loss-of-precision': 'error',
5656
'@typescript-eslint/no-misused-new': 'error',
57-
// ignore the rule to conform to current code
58-
'@typescript-eslint/no-misused-promises': 'off',
57+
'@typescript-eslint/no-misused-promises': [
58+
'error',
59+
{
60+
checksVoidReturn: false, // TODO
61+
},
62+
],
5963
'@typescript-eslint/no-namespace': 'error',
6064
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
6165
'@typescript-eslint/parameter-properties': 'error',
@@ -73,8 +77,6 @@ module.exports = {
7377
'@typescript-eslint/no-unsafe-assignment': 'error',
7478
'@typescript-eslint/no-unsafe-call': 'error',
7579
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
76-
// ignore the rule to conform to current code
77-
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
7880
'@typescript-eslint/no-unsafe-member-access': 'error',
7981
'@typescript-eslint/no-unsafe-return': 'error',
8082
'@typescript-eslint/no-unused-expressions': 'error',

src/actions/commands/actions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,9 @@ export class CommandShowSearchHistory extends BaseCommand {
685685

686686
if (!nextMatch) {
687687
throw VimError.fromCode(
688-
this.direction > 0 ? ErrorCode.SearchHitBottom : ErrorCode.SearchHitTop,
688+
this.direction === SearchDirection.Forward
689+
? ErrorCode.SearchHitBottom
690+
: ErrorCode.SearchHitTop,
689691
searchState.searchString,
690692
);
691693
}

src/common/number/numericString.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export class NumericString {
162162

163163
public toString(): string {
164164
// For decreased octal and hexadecimal
165-
if (this.radix !== 10) {
165+
if (this.radix !== NumericStringRadix.Dec) {
166166
const max = 0xffffffff;
167167
while (this.value < 0) {
168168
this.value = max + this.value + 1;
@@ -176,7 +176,7 @@ export class NumericString {
176176
num = num.toUpperCase();
177177
}
178178
// numLength of decimal *should not* be preserved.
179-
if (this.radix !== 10) {
179+
if (this.radix !== NumericStringRadix.Dec) {
180180
const diff = this.numLength - num.length;
181181
if (diff > 0) {
182182
// Preserve num length if it's narrower.

src/error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ export const ErrorMessage: IErrorMessage = {
167167
};
168168

169169
export class VimError extends Error {
170-
public readonly code: number;
170+
public readonly code: ErrorCode;
171171
public override readonly message: string;
172172

173-
private constructor(code: number, message: string) {
173+
private constructor(code: ErrorCode, message: string) {
174174
super();
175175
this.code = code;
176176
this.message = message;

src/mode/modeHandler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
459459
Logger.debug(`Handling key: ${printableKey}`);
460460

461461
if (
462+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
462463
(key === SpecialKeys.TimeoutFinished ||
463464
this.vimState.recordedState.bufferedKeys.length > 0) &&
464465
this.vimState.recordedState.bufferedKeysTimeoutObj
@@ -537,6 +538,7 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
537538
this.vimState.recordedState.allowPotentialRemapOnFirstKey = true;
538539

539540
if (!handledAsRemap) {
541+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
540542
if (key === SpecialKeys.TimeoutFinished) {
541543
// Remove the <TimeoutFinished> key and get the key before that. If the <TimeoutFinished>
542544
// key was the last key, then 'key' will be undefined and won't be sent to handle action.

test/testUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export async function replaceContent(
219219
): Promise<void> {
220220
const edit = new vscode.WorkspaceEdit();
221221
edit.replace(document.uri, TextEditor.getDocumentRange(document), content);
222-
const isApplied = vscode.workspace.applyEdit(edit);
222+
const isApplied = await vscode.workspace.applyEdit(edit);
223223

224224
if (!isApplied) throw new Error(`Failed to replace content`);
225225
}

0 commit comments

Comments
 (0)