Skip to content

Commit 267ae02

Browse files
committed
fix linting
1 parent 778ade2 commit 267ae02

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

.github/actions/find/src/pluginManager/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,13 @@ import * as fs from 'fs'
22
import * as path from 'path'
33
import {fileURLToPath} from 'url'
44
import * as core from '@actions/core'
5-
import {
6-
loadPluginViaJsFile,
7-
loadPluginViaTsFile,
8-
} from './pluginFileLoaders.js'
9-
import type {
10-
Plugin,
11-
PluginDefaultParams
12-
} from './types.js'
13-
5+
import {loadPluginViaJsFile, loadPluginViaTsFile} from './pluginFileLoaders.js'
6+
import type {Plugin, PluginDefaultParams} from './types.js'
147

158
// Helper to get __dirname equivalent in ES Modules
169
const __filename = fileURLToPath(import.meta.url)
1710
const __dirname = path.dirname(__filename)
1811

19-
2012
// Built-in plugin names shipped with the scanner.
2113
// Used to skip duplicates when loading custom plugins.
2214
const BUILT_IN_PLUGINS = ['reflow-scan']

.github/actions/find/src/pluginManager/pluginFileLoaders.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from 'path'
33
import * as esbuild from 'esbuild'
44
import {dynamicImport} from '../dynamicImport.js'
55
import * as core from '@actions/core'
6-
import type { Plugin } from './types.js'
6+
import type {Plugin} from './types.js'
77

88
// - these functions had to be moved into a separate file
99
// because vitest will not mock the implementation of functions

.github/actions/find/tests/findForUrl.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {findForUrl} from '../src/findForUrl.js'
44
import {AxeBuilder} from '@axe-core/playwright'
55
import axe from 'axe-core'
66
import * as pluginManager from '../src/pluginManager/index.js'
7-
import type { Plugin } from '../src/pluginManager/types.js'
7+
import type {Plugin} from '../src/pluginManager/types.js'
88
import {clearCache} from '../src/scansContextProvider.js'
99

1010
vi.mock('@actions/core', {spy: true})

.github/actions/find/tests/pluginManager.test.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ describe('pluginManager', () => {
119119
vi.spyOn(pluginLoaders, 'loadPluginViaJsFile').mockImplementation(() => Promise.resolve(undefined))
120120

121121
pluginManager.clearCache()
122-
await pluginManager.loadPluginsFromPath({ pluginsPath: 'fake-path' })
122+
await pluginManager.loadPluginsFromPath({pluginsPath: 'fake-path'})
123123

124124
expect(pluginManager.getPlugins().length).toBe(0)
125-
expect(pluginLoaders.loadPluginViaJsFile).toHaveBeenCalledOnce();
126-
expect(pluginLoaders.loadPluginViaTsFile).toHaveBeenCalledOnce();
125+
expect(pluginLoaders.loadPluginViaJsFile).toHaveBeenCalledOnce()
126+
expect(pluginLoaders.loadPluginViaTsFile).toHaveBeenCalledOnce()
127127
expect(core.info.mock.calls[0][0]).toBe('Skipping plugin without index.ts or index.js file: folder-a')
128128
})
129129
})
@@ -133,14 +133,16 @@ describe('pluginManager', () => {
133133
sharedSetup()
134134
pluginManager.clearCache()
135135

136-
vi.spyOn(pluginLoaders, 'loadPluginViaTsFile').mockImplementation(() => Promise.resolve({name: 'test-plugin', default: vi.fn()}))
136+
vi.spyOn(pluginLoaders, 'loadPluginViaTsFile').mockImplementation(() =>
137+
Promise.resolve({name: 'test-plugin', default: vi.fn()}),
138+
)
137139
vi.spyOn(pluginLoaders, 'loadPluginViaJsFile').mockImplementation(() => Promise.resolve(undefined))
138140

139-
await pluginManager.loadPluginsFromPath({ pluginsPath: 'fake-path' })
141+
await pluginManager.loadPluginsFromPath({pluginsPath: 'fake-path'})
140142

141143
expect(pluginManager.getPlugins().length).toBe(1)
142-
expect(pluginLoaders.loadPluginViaJsFile).not.toHaveBeenCalled();
143-
expect(pluginLoaders.loadPluginViaTsFile).toHaveBeenCalledOnce();
144+
expect(pluginLoaders.loadPluginViaJsFile).not.toHaveBeenCalled()
145+
expect(pluginLoaders.loadPluginViaTsFile).toHaveBeenCalledOnce()
144146
expect(core.info.mock.calls[0][0]).toBe('Found plugin: test-plugin')
145147
})
146148
})
@@ -151,16 +153,17 @@ describe('pluginManager', () => {
151153
pluginManager.clearCache()
152154

153155
vi.spyOn(pluginLoaders, 'loadPluginViaTsFile').mockImplementation(() => Promise.resolve(undefined))
154-
vi.spyOn(pluginLoaders, 'loadPluginViaJsFile').mockImplementation(() => Promise.resolve({name: 'test-plugin', default: vi.fn()}))
156+
vi.spyOn(pluginLoaders, 'loadPluginViaJsFile').mockImplementation(() =>
157+
Promise.resolve({name: 'test-plugin', default: vi.fn()}),
158+
)
155159

156-
await pluginManager.loadPluginsFromPath({ pluginsPath: 'fake-path' })
160+
await pluginManager.loadPluginsFromPath({pluginsPath: 'fake-path'})
157161

158162
expect(pluginManager.getPlugins().length).toBe(1)
159-
expect(pluginLoaders.loadPluginViaJsFile).toHaveBeenCalledOnce();
160-
expect(pluginLoaders.loadPluginViaTsFile).toHaveBeenCalledOnce();
163+
expect(pluginLoaders.loadPluginViaJsFile).toHaveBeenCalledOnce()
164+
expect(pluginLoaders.loadPluginViaTsFile).toHaveBeenCalledOnce()
161165
expect(core.info.mock.calls[0][0]).toBe('Found plugin: test-plugin')
162166
})
163167
})
164168
})
165-
166169
})

0 commit comments

Comments
 (0)