Skip to content

Commit 645041c

Browse files
committed
chore: lint
1 parent 2f0ddcf commit 645041c

12 files changed

Lines changed: 89 additions & 88 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ jobs:
88
strategy:
99
matrix:
1010
node-version:
11-
- 18.x
12-
- 20.x
13-
- 21.x
11+
- 22.x
12+
- 24.x
13+
- 25.x
1414
steps:
15-
- uses: actions/checkout@v4
16-
- uses: oven-sh/setup-bun@v1
15+
- uses: actions/checkout@v5
16+
- uses: oven-sh/setup-bun@v2
1717
with:
1818
bun-version: latest
1919
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@v6
2121
with:
2222
node-version: ${{ matrix.node-version }}
2323
- name: Install Redrun

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ yarn-error.log
1212

1313

1414
coverage
15+
*.config.*

client/_clipboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = function(cmd) {
2424

2525
if (cmd === 'cut') {
2626
_story.setData(NAME, value);
27-
return cut(_story, value) ? resolve() : reject();
27+
return cut(value) ? resolve() : reject();
2828
}
2929

3030
return clipboard
@@ -39,7 +39,7 @@ module.exports = function(cmd) {
3939
});
4040
};
4141

42-
function cut(story, value) {
42+
function cut(value) {
4343
const textarea = createElement('textarea', {
4444
value,
4545
});

client/_init-socket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = function() {
6868
});
6969

7070
socket.on('disconnect', () => {
71-
edward.save._patch = self._patchHttp;
71+
edward.save._patch = globalThis._patchHttp;
7272
});
7373

7474
socket.on('err', (error) => {

client/_on-save.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const {confirm} = require('smalltalk');
4-
const tryToCatch = require('try-to-catch');
4+
const {tryToCatch} = require('try-to-catch');
55
const {promisify} = require('es6-promisify');
66
const write = promisify(require('restafary/client').write);
77

client/_set-emmet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = function() {
2828
await load.js(url);
2929

3030
this._Emmet = ace.require('ace/ext/emmet');
31-
this._Emmet.setCore(window.emmet);
31+
this._Emmet.setCore(globalThis.emmet);
3232

3333
callback();
3434
});

client/edward.js

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ const wraptile = require('wraptile');
1515
const smalltalk = require('smalltalk');
1616
const jssha = require('jssha');
1717
const restafary = require('restafary/client');
18-
const tryToCatch = require('try-to-catch');
18+
const {tryToCatch} = require('try-to-catch');
1919

20-
window.load = window.load || load;
21-
window.exec = window.exec || exec;
20+
globalThis.load = globalThis.load || load;
21+
globalThis.exec = globalThis.exec || exec;
2222

2323
const Story = require('./story');
2424
const _clipboard = require('./_clipboard');
@@ -101,45 +101,45 @@ Edward.prototype._init = function(fn) {
101101
exec.series([
102102
loadFiles,
103103
async (callback) => {
104-
await loadremote('socket', {
105-
name: 'io',
106-
prefix: this._SOCKET_PATH,
107-
});
108-
109-
initSocket();
110-
callback();
111-
},
104+
await loadremote('socket', {
105+
name: 'io',
106+
prefix: this._SOCKET_PATH,
107+
});
108+
109+
initSocket();
110+
callback();
111+
},
112112
async () => {
113-
this._Emitter = Emitify();
114-
this._Ace = ace.edit(this._Element);
115-
this._Modelist = ace.require('ace/ext/modelist');
116-
117-
this._Emitter.on('auth', (username, password) => {
118-
this._socket.emit('auth', username, password);
119-
});
120-
121-
ace.require('ace/ext/language_tools');
122-
123-
this._addCommands();
124-
this._Ace.$blockScrolling = Infinity;
125-
126-
const config = await load.json(this._PREFIX + '/edit.json');
127-
128-
const {options = {}} = config;
129-
130-
const preventOverwrite = () => {
131-
for (const name of Object.keys(this._Config.options)) {
132-
options[name] = this._Config.options[name];
133-
}
134-
};
135-
136-
fn();
137-
preventOverwrite();
138-
139-
this._Config = config;
140-
141-
edward.setOptions(options);
142-
},
113+
this._Emitter = Emitify();
114+
this._Ace = ace.edit(this._Element);
115+
this._Modelist = ace.require('ace/ext/modelist');
116+
117+
this._Emitter.on('auth', (username, password) => {
118+
this._socket.emit('auth', username, password);
119+
});
120+
121+
ace.require('ace/ext/language_tools');
122+
123+
this._addCommands();
124+
this._Ace.$blockScrolling = Infinity;
125+
126+
const config = await load.json(this._PREFIX + '/edit.json');
127+
128+
const {options = {}} = config;
129+
130+
const preventOverwrite = () => {
131+
for (const name of Object.keys(this._Config.options)) {
132+
options[name] = this._Config.options[name];
133+
}
134+
};
135+
136+
fn();
137+
preventOverwrite();
138+
139+
this._Config = config;
140+
141+
edward.setOptions(options);
142+
},
143143
]);
144144
};
145145

@@ -190,7 +190,7 @@ Edward.prototype._addCommands = function() {
190190
Edward.prototype.evaluate = function() {
191191
const edward = this;
192192
const focus = edward.focus.bind(this);
193-
const isJS = /\.js$/.test(this._filename);
193+
const isJS = this._filename.endsWith('.js');
194194

195195
if (!isJS)
196196
return smalltalk
@@ -216,17 +216,17 @@ Edward.prototype.addKeyMap = function(keyMap) {
216216
const map = Object
217217
.keys(keyMap)
218218
.map((name, i) => {
219-
const key = {
220-
name: String(Math.random()) + i,
221-
bindKey: {
222-
win: name,
223-
mac: name.replace('Ctrl', 'Command'),
224-
},
225-
exec: keyMap[name],
226-
};
227-
228-
return key;
229-
});
219+
const key = {
220+
name: String(Math.random()) + i,
221+
bindKey: {
222+
win: name,
223+
mac: name.replace('Ctrl', 'Command'),
224+
},
225+
exec: keyMap[name],
226+
};
227+
228+
return key;
229+
});
230230

231231
map.forEach(this._addKey());
232232

client/loadremote.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const isString = (a) => typeof a === 'string';
44
const load = require('load.js');
5-
const tryToCatch = require('try-to-catch');
5+
const {tryToCatch} = require('try-to-catch');
66
const once = require('once');
77

88
const loadModules = once(async (prefix) => {
@@ -15,11 +15,11 @@ const loadOptions = once(async (prefix) => {
1515
return await load.json(url);
1616
});
1717

18-
const on = async (remote) => {
18+
const on = async ({remote, local}) => {
1919
const [error] = await tryToCatch(load.parallel, remote);
2020

2121
if (error)
22-
await off();
22+
await off(local);
2323
};
2424

2525
const off = async function(local) {
@@ -54,7 +54,7 @@ module.exports = async (name, options = {}) => {
5454

5555
if (isArray) {
5656
remoteTmpls = module.remote;
57-
local = module.local;
57+
({local} = module);
5858
} else {
5959
remoteTmpls = [module.remote];
6060
local = [module.local];
@@ -69,7 +69,7 @@ module.exports = async (name, options = {}) => {
6969
if (!online)
7070
return await off(local);
7171

72-
await on(remote);
72+
await on({remote, local});
7373
};
7474

7575
function binom(name, array) {

json/modules.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[{
22
"name": "socket",
3-
"version": "4.1.3",
3+
"version": "4.8.3",
44
"local": "/socket.io/socket.io.js",
55
"remote": "https://cdnjs.cloudflare.com/ajax/libs/socket.io/{{ version }}/socket.io.js"
66
}, {
77
"name": "ace",
8-
"version": "1.43.6",
8+
"version": "1.43.3",
99
"local": "/modules/ace-builds/src-min/ace.js",
1010
"remote": "//cdnjs.cloudflare.com/ajax/libs/ace/{{ version }}/ace.js"
1111
}, {

server/edit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict';
22

33
const readjson = require('readjson');
4-
const tryToCatch = require('try-to-catch');
4+
const {tryToCatch} = require('try-to-catch');
55

66
const Edit = require('../json/edit.json');
7-
const HOME = require('os').homedir();
7+
const HOME = require('node:os').homedir();
88

99
module.exports = async (req, res, next) => {
1010
if (req.url !== '/edit.json')

0 commit comments

Comments
 (0)