diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 76499b9ad..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - parserOptions: { - ecmaVersion: 'latest' - }, - extends: ['standard'], - rules: { - /* - This is inserted to make this compatible with prettier. - Once https://github.com/prettier/prettier/issues/3845 and https://github.com/prettier/prettier/issues/3847 are solved this might be not needed any more. - */ - 'space-before-function-paren': 0, - curly: [2, 'all'] - }, - overrides: [ - { - files: ['**/*.mjs'], - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module' - } - } - ] -} diff --git a/.github/workflows/bundlers.yml b/.github/workflows/bundlers.yml index d0bf98c48..e76de6d13 100644 --- a/.github/workflows/bundlers.yml +++ b/.github/workflows/bundlers.yml @@ -20,6 +20,10 @@ jobs: node-version: 12.x - os: windows-latest node-version: 14.x + - os: macos-latest + node-version: 12.x + - os: macos-latest + node-version: 14.x steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index f94148058..a5df24971 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -19,6 +19,10 @@ jobs: node-version: 12.x - os: windows-latest node-version: 14.x + - os: macos-latest + node-version: 12.x + - os: macos-latest + node-version: 14.x steps: - name: Checkout uses: actions/checkout@v3 diff --git a/build/replacements.mjs b/build/replacements.mjs index 5d4e5c841..2b69d27cf 100644 --- a/build/replacements.mjs +++ b/build/replacements.mjs @@ -81,7 +81,7 @@ const internalStreamsRequireWebStream = ["require\\('internal/webstreams/adapter const internalStreamsWeakHandler = [ "const \\{ kWeakHandler \\} = require\\('../event_target'\\);", - "require\\('../event_target'\\);const kWeakHandler = require('../../ours/primordials').Symbol('kWeak');" + "require('../event_target');const kWeakHandler = require('../../ours/primordials').Symbol('kWeak');" ] const internalStreamsWeakHandler2 = [ diff --git a/eslint-plugin-local/index.mjs b/eslint-plugin-local/index.mjs new file mode 100644 index 000000000..ade9e6923 --- /dev/null +++ b/eslint-plugin-local/index.mjs @@ -0,0 +1,9 @@ +'use strict' + +import nbi from './no-big-int.mjs' + +export default { + rules: { + 'no-big-int': nbi, + }, +} \ No newline at end of file diff --git a/eslint-plugin-local/no-big-int.mjs b/eslint-plugin-local/no-big-int.mjs new file mode 100644 index 000000000..242c08ab0 --- /dev/null +++ b/eslint-plugin-local/no-big-int.mjs @@ -0,0 +1,26 @@ +'use strict' + +export default { + meta: { + docs: { + description: 'disallow `bigint` syntax', + category: 'ES2020', + recommended: false, + }, + fixable: null, + messages: { + forbidden: 'ES2020 `bigint` syntax is forbidden.', + }, + schema: [], + type: 'problem', + }, + create(context) { + return { + Literal(node) { + if (node.bigint != null) { + context.report({ messageId: 'forbidden', node }) + } + }, + } + }, +} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..cf74cc0a2 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,27 @@ +import { FlatCompat } from '@eslint/eslintrc' +const compat = new FlatCompat() + +import eslintPluginLocal from './eslint-plugin-local/index.mjs' + +export default [ + // standard, + ...compat.extends('eslint-config-standard'), + { + files: ['**/**.js', '**/**.mjs'], + languageOptions: { + sourceType: 'module', + ecmaVersion: 'latest', + }, + plugins: { 'local': eslintPluginLocal }, + rules: { + /* + This is inserted to make this compatible with prettier. + Once https://github.com/prettier/prettier/issues/3845 and https://github.com/prettier/prettier/issues/3847 are solved this might be not needed any more. + */ + 'space-before-function-paren': 0, + curly: [2, 'all'], + 'local/no-big-int': 'error', + }, + }, +] + diff --git a/package.json b/package.json index c3d6f8a40..df13bfb39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "readable-stream", - "version": "4.5.2", + "version": "4.6.0", "description": "Node.js Streams, a user-land copy of the stream library from Node.js", "homepage": "https://github.com/nodejs/readable-stream", "license": "MIT", diff --git a/src/errors.js b/src/errors.js index c999d49d2..070989aa5 100644 --- a/src/errors.js +++ b/src/errors.js @@ -335,8 +335,8 @@ E( received = addNumericalSeparator(String(input)) } else if (typeof input === 'bigint') { received = String(input) - - if (input > 2n ** 32n || input < -(2n ** 32n)) { + const limit = BigInt(2) ** BigInt(32) + if (input > limit || input < -limit) { received = addNumericalSeparator(received) }