Skip to content

Commit a19b68f

Browse files
committed
Eslint cleanup
1 parent a1e3b5f commit a19b68f

File tree

13 files changed

+1595
-1812
lines changed

13 files changed

+1595
-1812
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

eslint.config.cjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ const importPlugin = require('eslint-plugin-import')
55
const unicorn = require('eslint-plugin-unicorn')
66

77
module.exports = [
8+
{
9+
ignores: ['node_modules/**', '**/dist/**'],
10+
},
811
// Base JS config
912
{
1013
...js.configs.recommended,
@@ -39,9 +42,7 @@ module.exports = [
3942
'require-atomic-updates': 0,
4043
'linebreak-style': ['error', 'unix'],
4144
'import/extensions': ['error', 'ignorePackages'],
42-
'no-restricted-syntax': ['error', 'IfStatement > ExpressionStatement > AssignmentExpression'],
43-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
44-
45+
'no-restricted-syntax': ['error', 'IfStatement > ExpressionStatement > AssignmentExpression']
4546
},
4647
},
4748

@@ -55,15 +56,15 @@ module.exports = [
5556
parser: tsParser,
5657
},
5758
rules: {
58-
'no-unused-vars': 'off',
59-
'@typescript-eslint/no-unused-vars': 'error',
59+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
6060
'@typescript-eslint/consistent-type-imports': 'error',
61+
'no-unused-vars': 'off',
6162
'no-undef': 'off',
6263
'no-redeclare': 'off',
6364
},
6465
},
6566

66-
// Test files
67+
// TypeScript test files
6768
{
6869
files: ['**/*.test.ts'],
6970
rules: {

packages/app/src/components/sidebar/test-suite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class ExplorerTestEntry extends CollapseableEntry {
7575
}
7676

7777
#viewSource() {
78-
if (!this.callSource) return
78+
if (!this.callSource) {return}
7979
window.dispatchEvent(new CustomEvent('app-source-highlight', {
8080
detail: this.callSource
8181
}))

packages/app/src/components/workbench/list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export class DevtoolsList extends Element {
8787
render () {
8888
const isArrayList = Array.isArray(this.list)
8989

90-
if (this.list == null) return null
91-
if (isArrayList && (this.list as unknown[]).length === 0) return null
92-
if (!isArrayList && Object.keys(this.list as Record<string, unknown>).length === 0) return null
90+
if (this.list === null) {return null}
91+
if (isArrayList && (this.list as unknown[]).length === 0) {return null}
92+
if (!isArrayList && Object.keys(this.list as Record<string, unknown>).length === 0) {return null}
9393

9494
const entries: unknown[] | [string, unknown][] = isArrayList
9595
? (this.list as unknown[])

packages/app/src/components/workbench/source.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ export class DevtoolsSource extends Element {
4141
}
4242

4343
#renderEditor (filePath: string, highlightLine?: number) {
44-
if (!this.sources) return
44+
if (!this.sources) {return}
4545
const source = this.sources[filePath]
46-
if (!source) return
46+
if (!source) {return}
4747

4848
const container = this.shadowRoot?.querySelector('section') || this.shadowRoot?.querySelector('.cm-editor')
49-
if (!container) return
49+
if (!container) {return}
5050

5151
const opts: EditorViewConfig = {
5252
root: this.shadowRoot!,

packages/app/src/controller/DataManager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ export class DataManagerController implements ReactiveController {
141141
...this.consoleLogsContextProvider.value,
142142
...data as string[]
143143
])
144-
}
145-
else if (scope === 'sources') {
144+
} else if (scope === 'sources') {
146145
const merged = {
147146
...(this.sourcesContextProvider.value || {}),
148147
...(data as Record<string, string>)

packages/app/src/utils/DragController.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ export class DragController implements ReactiveController {
108108
#setPosition(x: number, y: number) {
109109
if (this.#options.direction === Direction.horizontal) {
110110
let nx = Math.max(x, this.#options.minPosition || 0)
111-
if (this.#options.maxPosition !== undefined) nx = Math.min(nx, this.#options.maxPosition)
111+
if (this.#options.maxPosition !== undefined) {nx = Math.min(nx, this.#options.maxPosition)}
112112
this.#x = nx
113113
} else {
114114
let ny = Math.max(y, this.#options.minPosition || 0)
115-
if (this.#options.maxPosition !== undefined) ny = Math.min(ny, this.#options.maxPosition)
115+
if (this.#options.maxPosition !== undefined) {ny = Math.min(ny, this.#options.maxPosition)}
116116
this.#y = ny
117117
}
118118
}
@@ -236,7 +236,7 @@ export class DragController implements ReactiveController {
236236

237237
async #maybeReinit() {
238238
const draggableEl = await this.#getDraggableEl()
239-
if (!draggableEl) return
239+
if (!draggableEl) {return}
240240
// if slider was removed (collapsed) and re-added, re-init pointer tracker
241241
if (this.#draggableEl !== draggableEl) {
242242
this.#draggableEl = draggableEl as HTMLElement

packages/backend/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export async function getDevtoolsApp () {
66
try {
77
const appPkg = await resolve('@wdio/devtools-app', import.meta.url)
88
return path.resolve(url.fileURLToPath(appPkg), '..', '..', 'dist')
9-
} catch (err) {
9+
} catch {
1010
throw new Error('Couldn\'t find @wdio/devtools-app package, do you have it installed?')
1111
}
1212
}

packages/service/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default class DevToolsHookService implements Services.ServiceInstance {
7878
#commandStack: string[] = []
7979

8080
// This is used to capture the last command signature to avoid duplicate captures
81-
#lastCommandSig: string | null = null;
81+
#lastCommandSig: string | null = null
8282

8383
/**
8484
* allows to define the type of data being captured to hint the
@@ -183,18 +183,18 @@ export default class DevToolsHookService implements Services.ServiceInstance {
183183
command,
184184
args,
185185
src: source.getFileName() + ':' + source.getLineNumber()
186-
});
186+
})
187187

188188
if (this.#lastCommandSig !== cmdSig) {
189-
this.#commandStack.push(command);
190-
this.#lastCommandSig = cmdSig;
189+
this.#commandStack.push(command)
190+
this.#lastCommandSig = cmdSig
191191
}
192192
}
193193
}
194194

195195
afterCommand(command: keyof WebDriverCommands, args: any[], result: any, error?: Error) {
196196
// Skip bookkeeping for internal injection calls
197-
if (this.#injecting) return
197+
if (this.#injecting) {return}
198198

199199
/* Ensure that the command is captured only if it matches the last command in the stack.
200200
* This prevents capturing commands that are not top-level user commands.
@@ -243,8 +243,8 @@ export default class DevToolsHookService implements Services.ServiceInstance {
243243
}
244244

245245
async #ensureInjected(reason: string) {
246-
if (!this.#browser) return
247-
if (this.#injecting) return
246+
if (!this.#browser) {return}
247+
if (this.#injecting) {return}
248248
try {
249249
this.#injecting = true
250250
// Cheap marker check (no heavy stack work)

packages/service/src/launcher.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@ export class DevToolsAppLauncher {
4545
async onComplete () {
4646
if (this.#browser) {
4747
logger.setLevel('devtools', 'warn')
48-
log.info('Please close the browser window to finish...');
48+
log.info('Please close the browser window to finish...')
4949
while (true) {
5050
try {
51-
await this.#browser.getTitle();
52-
await new Promise(res => setTimeout(res, 1000));
53-
} catch (e) {
54-
log.info('Browser window closed, stopping DevTools app');
55-
break;
51+
await this.#browser.getTitle()
52+
await new Promise(res => setTimeout(res, 1000))
53+
} catch {
54+
log.info('Browser window closed, stopping DevTools app')
55+
break
5656
}
5757
}
5858
try {
59-
await this.#browser.deleteSession();
59+
await this.#browser.deleteSession()
6060
} catch (err: any) {
61-
log.warn('Session already closed or could not be deleted:', err.message);
61+
log.warn('Session already closed or could not be deleted:', err.message)
6262
}
6363
}
6464
}

0 commit comments

Comments
 (0)