Skip to content

Commit 83db1d5

Browse files
committed
lint
1 parent 34e28df commit 83db1d5

File tree

5 files changed

+45
-47
lines changed

5 files changed

+45
-47
lines changed

src/editor.js

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ import { resizePNG } from './icon/index.js'
77

88
import * as monaco from 'monaco-editor'
99

10-
function rgbaToHex(rgbaString) {
11-
const rgbaValues = rgbaString.match(/\d+/g);
12-
13-
const r = parseInt(rgbaValues[0]);
14-
const g = parseInt(rgbaValues[1]);
15-
const b = parseInt(rgbaValues[2]);
16-
17-
const a = Math.round(parseFloat(rgbaValues[3]) * 255);
18-
19-
const rHex = r.toString(16).padStart(2, '0');
20-
const gHex = g.toString(16).padStart(2, '0');
21-
const bHex = b.toString(16).padStart(2, '0');
22-
const aHex = a.toString(16).padStart(2, '0');
23-
24-
return `#${rHex}${gHex}${bHex}${aHex}`;
10+
function rgbaToHex (rgbaString) {
11+
const rgbaValues = rgbaString.match(/\d+/g)
12+
13+
const r = parseInt(rgbaValues[0])
14+
const g = parseInt(rgbaValues[1])
15+
const b = parseInt(rgbaValues[2])
16+
17+
const a = Math.round(parseFloat(rgbaValues[3]) * 255)
18+
19+
const rHex = r.toString(16).padStart(2, '0')
20+
const gHex = g.toString(16).padStart(2, '0')
21+
const bHex = b.toString(16).padStart(2, '0')
22+
const aHex = a.toString(16).padStart(2, '0')
23+
24+
return `#${rHex}${gHex}${bHex}${aHex}`
2525
}
2626

2727
globalThis.MonacoEnvironment = {
2828
getWorkerUrl: function (moduleId, label) {
2929
if (label === 'json') {
30-
return 'vs/language/json/json.worker.js';
30+
return 'vs/language/json/json.worker.js'
3131
}
3232

3333
if (label === 'css' || label === 'scss' || label === 'less') {
34-
return 'vs/language/css/css.worker.js';
34+
return 'vs/language/css/css.worker.js'
3535
}
3636

3737
if (label === 'html' || label === 'handlebars' || label === 'razor') {
38-
return 'vs/language/html/html.worker.js';
38+
return 'vs/language/html/html.worker.js'
3939
}
4040

4141
if (label === 'typescript' || label === 'javascript') {
42-
return 'vs/language/typescript/ts.worker.js';
42+
return 'vs/language/typescript/ts.worker.js'
4343
}
4444

45-
return 'vs/editor/editor.worker.js';
45+
return 'vs/editor/editor.worker.js'
4646
}
4747
}
4848

@@ -60,14 +60,14 @@ class AppEditor extends Tonic {
6060
const pickerOpts = {
6161
types: [
6262
{
63-
description: "Images",
63+
description: 'Images',
6464
accept: {
65-
"image/*": ['.png'],
66-
},
67-
},
65+
'image/*': ['.png']
66+
}
67+
}
6868
],
6969
excludeAcceptAllOption: true,
70-
multiple: false,
70+
multiple: false
7171
}
7272

7373
if (event === 'size') {
@@ -119,7 +119,6 @@ class AppEditor extends Tonic {
119119

120120
if (type.length) {
121121
if (/image/.test(type[0].mime)) {
122-
123122
// Display a preview for this type.
124123
return
125124
}
@@ -209,43 +208,43 @@ class AppEditor extends Tonic {
209208
monaco.editor.setTheme(theme)
210209
}
211210

212-
async loadAPIs(directoryPath = './socket') {
211+
async loadAPIs (directoryPath = './socket') {
213212
const readDir = async (dirPath) => {
214-
const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });
213+
const entries = await fs.promises.readdir(dirPath, { withFileTypes: true })
215214

216215
entries.forEach(async (entry) => {
217-
const fullPath = path.join(dirPath, entry.name);
216+
const fullPath = path.join(dirPath, entry.name)
218217

219218
if (entry.isDirectory()) {
220-
readDir(fullPath).catch(err => console.error(`Error reading directory ${fullPath}:`, err));
219+
readDir(fullPath).catch(err => console.error(`Error reading directory ${fullPath}:`, err))
221220
} else {
222221
if (path.extname(fullPath) === '.ts') {
223222
fs.promises.readFile(fullPath, 'utf8')
224223
.then(sourceText => {
225-
monaco.languages.typescript.javascriptDefaults.addExtraLib(sourceText, `socket/${fullPath}`);
226-
monaco.languages.typescript.typescriptDefaults.addExtraLib(sourceText, `socket/${fullPath}`);
224+
monaco.languages.typescript.javascriptDefaults.addExtraLib(sourceText, `socket/${fullPath}`)
225+
monaco.languages.typescript.typescriptDefaults.addExtraLib(sourceText, `socket/${fullPath}`)
227226
})
228-
.catch(err => console.error(`Error reading file ${fullPath}:`, err));
227+
.catch(err => console.error(`Error reading file ${fullPath}:`, err))
229228
}
230229
}
231-
});
232-
};
230+
})
231+
}
233232

234233
try {
235-
await readDir(directoryPath);
234+
await readDir(directoryPath)
236235
} catch (err) {
237-
console.error('Error initiating read directory operation:', err);
236+
console.error('Error initiating read directory operation:', err)
238237
}
239238
}
240239

241240
async refreshSettings () {
242-
let parent = this.props.parent
241+
const parent = this.props.parent
243242
this.editor.updateOptions(parent.state.settings?.editorOptions || {})
244243
}
245244

246245
connected () {
247246
let theme
248-
let parent = this.props.parent
247+
const parent = this.props.parent
249248

250249
this.editor = monaco.editor.create(this.querySelector('.editor'), {
251250
value: '',

src/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class AppView extends Tonic {
6464

6565
const settingsFile = path.join(this.state.cwd, 'settings.json')
6666
const notifications = document.querySelector('#notifications')
67-
67+
6868
try {
6969
projectExists = await fs.promises.stat(path.join(this.state.cwd, 'socket.ini'))
7070
} catch {}
@@ -74,7 +74,7 @@ class AppView extends Tonic {
7474

7575
this.state.settings = defaultSettings
7676
await fs.promises.writeFile(settingsFile, JSON.stringify(defaultSettings))
77-
await this.installTemplates()
77+
await this.installTemplates()
7878
}
7979

8080
if (projectExists) {
@@ -95,7 +95,6 @@ class AppView extends Tonic {
9595
title: 'Unable to read settings from ${settingsFile}',
9696
message: err.message
9797
})
98-
return
9998
}
10099
}
101100
}
@@ -120,7 +119,7 @@ class AppView extends Tonic {
120119
dir = path.join('icons', 'icon.ico')
121120
} else {
122121
dir = path.join('icons', 'icon.png')
123-
}
122+
}
124123
}
125124

126125
paths[path.join(this.state.cwd, dir)] = data

src/ini.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function set (src, section, key, value) {
3535
if (parts[0] === key) {
3636
value = `${parts[0]} = ${value}`
3737
lines[i] = value
38-
}
38+
}
3939
}
4040
}
4141

src/terminal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class AppTerminal extends Tonic {
252252
// this.term.loadAddon(this.ligatures)
253253
this._term.open(el)
254254
this.resizer.fit()
255-
255+
256256
this._term.options.cursorBlink = false
257257

258258
this._term.attachCustomKeyEventHandler(function (e) {
@@ -265,7 +265,7 @@ class AppTerminal extends Tonic {
265265

266266
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
267267
this.updated()
268-
});
268+
})
269269

270270
window.removeEventListener('resize', this.boundResizeEvent)
271271
window.addEventListener('resize', this.boundResizeEvent)

src/vm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export async function init (options) {
5454
.reduce((array, transfer) => array.concat(transfer), [])
5555

5656
port.postMessage({ method: 'console.debug', args }, { transfer })
57-
},
57+
}
5858
})
5959
}
6060

0 commit comments

Comments
 (0)