Migrate all samples to eslint 9

Switches all samples to use eslint 9 with flat configs. I've tried to migrate existing settings as much as possible. However our eslint configs were also inconsistent so I've tried to align these too
This commit is contained in:
Matt Bierner
2024-10-26 17:44:03 -07:00
parent 7ce43a47d7
commit 73e249b3c1
403 changed files with 74894 additions and 51564 deletions

View File

@ -133,7 +133,7 @@ export class Controller implements IController {
private _isInComposition = false;
private _composingText = '';
public compositionStart(editor: TextEditor): void {
public compositionStart(_editor: TextEditor): void {
this._isInComposition = true;
this._composingText = '';
}

View File

@ -13,7 +13,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand(commandId, run));
}
function registerCtrlKeyBinding(key: string): void {
registerCommandNice(key, function(args) {
registerCommandNice(key, function() {
if (!vscode.window.activeTextEditor) {
return;
}
@ -35,22 +35,22 @@ export function activate(context: vscode.ExtensionContext) {
}
vimExt.replacePrevChar(args.text, args.replaceCharCnt);
});
registerCommandNice('compositionStart', function(args) {
registerCommandNice('compositionStart', function() {
if (!vscode.window.activeTextEditor) {
return;
}
vimExt.compositionStart();
});
registerCommandNice('compositionEnd', function(args) {
registerCommandNice('compositionEnd', function() {
if (!vscode.window.activeTextEditor) {
return;
}
vimExt.compositionEnd();
});
registerCommandNice('vim.goToNormalMode', function(args) {
registerCommandNice('vim.goToNormalMode', function() {
vimExt.goToNormalMode();
});
registerCommandNice('vim.clearInput', function(args) {
registerCommandNice('vim.clearInput', function() {
vimExt.clearInput();
});
// registerCommandNice('paste', function(args) {

View File

@ -8,7 +8,7 @@ import { Motion, Motions } from './motions';
import { Operator, Operators } from './operators';
import { IController, Command, AbstractCommandDescriptor, ModifierKeys } from './common';
const CHAR_TO_BINDING: { [char: string]: any; } = {};
const CHAR_TO_BINDING: Record<string, any> = {};
function defineBinding(char: string, value: any, modifierKeys: ModifierKeys): void {
const key = modifierKeys.ctrl ? 'CTRL + ' + char : char;
CHAR_TO_BINDING[key] = value;

View File

@ -52,7 +52,7 @@ class RepeatingMotion extends Motion {
}
class NextCharacterMotion extends Motion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
public run(doc: TextDocument, pos: Position, _state: MotionState): Position {
if (pos.character === doc.lineAt(pos.line).text.length) {
// on last character
return ((pos.line + 1 < doc.lineCount) ? new Position(pos.line + 1, 0) : pos);
@ -62,8 +62,9 @@ class NextCharacterMotion extends Motion {
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
class LeftMotion extends Motion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
public run(_doc: TextDocument, pos: Position, state: MotionState): Position {
const line = pos.line;
if (pos.character > 0) {
@ -75,6 +76,7 @@ class LeftMotion extends Motion {
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
class DownMotion extends Motion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
let line = pos.line;
@ -90,6 +92,7 @@ class DownMotion extends Motion {
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
class UpMotion extends Motion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
let line = pos.line;
@ -120,13 +123,13 @@ class RightMotion extends Motion {
}
class EndOfLineMotion extends Motion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
public run(doc: TextDocument, pos: Position, _state: MotionState): Position {
return new Position(pos.line, doc.lineAt(pos.line).text.length);
}
}
class StartOfLineMotion extends Motion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
public run(_doc: TextDocument, pos: Position, _state: MotionState): Position {
return new Position(pos.line, 0);
}
}
@ -186,7 +189,7 @@ class NextWordEndMotion extends Motion {
}
class GoToLineUndefinedMotion extends Motion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
public run(_doc: TextDocument, pos: Position, _state: MotionState): Position {
// does not do anything
return pos;
}
@ -217,13 +220,13 @@ abstract class GoToLineMotion extends Motion {
}
class GoToFirstLineMotion extends GoToLineMotion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
public run(doc: TextDocument, _pos: Position, _state: MotionState): Position {
return new Position(0, this.firstNonWhitespaceChar(doc, 0));
}
}
class GoToLastLineMotion extends GoToLineMotion {
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
public run(doc: TextDocument, _pos: Position, _state: MotionState): Position {
const lastLine = doc.lineCount - 1;
return new Position(lastLine, this.firstNonWhitespaceChar(doc, lastLine));
}
@ -237,7 +240,7 @@ class GoToLineDefinedMotion extends GoToLineMotion {
this._lineNumber = lineNumber;
}
public run(doc: TextDocument, pos: Position, state: MotionState): Position {
public run(doc: TextDocument, _pos: Position, _state: MotionState): Position {
const line = Math.min(doc.lineCount - 1, Math.max(0, this._lineNumber - 1));
return new Position(line, this.firstNonWhitespaceChar(doc, line));
}
@ -289,7 +292,7 @@ class RevealCurrentLineCommand extends AbstractCommandDescriptor {
super();
}
public createCommand(args?: any): Command {
public createCommand(_args?: any): Command {
const lineNumber = window.activeTextEditor.selection.start.line;
const revealLineArgs: any = {
lineNumber,

View File

@ -38,11 +38,11 @@ export abstract class Operator {
}
abstract class OperatorWithNoArgs extends Operator {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
public runNormalMode(ctrl: IController, ed: TextEditor, _repeatCount: number, _args: string): boolean {
this._run(ctrl, ed);
return true;
}
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
public runVisualMode(ctrl: IController, ed: TextEditor, _args: string): boolean {
this._run(ctrl, ed);
return true;
}
@ -50,7 +50,7 @@ abstract class OperatorWithNoArgs extends Operator {
}
class InsertOperator extends OperatorWithNoArgs {
protected _run(ctrl: IController, ed: TextEditor): void {
protected _run(ctrl: IController, _ed: TextEditor): void {
ctrl.setMode(Mode.INSERT);
}
}
@ -79,7 +79,7 @@ class VisualOperator extends OperatorWithNoArgs {
}
class DeleteCharUnderCursorOperator extends Operator {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, _args: string): boolean {
const to = Motions.NextCharacter.repeat(repeatCount > 1, repeatCount).run(this.doc(ed), this.pos(ed), ctrl.motionState);
const from = this.pos(ed);
@ -88,7 +88,7 @@ class DeleteCharUnderCursorOperator extends Operator {
return true;
}
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
public runVisualMode(ctrl: IController, ed: TextEditor, _args: string): boolean {
const sel = this.sel(ed);
this.delete(ctrl, ed, false, sel);
return true;
@ -96,7 +96,7 @@ class DeleteCharUnderCursorOperator extends Operator {
}
class DeleteLineOperator extends Operator {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, _args: string): boolean {
const pos = this.pos(ed);
const doc = this.doc(ed);
@ -122,7 +122,7 @@ class DeleteLineOperator extends Operator {
return true;
}
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
public runVisualMode(ctrl: IController, ed: TextEditor, _args: string): boolean {
const sel = this.sel(ed);
this.delete(ctrl, ed, false, sel);
return true;
@ -168,7 +168,7 @@ class DeleteToOperator extends OperatorWithMotion {
return true;
}
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
public runVisualMode(ctrl: IController, ed: TextEditor, _args: string): boolean {
const sel = this.sel(ed);
this.delete(ctrl, ed, false, sel);
return true;
@ -177,7 +177,7 @@ class DeleteToOperator extends OperatorWithMotion {
class PutOperator extends Operator {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, _args: string): boolean {
const register = ctrl.getDeleteRegister();
if (!register) {
// No delete register - beep!!
@ -212,7 +212,7 @@ class PutOperator extends Operator {
return true;
}
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
public runVisualMode(ctrl: IController, ed: TextEditor, _args: string): boolean {
const register = ctrl.getDeleteRegister();
if (!register) {
// No delete register - beep!!
@ -232,7 +232,7 @@ class PutOperator extends Operator {
class ReplaceOperator extends Operator {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
public runNormalMode(_ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
if (args.length === 0) {
// input not ready
return false;
@ -253,7 +253,7 @@ class ReplaceOperator extends Operator {
return true;
}
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
public runVisualMode(_ctrl: IController, ed: TextEditor, args: string): boolean {
if (args.length === 0) {
// input not ready
return false;
@ -283,12 +283,12 @@ class ReplaceOperator extends Operator {
class ReplaceModeOperator extends Operator {
public runNormalMode(ctrl: IController, ed: TextEditor, repeatCount: number, args: string): boolean {
public runNormalMode(ctrl: IController, _ed: TextEditor, _repeatCount: number, _args: string): boolean {
ctrl.setMode(Mode.REPLACE);
return true;
}
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
public runVisualMode(ctrl: IController, ed: TextEditor, _args: string): boolean {
this.delete(ctrl, ed, false, this.sel(ed));
ctrl.setMode(Mode.INSERT);
return true;
@ -309,7 +309,7 @@ class ChangeOperator extends OperatorWithMotion {
return true;
}
public runVisualMode(ctrl: IController, ed: TextEditor, args: string): boolean {
public runVisualMode(ctrl: IController, ed: TextEditor, _args: string): boolean {
const sel = this.sel(ed);
this.delete(ctrl, ed, false, sel);