Skip to content
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

lib: move GLOBAL and root aliases to EOL #31167

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ The [`fs.readSync()`][] legacy `String` interface is deprecated. Use the
### DEP0016: `GLOBAL`/`root`
<!-- YAML
changes:
- version: REPLACEME
pr-url: REPLACEME
description: End-of-Life
- version: v6.12.0
pr-url: https://github.com/nodejs/node/pull/10116
description: A deprecation code has been assigned.
Expand All @@ -404,10 +407,10 @@ changes:
description: Runtime deprecation.
-->

Type: Runtime
Type: End-of-Life

The `GLOBAL` and `root` aliases for the `global` property are deprecated
and should no longer be used.
The `GLOBAL` and `root` aliases for the `global` property were deprecated
in Node.js 6.0.0 and have since been removed.

<a id="DEP0017"></a>
### DEP0017: `Intl.v8BreakIterator`
Expand Down
31 changes: 0 additions & 31 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ setupPrepareStackTrace();

const {
JSONParse,
ObjectDefineProperties,
ObjectDefineProperty,
ObjectGetPrototypeOf,
ObjectSetPrototypeOf,
Expand Down Expand Up @@ -294,36 +293,6 @@ function setupGlobalProxy() {
enumerable: false,
configurable: true
});

function makeGetter(name) {
return deprecate(function() {
return this;
}, `'${name}' is deprecated, use 'global'`, 'DEP0016');
}

function makeSetter(name) {
return deprecate(function(value) {
ObjectDefineProperty(this, name, {
configurable: true,
writable: true,
enumerable: true,
value: value
});
}, `'${name}' is deprecated, use 'global'`, 'DEP0016');
}

ObjectDefineProperties(global, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this line removed, the file fails linting because ObjectDefineProperties is defined but never used.

GLOBAL: {
configurable: true,
get: makeGetter('GLOBAL'),
set: makeSetter('GLOBAL')
},
root: {
configurable: true,
get: makeGetter('root'),
set: makeSetter('root')
}
});
}

function setupBuffer() {
Expand Down
110 changes: 54 additions & 56 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2532,24 +2532,23 @@ assert.strictEqual(
'unescape', 'eval', 'isFinite',
'isNaN', 'SharedArrayBuffer', 'Atomics',
'globalThis', 'WebAssembly', 'global',
'process', 'GLOBAL', 'root',
'Buffer', 'URL', 'URLSearchParams',
'TextEncoder', 'TextDecoder', 'clearInterval',
'clearTimeout', 'setInterval', 'setTimeout',
'queueMicrotask', 'clearImmediate', 'setImmediate',
'module', 'require', 'assert',
'async_hooks', 'buffer', 'child_process',
'cluster', 'crypto', 'dgram',
'dns', 'domain', 'events',
'fs', 'http', 'http2',
'https', 'inspector', 'net',
'os', 'path', 'perf_hooks',
'punycode', 'querystring', 'readline',
'repl', 'stream', 'string_decoder',
'tls', 'trace_events', 'tty',
'url', 'v8', 'vm',
'worker_threads', 'zlib', '_',
'_error', 'util'
'process', 'Buffer', 'URL',
'URLSearchParams', 'TextEncoder', 'TextDecoder',
'clearInterval', 'clearTimeout', 'setInterval',
'setTimeout', 'queueMicrotask', 'clearImmediate',
'setImmediate', 'module', 'require',
'assert', 'async_hooks', 'buffer',
'child_process', 'cluster', 'crypto',
'dgram', 'dns', 'domain',
'events', 'fs', 'http',
'http2', 'https', 'inspector',
'net', 'os', 'path',
'perf_hooks', 'punycode', 'querystring',
'readline', 'repl', 'stream',
'string_decoder', 'tls', 'trace_events',
'tty', 'url', 'v8',
'vm', 'worker_threads', 'zlib',
'_', '_error', 'util'
];

out = util.inspect(
Expand All @@ -2558,44 +2557,43 @@ assert.strictEqual(
);
expected = [
'[',
" 'Object', 'Function', 'Array',",
" 'Number', 'parseFloat', 'parseInt',",
" 'Infinity', 'NaN', 'undefined',",
" 'Boolean', 'String', 'Symbol',",
" 'Date', 'Promise', 'RegExp',",
" 'Error', 'EvalError', 'RangeError',",
" 'ReferenceError', 'SyntaxError', 'TypeError',",
" 'URIError', 'JSON', 'Math',",
" 'console', 'Intl', 'ArrayBuffer',",
" 'Uint8Array', 'Int8Array', 'Uint16Array',",
" 'Int16Array', 'Uint32Array', 'Int32Array',",
" 'Float32Array', 'Float64Array', 'Uint8ClampedArray',",
" 'BigUint64Array', 'BigInt64Array', 'DataView',",
" 'Map', 'BigInt', 'Set',",
" 'WeakMap', 'WeakSet', 'Proxy',",
" 'Reflect', 'decodeURI', 'decodeURIComponent',",
" 'encodeURI', 'encodeURIComponent', 'escape',",
" 'unescape', 'eval', 'isFinite',",
" 'isNaN', 'SharedArrayBuffer', 'Atomics',",
" 'globalThis', 'WebAssembly', 'global',",
" 'process', 'GLOBAL', 'root',",
" 'Buffer', 'URL', 'URLSearchParams',",
" 'TextEncoder', 'TextDecoder', 'clearInterval',",
" 'clearTimeout', 'setInterval', 'setTimeout',",
" 'queueMicrotask', 'clearImmediate', 'setImmediate',",
" 'module', 'require', 'assert',",
" 'async_hooks', 'buffer', 'child_process',",
" 'cluster', 'crypto', 'dgram',",
" 'dns', 'domain', 'events',",
" 'fs', 'http', 'http2',",
" 'https', 'inspector', 'net',",
" 'os', 'path', 'perf_hooks',",
" 'punycode', 'querystring', 'readline',",
" 'repl', 'stream', 'string_decoder',",
" 'tls', 'trace_events', 'tty',",
" 'url', 'v8', 'vm',",
" 'worker_threads', 'zlib', '_',",
" '_error', 'util'",
" 'Object', 'Function', 'Array',",
" 'Number', 'parseFloat', 'parseInt',",
" 'Infinity', 'NaN', 'undefined',",
" 'Boolean', 'String', 'Symbol',",
" 'Date', 'Promise', 'RegExp',",
" 'Error', 'EvalError', 'RangeError',",
" 'ReferenceError', 'SyntaxError', 'TypeError',",
" 'URIError', 'JSON', 'Math',",
" 'console', 'Intl', 'ArrayBuffer',",
" 'Uint8Array', 'Int8Array', 'Uint16Array',",
" 'Int16Array', 'Uint32Array', 'Int32Array',",
" 'Float32Array', 'Float64Array', 'Uint8ClampedArray',",
" 'BigUint64Array', 'BigInt64Array', 'DataView',",
" 'Map', 'BigInt', 'Set',",
" 'WeakMap', 'WeakSet', 'Proxy',",
" 'Reflect', 'decodeURI', 'decodeURIComponent',",
" 'encodeURI', 'encodeURIComponent', 'escape',",
" 'unescape', 'eval', 'isFinite',",
" 'isNaN', 'SharedArrayBuffer', 'Atomics',",
" 'globalThis', 'WebAssembly', 'global',",
" 'process', 'Buffer', 'URL',",
" 'URLSearchParams', 'TextEncoder', 'TextDecoder',",
" 'clearInterval', 'clearTimeout', 'setInterval',",
" 'setTimeout', 'queueMicrotask', 'clearImmediate',",
" 'setImmediate', 'module', 'require',",
" 'assert', 'async_hooks', 'buffer',",
" 'child_process', 'cluster', 'crypto',",
" 'dgram', 'dns', 'domain',",
" 'events', 'fs', 'http',",
" 'http2', 'https', 'inspector',",
" 'net', 'os', 'path',",
" 'perf_hooks', 'punycode', 'querystring',",
" 'readline', 'repl', 'stream',",
" 'string_decoder', 'tls', 'trace_events',",
" 'tty', 'url', 'v8',",
" 'vm', 'worker_threads', 'zlib',",
" '_', '_error', 'util'",
']'
].join('\n');

Expand Down