Skip to content

Commit c05602d

Browse files
committed
chore: adding eslint
1 parent 631fa0a commit c05602d

File tree

10 files changed

+181
-234
lines changed

10 files changed

+181
-234
lines changed

eslint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
5+
6+
export default tseslint.config(
7+
eslint.configs.recommended,
8+
tseslint.configs.recommended,
9+
);

lib/commands/extension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ type KeyAction = {
9494
down?: boolean,
9595
}
9696

97+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9798
export async function execute(this: NovaWindowsDriver, script: string, args: any[]) {
9899
if (script.startsWith(PLATFORM_COMMAND_PREFIX)) {
99100
script = script.replace(PLATFORM_COMMAND_PREFIX, '').trim();

lib/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type Commands = {
2222
};
2323

2424
declare module '../driver' {
25+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
2526
interface NovaWindowsDriver extends Commands {}
2627
}
2728

lib/commands/powershell.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ export async function startPowerShellSession(this: NovaWindowsDriver): Promise<v
1515
powerShell.stdout.setEncoding('utf8');
1616
powerShell.stdout.setEncoding('utf8');
1717

18+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1819
powerShell.stdout.on('data', (chunk: any) => {
1920
this.powerShellStdOut += chunk.toString();
2021
});
2122

23+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2224
powerShell.stderr.on('data', (chunk: any) => {
2325
this.powerShellStdErr += chunk.toString();
2426
});
@@ -86,6 +88,7 @@ export async function sendPowerShellCommand(this: NovaWindowsDriver, command: st
8688
powerShell.stdin.write(`${command}\n`);
8789
powerShell.stdin.write(/* ps1 */ `Write-Output $([char]0x${magicNumber.toString(16)})\n`);
8890

91+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8992
const onData: Parameters<typeof powerShell.stdout.on>[1] = ((chunk: any) => {
9093
const magicChar = String.fromCharCode(magicNumber);
9194
if (chunk.toString().includes(magicChar)) {

lib/enums.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] exte
44

55
type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>> | T
66

7+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
78
type AllFlagsValue<N extends number, A extends any[] = []> = [N] extends [Partial<A>['length']] ? A['length'] : UnionFlags<N, [0, ...A, ...A]>;
9+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
810
type UnionFlags<N extends number, A extends any[] = []> = IntRange<0, AllFlagsValue<N, A>>;
911

1012
export type Enum<T> = T[keyof T];

lib/powershell/conditions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ export class FalseCondition extends Condition {
162162
}
163163
}
164164

165+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
165166
function assertPSObjectType(obj: PSObject, type: new (...args: any[]) => PSObject) {
166167
if (!(obj instanceof type)) {
167168
throw new errors.InvalidArgumentError(`Property expected type ${type.name} but got ${(obj as object)?.constructor.name}.`);

lib/powershell/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export function pwsh(strings: TemplateStringsArray, ...values: string[]): string
2020
export function pwsh$(literals: TemplateStringsArray, ...substitutions: number[]) {
2121
const templateInstance = $(literals, ...substitutions);
2222
const defaultFormat = templateInstance.format.bind(templateInstance);
23+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2324
templateInstance.format = (...args: any[]) => {
2425
const command = defaultFormat(...args);
2526
return /* ps1 */ `(Invoke-Expression -Command ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${btoa(command)}'))))`;

lib/util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class DeferredStringTemplate {
4141
});
4242
}
4343

44+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4445
format(...args: any[]): string {
4546
const out: string[] = [];
4647
for (let i = 0, k = 0; i < this.literals.length; i++, k++) {

0 commit comments

Comments
 (0)