-
-
Notifications
You must be signed in to change notification settings - Fork 31
Upgrade xo #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade xo #130
Conversation
| } | ||
|
|
||
| // eslint-disable-next-line n/no-unsupported-features/es-syntax | ||
| const arrayBuffer = new ArrayBuffer(length, {maxByteLength: getNewContentsLength(length)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArrayBuffer resizing is not supported in Node 18.
However, we check for support before calling this function.
| // eslint-disable-next-line @typescript-eslint/ban-types | ||
| type TextStreamItem = string | Buffer | ArrayBuffer | ArrayBufferView; | ||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins | ||
| export type AnyStream<SteamItem = TextStreamItem> = Readable | ReadableStream<SteamItem> | AsyncIterable<SteamItem>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReadableStream is supported in Node 18 but is marked as experimental.
However, it is a web standard, and the Node.js implementation has been pretty stable for a few years now.
This is only used in types, not runtime.
|
|
||
| export const createStream = streamDefinition => typeof streamDefinition === 'function' | ||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins | ||
| ? Duplex.from(streamDefinition) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplex.from() is supported in Node 18 but is marked as experimental.
However, its implementation has barely changed in many years now. Also, this is only used in tests.
|
|
||
| test('works with fetch()', async t => { | ||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins | ||
| const {body} = await fetch(TEST_URL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetch() support is experimental in Node, but we're only using this in tests.
|
|
||
| test('can use TextDecoderStream', async t => { | ||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins | ||
| const textDecoderStream = new TextDecoderStream('utf-16le'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as for fetch(), but with TextDecoderStream().
| }; | ||
|
|
||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins | ||
| test('Handles multiple successive fast reads', testMultipleReads, () => scheduler.yield()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as fetch(), but for scheduler.yield().
This PR upgrades xo.
CI currently failing due to actions/node-versions#182