Skip to content

Commit 2a91f51

Browse files
committed
chore: run prettier formatter
1 parent 93a99f5 commit 2a91f51

39 files changed

+161
-154
lines changed

build/webpack/webpack.config.base.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ const base = {
3232
// new webpack.EnvironmentPlugin({
3333
// NODE_ENV: 'production',
3434
// }),
35-
3635
],
3736
}
3837

39-
module.exports = base
38+
module.exports = base

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"start:skip-build": "cross-env SHELL_DEBUG=true DEBUG='electron-chrome-extensions*' yarn --cwd ./packages/shell start",
2121
"test": "yarn test:extensions",
2222
"test:extensions": "yarn --cwd ./packages/electron-chrome-extensions test",
23-
"prepare": "husky"
23+
"prepare": "husky",
24+
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css}\""
2425
},
2526
"license": "GPL-3.0",
2627
"author": "Samuel Maddock <[email protected]>",
@@ -41,7 +42,6 @@
4142
"prettier": {
4243
"printWidth": 100,
4344
"singleQuote": true,
44-
"jsonEnable": false,
4545
"semi": false,
4646
"endOfLine": "lf"
4747
}

packages/electron-chrome-context-menu/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ interface ChromeContextMenuOptions {
5454
openLink: (
5555
url: string,
5656
disposition: 'default' | 'foreground-tab' | 'background-tab' | 'new-window',
57-
params: Electron.ContextMenuParams
57+
params: Electron.ContextMenuParams,
5858
) => void
5959

6060
/** Chrome extension menu items. */
Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,79 @@
11
#!/usr/bin/env node
22

3-
const childProcess = require('child_process');
4-
const path = require('path');
5-
const unknownFlags = [];
3+
const childProcess = require('child_process')
4+
const path = require('path')
5+
const unknownFlags = []
66

7-
require('colors');
8-
const pass = '✓'.green;
9-
const fail = '✗'.red;
7+
require('colors')
8+
const pass = '✓'.green
9+
const fail = '✗'.red
1010

1111
const args = require('minimist')(process.argv, {
1212
string: ['target'],
13-
unknown: arg => unknownFlags.push(arg)
14-
});
13+
unknown: (arg) => unknownFlags.push(arg),
14+
})
1515

16-
const unknownArgs = [];
16+
const unknownArgs = []
1717
for (const flag of unknownFlags) {
18-
unknownArgs.push(flag);
19-
const onlyFlag = flag.replace(/^-+/, '');
18+
unknownArgs.push(flag)
19+
const onlyFlag = flag.replace(/^-+/, '')
2020
if (args[onlyFlag]) {
21-
unknownArgs.push(args[onlyFlag]);
21+
unknownArgs.push(args[onlyFlag])
2222
}
2323
}
2424

25-
async function main () {
26-
await runElectronTests();
25+
async function main() {
26+
await runElectronTests()
2727
}
2828

29-
async function runElectronTests () {
30-
const errors = [];
29+
async function runElectronTests() {
30+
const errors = []
3131

32-
const testResultsDir = process.env.ELECTRON_TEST_RESULTS_DIR;
32+
const testResultsDir = process.env.ELECTRON_TEST_RESULTS_DIR
3333

3434
try {
35-
console.info('\nRunning:');
35+
console.info('\nRunning:')
3636
if (testResultsDir) {
37-
process.env.MOCHA_FILE = path.join(testResultsDir, `test-results.xml`);
37+
process.env.MOCHA_FILE = path.join(testResultsDir, `test-results.xml`)
3838
}
39-
await runMainProcessElectronTests();
39+
await runMainProcessElectronTests()
4040
} catch (err) {
41-
errors.push([err]);
41+
errors.push([err])
4242
}
4343

4444
if (errors.length !== 0) {
4545
for (const err of errors) {
46-
console.error('\n\nRunner Failed:', err[0]);
47-
console.error(err[1]);
46+
console.error('\n\nRunner Failed:', err[0])
47+
console.error(err[1])
4848
}
49-
console.log(`${fail} Electron test runners have failed`);
50-
process.exit(1);
49+
console.log(`${fail} Electron test runners have failed`)
50+
process.exit(1)
5151
}
5252
}
5353

54-
async function runMainProcessElectronTests () {
55-
let exe = require('electron');
56-
const runnerArgs = ['spec', ...unknownArgs.slice(2)];
54+
async function runMainProcessElectronTests() {
55+
let exe = require('electron')
56+
const runnerArgs = ['spec', ...unknownArgs.slice(2)]
5757

5858
const { status, signal } = childProcess.spawnSync(exe, runnerArgs, {
5959
cwd: path.resolve(__dirname, '..'),
6060
env: process.env,
61-
stdio: 'inherit'
62-
});
61+
stdio: 'inherit',
62+
})
6363
if (status !== 0) {
6464
if (status) {
65-
const textStatus = process.platform === 'win32' ? `0x${status.toString(16)}` : status.toString();
66-
console.log(`${fail} Electron tests failed with code ${textStatus}.`);
65+
const textStatus =
66+
process.platform === 'win32' ? `0x${status.toString(16)}` : status.toString()
67+
console.log(`${fail} Electron tests failed with code ${textStatus}.`)
6768
} else {
68-
console.log(`${fail} Electron tests failed with kill signal ${signal}.`);
69+
console.log(`${fail} Electron tests failed with kill signal ${signal}.`)
6970
}
70-
process.exit(1);
71+
process.exit(1)
7172
}
72-
console.log(`${pass} Electron main process tests passed.`);
73+
console.log(`${pass} Electron main process tests passed.`)
7374
}
7475

7576
main().catch((error) => {
76-
console.error('An error occurred inside the spec runner:', error);
77-
process.exit(1);
78-
});
77+
console.error('An error occurred inside the spec runner:', error)
78+
process.exit(1)
79+
})

packages/electron-chrome-extensions/spec/chrome-browserAction-spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('chrome.browserAction', () => {
2121
partition: string,
2222
webContents: WebContents,
2323
extension: Extension,
24-
tabId: number = -1
24+
tabId: number = -1,
2525
) => {
2626
const details = {
2727
eventType: 'click',
@@ -158,7 +158,7 @@ describe('chrome.browserAction', () => {
158158
const [popup] = await popupPromise
159159
await popup.whenReady()
160160
expect(popup.browserWindow.webContents.getURL()).to.equal(
161-
`chrome-extension://${browser.extension.id}/${popupPath}`
161+
`chrome-extension://${browser.extension.id}/${popupPath}`,
162162
)
163163
})
164164
})
@@ -171,7 +171,7 @@ describe('chrome.browserAction', () => {
171171
})
172172

173173
const getExtensionActionIds = async (
174-
webContents: Electron.WebContents = browser.webContents
174+
webContents: Electron.WebContents = browser.webContents,
175175
) => {
176176
// Await update propagation to avoid flaky tests
177177
await new Promise((resolve) => setTimeout(resolve, 10))
@@ -182,7 +182,7 @@ describe('chrome.browserAction', () => {
182182
const actions = list.shadowRoot!.querySelectorAll('.action')
183183
const ids = Array.from(actions).map((elem) => elem.id)
184184
return ids
185-
}})();`
185+
}})();`,
186186
)
187187
}
188188

@@ -204,7 +204,7 @@ describe('chrome.browserAction', () => {
204204
const list = document.createElement('browser-action-list')
205205
list.setAttribute('partition', partition)
206206
document.body.appendChild(list)
207-
}})('${browser.partition}');`
207+
}})('${browser.partition}');`,
208208
)
209209

210210
const extensionIds = await getExtensionActionIds(remoteTab)

packages/electron-chrome-extensions/spec/crx-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const isBackgroundHostSupported = (extension: Electron.Extension) =>
3939

4040
export const waitForBackgroundPage = async (
4141
extension: Electron.Extension,
42-
session: Electron.Session
42+
session: Electron.Session,
4343
) => {
4444
if (!isBackgroundHostSupported(extension)) return
4545

@@ -76,7 +76,7 @@ export const waitForBackgroundPage = async (
7676

7777
export async function waitForBackgroundScriptEvaluated(
7878
extension: Electron.Extension,
79-
session: Electron.Session
79+
session: Electron.Session,
8080
) {
8181
if (!isBackgroundHostSupported(extension)) return
8282

packages/electron-chrome-extensions/spec/events-helpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const waitForEvent = (target: EventTarget, eventName: string) => {
4343
export const emittedOnce = (
4444
emitter: NodeJS.EventEmitter,
4545
eventName: string,
46-
trigger?: () => void
46+
trigger?: () => void,
4747
) => {
4848
return emittedNTimes(emitter, eventName, 1, trigger).then(([result]) => result)
4949
}
@@ -52,7 +52,7 @@ export const emittedNTimes = async (
5252
emitter: NodeJS.EventEmitter,
5353
eventName: string,
5454
times: number,
55-
trigger?: () => void
55+
trigger?: () => void,
5656
) => {
5757
const events: any[][] = []
5858
const p = new Promise<any[][]>((resolve) => {
@@ -74,7 +74,7 @@ export const emittedNTimes = async (
7474
export const emittedUntil = async (
7575
emitter: NodeJS.EventEmitter,
7676
eventName: string,
77-
untilFn: Function
77+
untilFn: Function,
7878
) => {
7979
const p = new Promise<any[]>((resolve) => {
8080
const handler = (...args: any[]) => {

packages/electron-chrome-extensions/spec/extensions-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('Extensions', () => {
66
const testSession = session.fromPartition('test-extensions')
77
const extensions = new ElectronChromeExtensions({
88
license: 'internal-license-do-not-use' as any,
9-
session: testSession
9+
session: testSession,
1010
})
1111

1212
it('retrieves the instance with fromSession()', () => {

packages/electron-chrome-extensions/spec/fixtures/chrome-browserAction-popup/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"manifest_version": 2,
55
"browser_action": {
66
"default_icon": {
7-
"16": "icon_16.png",
8-
"32": "icon_32.png"
7+
"16": "icon_16.png",
8+
"32": "icon_32.png"
99
},
1010
"default_popup": "popup.html",
1111
"default_title": "browserAction Popup"
12-
}
12+
}
1313
}

packages/electron-chrome-extensions/spec/fixtures/chrome-webNavigation/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const logEvent = (eventName) => {
1919
if (eventName) eventLog.push(eventName)
2020
if (typeof activeTabId === 'undefined') return
2121

22-
eventLog.forEach(eventName => {
22+
eventLog.forEach((eventName) => {
2323
chrome.tabs.sendMessage(activeTabId, { name: 'logEvent', args: eventName })
2424
})
2525

0 commit comments

Comments
 (0)