From 5ad91aa7df3d6bc185786e6eccd9e055fd951055 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Tue, 9 Mar 2021 17:58:28 +0100 Subject: [PATCH] Update: report es2021 globals in no-extend-native (refs #13602) (#14177) --- package.json | 2 +- tests/lib/rules/no-extend-native.js | 30 +++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 3a34facf5a3..440aa4faedf 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", "glob-parent": "^5.0.0", - "globals": "^12.1.0", + "globals": "^13.6.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", diff --git a/tests/lib/rules/no-extend-native.js b/tests/lib/rules/no-extend-native.js index ca5b430fafe..4cb4a64b35c 100644 --- a/tests/lib/rules/no-extend-native.js +++ b/tests/lib/rules/no-extend-native.js @@ -48,12 +48,6 @@ ruleTester.run("no-extend-native", rule, { { code: "{ let Object = function() {}; Object.prototype.p = 0 }", parserOptions: { ecmaVersion: 6 } - }, - - // TODO(mdjermanovic): This test should become `invalid` in the next major version, when we upgrade the `globals` package. - { - code: "WeakRef.prototype.p = 0", - env: { es2021: true } } ], invalid: [{ @@ -71,6 +65,30 @@ ruleTester.run("no-extend-native", rule, { data: { builtin: "BigInt" }, type: "AssignmentExpression" }] + }, { + code: "WeakRef.prototype.p = 0", + env: { es2021: true }, + errors: [{ + messageId: "unexpected", + data: { builtin: "WeakRef" }, + type: "AssignmentExpression" + }] + }, { + code: "FinalizationRegistry.prototype.p = 0", + env: { es2021: true }, + errors: [{ + messageId: "unexpected", + data: { builtin: "FinalizationRegistry" }, + type: "AssignmentExpression" + }] + }, { + code: "AggregateError.prototype.p = 0", + env: { es2021: true }, + errors: [{ + messageId: "unexpected", + data: { builtin: "AggregateError" }, + type: "AssignmentExpression" + }] }, { code: "Function.prototype['p'] = 0", errors: [{