Skip to content

Commit 1f065f1

Browse files
committed
lint & native
1 parent ddaa55d commit 1f065f1

File tree

12 files changed

+38
-47
lines changed

12 files changed

+38
-47
lines changed

build/devices/zephyr/targets/esp32_ethernet_kit/manifest.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
"include": [
66
"$(MODULES)/io/ethernet/manifest.json"
77
],
8-
"modules": {
9-
"setup/target": "./setup-target"
10-
},
11-
"preload": "setup/target",
128
"config": {
139
},
1410
"defines": {
1511
},
1612
"zephyrConfig": {
17-
"CONFIG_ESP_SIMPLE_BOOT": "y",
18-
"CONFIG_BOOTLOADER_MCUBOOT": "n",
13+
"CONFIG_ESP_SIMPLE_BOOT": "y",
14+
"CONFIG_BOOTLOADER_MCUBOOT": "n",
1915

2016
"CONFIG_ETH_ESP32": "y",
2117
"CONFIG_NET_IF_MAX_IPV4_COUNT": 2

build/devices/zephyr/targets/esp32_ethernet_kit/setup-target.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ export default defineConfig([{
6767
Outline: "readonly",
6868
QRCode: "readonly",
6969
Shape: "readonly",
70+
71+
assetMap: "readonly",
7072
}
7173
}
7274
},

examples/io/tcp/httpclient/httpclient.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,7 @@ class HTTPClient {
418418
return;
419419
}
420420

421-
if (!this.#pendingWrite || !this.#writable)
422-
break;
423-
} while (true);
421+
} while (this.#pendingWrite && this.#writable);
424422
}
425423
#error(e) {
426424
if (("receivedBody" === this.#state) && this.#timer) { // completion not reported yet. report before handling error.

examples/io/tcp/websocketclient/websocketclient.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class WebSocketClient {
263263
switch (this.#state) {
264264
case "receiveStatus":
265265
case "receiveHeader":
266-
do {
266+
for (;;) {
267267
while (count--) {
268268
const c = this.#socket.read();
269269
this.#line += String.fromCharCode(c);
@@ -318,7 +318,7 @@ class WebSocketClient {
318318
}
319319

320320
this.#line = "";
321-
} while (true);
321+
}
322322
break;
323323

324324
case "connected": {

modules/data/logical/logical.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class {
2828
return this.xor(dst, 0xff);
2929
return this.xor(dst, 0xff, count);
3030
}
31-
static xor(dst, src) @ "xs_logical_xor"; // optional third argument count
32-
static and(dst, src) @ "xs_logical_and"; // optional third argument count
33-
static or(dst, src) @ "xs_logical_or"; // optional third argument count
31+
static xor(dst, src) { return native("xs_logical_xor").call(this, dst, src); }; // optional third argument count
32+
static and(dst, src) { return native("xs_logical_and").call(this, dst, src); }; // optional third argument count
33+
static or(dst, src) { return native("xs_logical_or").call(this, dst, src); }; // optional third argument count
3434
}

modules/data/text/decoder/textdecoder.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
*
1919
*/
2020

21-
export default class @ "xs_textdecoder_destructor" {
22-
constructor(label, options) @ "xs_textdecoder";
23-
decode(buffer) @ "xs_textdecoder_decode";
24-
get encoding() @ "xs_textdecoder_get_encoding";
25-
get ignoreBOM() @ "xs_textdecoder_get_ignoreBOM";
26-
get fatal() @ "xs_textdecoder_get_fatal";
21+
export default class extends Native("xs_textdecoder_destructor") {
22+
constructor(label, options) { super(); native("xs_textdecoder").call(this, label, options); };
23+
decode(buffer) { return native("xs_textdecoder_decode").call(this, buffer); };
24+
get encoding() { return native("xs_textdecoder_get_encoding").call(this); };
25+
get ignoreBOM() { return native("xs_textdecoder_get_ignoreBOM").call(this); };
26+
get fatal() { return native("xs_textdecoder_get_fatal").call(this); };
2727
}

modules/data/text/encoder/textencoder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
*/
2020

2121
export default class {
22-
encode(value) @ "xs_textencoder_encode";
23-
encodeInto(value, buffer) @ "xs_textencoder_encodeInto";
22+
encode(value) { return native("xs_textencoder_encode").call(this, value); };
23+
encodeInto(value, buffer) { return native("xs_textencoder_encodeInto").call(this, value, buffer); };
2424
}

modules/data/url/url.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
// https://url.spec.whatwg.org/#url-class
2222

23-
function parseURL(url) @ "fx_parseURL"
24-
function serializeURL(url) @ "fx_serializeURL"
25-
function parseQuery(query) @ "fx_parseQuery"
26-
function serializeQuery(pairs) @ "fx_serializeQuery"
23+
function parseURL(url) { return native("fx_parseURL").call(this, url); }
24+
function serializeURL(url) { return native("fx_serializeURL").call(this, url); }
25+
function parseQuery(query) { return native("fx_parseQuery").call(this, query); }
26+
function serializeQuery(pairs) { return native("fx_serializeQuery").call(this, pairs); }
2727

2828
const SCHEME = 1;
2929
const USERNAME = 2;

modules/io/files/zephyr/files-zephyr.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ class Directory extends Native("xs_directoryzephyr_destructor") {
6767
}
6868

6969
createDirectory(options) { return native("xs_directoryzephyr_createDirectory").call(this, options); }
70-
createLink(path, target) {throw new Error("unsupported");}
70+
createLink(/* path, target */) {throw new Error("unsupported");}
7171

72-
readLink(path) {throw new Error("unsupported");}
72+
readLink(/* path */) {throw new Error("unsupported");}
7373

7474
scan(...path) {
7575
return new DirectoryIterator(this, ...path);
7676
}
7777
}
78+
// @ts-expect-error assigning scan as iterator
7879
Directory.prototype[Symbol.iterator] = Directory.prototype.scan;
7980

8081
export {Directory}

0 commit comments

Comments
 (0)