Skip to content

Commit 4e1683a

Browse files
authored
chore: fix lint and ts (piscinajs#712)
1 parent eda5671 commit 4e1683a

File tree

12 files changed

+1258
-2035
lines changed

12 files changed

+1258
-2035
lines changed

eslint.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
module.exports = require('neostandard')({
4+
semi: true,
5+
ts: true,
6+
noStyle: true,
7+
ignores: ['dist', 'node_modules', 'docs/build', 'docs/.docusaurus'],
8+
globals: {
9+
SharedArrayBuffer: true,
10+
Atomics: true,
11+
AbortController: true,
12+
MessageChannel: true,
13+
},
14+
});

examples/async_load/worker.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line no-eval
21
import util from 'util';
32
const sleep = util.promisify(setTimeout);
43

examples/multiple-workers-one-file/worker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
function add ({ a, b }) { return a + b; }
4-
function multiply ({ a, b }) { return a * b; };
4+
function multiply ({ a, b }) { return a * b; }
55

66
add.add = add;
77
add.multiply = multiply;

examples/react-ssr/worker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
;
2+
33
const React = require('react');
44
const ReactDOMServer = require('react-dom/server');
55

examples/scrypt/monitor.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
const { monitorEventLoopDelay } = require('perf_hooks');
44
const { isMainThread } = require('worker_threads');
55

6-
if (!isMainThread) return;
6+
if (isMainThread) {
7+
const monitor = monitorEventLoopDelay({ resolution: 20 });
78

8-
const monitor = monitorEventLoopDelay({ resolution: 20 });
9+
monitor.enable();
910

10-
monitor.enable();
11-
12-
process.on('exit', () => {
13-
monitor.disable();
14-
console.log('Main Thread Mean/Max/99% Event Loop Delay:',
15-
monitor.mean,
16-
monitor.max,
17-
monitor.percentile(99));
18-
});
11+
process.on('exit', () => {
12+
monitor.disable();
13+
console.log(
14+
'Main Thread Mean/Max/99% Event Loop Delay:',
15+
monitor.mean,
16+
monitor.max,
17+
monitor.percentile(99)
18+
);
19+
});
20+
}

examples/stream-in/progress.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ class Progress extends EventEmitter {
3535
` ${((this.#tasksCompleted / this.#tasksSubmitted) * 100).toFixed(2)}%` +
3636
` [${this.#tasksFailed} failed]`;
3737
}
38-
};
38+
}
3939

4040
module.exports = Progress;

examples/typescript/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import Piscina from '../../..';
22
import { isMainThread } from 'worker_threads';
33

44
interface Inputs {
5-
a : number;
6-
b : number;
5+
a: number;
6+
b: number;
77
}
88

99
if (isMainThread) {
1010
const piscina = new Piscina({ filename: __filename });
1111

1212
(async function () {
13-
const task : Inputs = { a: 1, b: 2 };
13+
const task: Inputs = { a: 1, b: 2 };
1414
console.log(await piscina.run(task));
1515
})();
1616
} else {
17-
module.exports = ({ a, b } : Inputs) : number => {
17+
module.exports = ({ a, b }: Inputs): number => {
1818
return a + b;
1919
};
2020
}

0 commit comments

Comments
 (0)