Skip to content

Commit 209030a

Browse files
committed
Apply Prettier 3.0 formatter
1 parent 6395e8c commit 209030a

File tree

11 files changed

+47
-44
lines changed

11 files changed

+47
-44
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
"eslint": "~8.56.0",
6565
"eslint-import-resolver-webpack": "~0.13.8",
6666
"eslint-plugin-import": "~2.29.1",
67-
"prettier": "~3.1.1",
6867
"webpack": "~5.89.0",
68+
"prettier": "~3.2.4",
6969
"webpack-cli": "~5.1.4"
7070
}
7171
}

src/home.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ async function listenIDECommands(callback) {
9494
if (msg.type === 'success' && msg.payload.result.method) {
9595
const result = await callback(
9696
msg.payload.result.method,
97-
msg.payload.result.params
97+
msg.payload.result.params,
9898
);
9999
ws.send(
100100
JSON.stringify(
101101
jsonrpc.request(Math.random().toString(), 'ide.on_command_result', [
102102
msg.payload.result.id,
103103
result,
104-
])
105-
)
104+
]),
105+
),
106106
);
107107
} else if (msg.type === 'error') {
108108
console.error('Errored WS result: ', msg.payload);
@@ -111,7 +111,7 @@ async function listenIDECommands(callback) {
111111
console.error('Invalid RPC message: ', err);
112112
}
113113
ws.send(
114-
JSON.stringify(jsonrpc.request(Math.random().toString(), 'ide.listen_commands'))
114+
JSON.stringify(jsonrpc.request(Math.random().toString(), 'ide.listen_commands')),
115115
);
116116
});
117117
}
@@ -124,7 +124,7 @@ async function isPortUsed(port, host) {
124124
},
125125
() => {
126126
return resolve(false);
127-
}
127+
},
128128
);
129129
});
130130
}
@@ -133,7 +133,7 @@ async function findFreePort() {
133133
let attemptNums = 0;
134134
while (attemptNums < 13) {
135135
const port = Math.floor(
136-
Math.random() * (HTTP_PORT_MAX - HTTP_PORT_MIN) + HTTP_PORT_MIN
136+
Math.random() * (HTTP_PORT_MAX - HTTP_PORT_MIN) + HTTP_PORT_MIN,
137137
);
138138
if (!(await isPortUsed(port, _HTTP_HOST))) {
139139
return port;
@@ -179,7 +179,7 @@ async function _ensureServerStarted(options = {}) {
179179
await new Promise((resolve, reject) => {
180180
const timeoutID = setTimeout(
181181
() => reject(new Error('Could not start PIO Home server: Timeout error')),
182-
SERVER_LAUNCH_TIMEOUT * 1000
182+
SERVER_LAUNCH_TIMEOUT * 1000,
183183
);
184184
let output = '';
185185
runPIOCommand(
@@ -209,7 +209,7 @@ async function _ensureServerStarted(options = {}) {
209209
resolve(true);
210210
}
211211
},
212-
}
212+
},
213213
);
214214
});
215215
}
@@ -240,10 +240,10 @@ export async function shutdownAllServers() {
240240
try {
241241
got(
242242
constructServerUrl({ port, includeSID: false, query: { __shutdown__: '1' } }),
243-
{ timeout: 1000, throwHttpErrors: false }
243+
{ timeout: 1000, throwHttpErrors: false },
244244
).then(
245245
() => {},
246-
() => {}
246+
() => {},
247247
);
248248
} catch (err) {}
249249
port++;
@@ -254,7 +254,7 @@ export async function shutdownAllServers() {
254254
function loadState() {
255255
try {
256256
return JSON.parse(
257-
fs.readFileSync(path.join(getCoreDir(), 'homestate.json'), { encoding: 'utf-8' })
257+
fs.readFileSync(path.join(getCoreDir(), 'homestate.json'), { encoding: 'utf-8' }),
258258
);
259259
} catch (err) {}
260260
}

src/installer/get-platformio.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/installer/get-python.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export async function installPortablePython(destinationDir, options = undefined)
151151
const archivePath = await downloadRegistryFile(
152152
registryFile,
153153
core.getTmpDir(),
154-
options
154+
options,
155155
);
156156
if (!archivePath) {
157157
throw new Error('Could not download portable Python');
@@ -178,10 +178,10 @@ async function getRegistryFile() {
178178
https: {
179179
certificateAuthority: HTTPS_CA_CERTIFICATES,
180180
},
181-
}
181+
},
182182
).json();
183183
const versions = data.versions.filter((version) =>
184-
isVersionSystemCompatible(version, systype)
184+
isVersionSystemCompatible(version, systype),
185185
);
186186
let bestVersion = undefined;
187187
for (const version of versions) {
@@ -233,7 +233,7 @@ async function downloadRegistryFile(regfile, destinationDir, options = undefined
233233
}
234234

235235
for await (const { url, checksum } of registryFileMirrorIterator(
236-
regfile.download_url
236+
regfile.download_url,
237237
)) {
238238
archivePath = path.join(destinationDir, regfile.name);
239239
// if already downloaded
@@ -248,7 +248,7 @@ async function downloadRegistryFile(regfile, destinationDir, options = undefined
248248
certificateAuthority: HTTPS_CA_CERTIFICATES,
249249
},
250250
}),
251-
fs.createWriteStream(archivePath)
251+
fs.createWriteStream(archivePath),
252252
);
253253
if (await fileExistsAndChecksumMatches(archivePath, checksum)) {
254254
return archivePath;
@@ -325,7 +325,7 @@ async function extractTarGz(source, destination) {
325325
.pipe(
326326
tar.extract({
327327
cwd: destination,
328-
})
328+
}),
329329
)
330330
.on('error', (err) => reject(err))
331331
.on('close', () => resolve(destination));

src/installer/stages/platformio-core.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default class PlatformIOCoreStage extends BaseStage {
5757
async loadCoreState() {
5858
const stateJSONPath = path.join(
5959
core.getTmpDir(),
60-
`core-dump-${Math.round(Math.random() * 100000)}.json`
60+
`core-dump-${Math.round(Math.random() * 100000)}.json`,
6161
);
6262
const scriptArgs = [];
6363
if (this.useDevCore()) {
@@ -70,7 +70,7 @@ export default class PlatformIOCoreStage extends BaseStage {
7070
this.params.disableAutoUpdates || !this.params.useBuiltinPIOCore
7171
? '--no-auto-upgrade'
7272
: '--auto-upgrade',
73-
]
73+
],
7474
);
7575
if (this.params.pioCoreVersionSpec) {
7676
scriptArgs.push(...['--version-spec', this.params.pioCoreVersionSpec]);
@@ -133,7 +133,7 @@ export default class PlatformIOCoreStage extends BaseStage {
133133

134134
this.status = BaseStage.STATUS_FAILED;
135135
throw new Error(
136-
'Can not find Python Interpreter. Please install Python 3.6 or above manually'
136+
'Can not find Python Interpreter. Please install Python 3.6 or above manually',
137137
);
138138
}
139139

@@ -144,7 +144,7 @@ export default class PlatformIOCoreStage extends BaseStage {
144144
if (!this.params.useBuiltinPIOCore) {
145145
this.status = BaseStage.STATUS_FAILED;
146146
throw new Error(
147-
'Could not find compatible PlatformIO Core. Please enable `platformio-ide.useBuiltinPIOCore` setting and restart IDE.'
147+
'Could not find compatible PlatformIO Core. Please enable `platformio-ide.useBuiltinPIOCore` setting and restart IDE.',
148148
);
149149
}
150150
this.status = BaseStage.STATUS_INSTALLING;
@@ -179,8 +179,8 @@ export default class PlatformIOCoreStage extends BaseStage {
179179
console.info(
180180
await callInstallerScript(
181181
await this.whereIsPython({ prompt: true }),
182-
scriptArgs
183-
)
182+
scriptArgs,
183+
),
184184
);
185185

186186
// check that PIO Core is installed and load its state an patch OS environ

src/misc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ export function getErrorReportUrl(title, description) {
8181
['Could not start PIO Home server: Timeout error', 'https://bit.ly/3m2Tbl9'],
8282
['Could not create PIO Core Virtual Environment', 'https://bit.ly/43hNh04'],
8383
['Compatible PlatformIO Core not found', 'https://bit.ly/43tNj4C'],
84-
['Could not find a version that satisfies the requirement', 'https://bit.ly/3TOcnBK'],
84+
[
85+
'Could not find a version that satisfies the requirement',
86+
'https://bit.ly/3TOcnBK',
87+
],
8588
['PIO IDE: v2.', 'https://bit.ly/3H70AHl'],
8689
];
8790
for (const item of errorToUrls) {

src/proc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function patchOSEnviron({ caller, extraPath, extraVars }) {
7575
expandedEnvVars.push(matchedEnvVar[1]);
7676
process.env.PLATFORMIO_PATH = process.env.PLATFORMIO_PATH.replace(
7777
matchedEnvVar[0],
78-
process.env[matchedEnvVar[1]] || ''
78+
process.env[matchedEnvVar[1]] || '',
7979
);
8080
}
8181

@@ -226,7 +226,7 @@ export function getCommandOutput(cmd, args, options = {}) {
226226
return reject(err);
227227
}
228228
},
229-
options
229+
options,
230230
);
231231
});
232232
}

src/project/indexer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default class ProjectIndexer {
5151
) {
5252
const msg =
5353
`Multiple requests to rebuild the project "${path.basename(
54-
this.projectDir
54+
this.projectDir,
5555
)}" index have been received!\n` +
5656
`Automatic index rebuilding process has been terminated for ${
5757
ProjectIndexer.FLOOD_TIME_WINDOW / 60
@@ -63,7 +63,7 @@ export default class ProjectIndexer {
6363

6464
this._rebuildTimeout = setTimeout(
6565
this.rebuild.bind(this),
66-
ProjectIndexer.AUTO_REBUILD_DELAY * 1000
66+
ProjectIndexer.AUTO_REBUILD_DELAY * 1000,
6767
);
6868
}
6969

@@ -72,7 +72,7 @@ export default class ProjectIndexer {
7272
return;
7373
}
7474
return this.options.api.withIndexRebuildingProgress(
75-
this._rebuildWithProgress.bind(this)
75+
this._rebuildWithProgress.bind(this),
7676
);
7777
}
7878

src/project/observer.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ export default class ProjectObserver {
133133
this._cache.set(
134134
cacheKey,
135135
await this.options.api.withTasksLoadingProgress(
136-
async () => await this._projectTasks.fetchEnvTasks(name)
137-
)
136+
async () => await this._projectTasks.fetchEnvTasks(name),
137+
),
138138
);
139139
return this._cache.get(cacheKey);
140140
}
@@ -146,7 +146,7 @@ export default class ProjectObserver {
146146
this.requestUpdateDirWatchers();
147147
if ((this.options.api || {}).onDidChangeProjectConfig) {
148148
this.options.api.onDidChangeProjectConfig(
149-
path.join(this.projectDir, 'platformio.ini')
149+
path.join(this.projectDir, 'platformio.ini'),
150150
);
151151
}
152152
}
@@ -157,12 +157,12 @@ export default class ProjectObserver {
157157

158158
setupFSWatchers() {
159159
const watcher = this.options.api.createFileSystemWatcher(
160-
path.join(this.projectDir, 'platformio.ini')
160+
path.join(this.projectDir, 'platformio.ini'),
161161
);
162162
this.subscriptions.push(
163163
watcher,
164164
watcher.onDidCreate(() => this.onDidChangeProjectConfig()),
165-
watcher.onDidChange(() => this.onDidChangeProjectConfig())
165+
watcher.onDidChange(() => this.onDidChangeProjectConfig()),
166166
// watcher.onDidDelete(() => undefined)
167167
);
168168
this.requestUpdateDirWatchers();
@@ -174,7 +174,7 @@ export default class ProjectObserver {
174174
}
175175
this._updateDirWatchersTimeout = setTimeout(
176176
this.updateDirWatchers.bind(this),
177-
ProjectObserver.WATCH_DIRS_UPDATE_DELAY
177+
ProjectObserver.WATCH_DIRS_UPDATE_DELAY,
178178
);
179179
}
180180

@@ -187,7 +187,7 @@ export default class ProjectObserver {
187187
watcher,
188188
watcher.onDidCreate(() => this.onDidChangeLibDirs()),
189189
watcher.onDidChange(() => this.onDidChangeLibDirs()),
190-
watcher.onDidDelete(() => this.onDidChangeLibDirs())
190+
watcher.onDidDelete(() => this.onDidChangeLibDirs()),
191191
);
192192
});
193193
} catch (err) {

src/project/pool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class ProjectPool {
3131
return undefined;
3232
}
3333
let observer = this._observers.find(
34-
(observer) => observer.projectDir === projectDir
34+
(observer) => observer.projectDir === projectDir,
3535
);
3636
if (!observer) {
3737
observer = new ProjectObserver(projectDir, this.options);

0 commit comments

Comments
 (0)