Skip to content

Commit 5ad91aa

Browse files
authored
Update: report es2021 globals in no-extend-native (refs #13602) (#14177)
1 parent c295581 commit 5ad91aa

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"file-entry-cache": "^6.0.1",
6464
"functional-red-black-tree": "^1.0.1",
6565
"glob-parent": "^5.0.0",
66-
"globals": "^12.1.0",
66+
"globals": "^13.6.0",
6767
"ignore": "^4.0.6",
6868
"import-fresh": "^3.0.0",
6969
"imurmurhash": "^0.1.4",

tests/lib/rules/no-extend-native.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ ruleTester.run("no-extend-native", rule, {
4848
{
4949
code: "{ let Object = function() {}; Object.prototype.p = 0 }",
5050
parserOptions: { ecmaVersion: 6 }
51-
},
52-
53-
// TODO(mdjermanovic): This test should become `invalid` in the next major version, when we upgrade the `globals` package.
54-
{
55-
code: "WeakRef.prototype.p = 0",
56-
env: { es2021: true }
5751
}
5852
],
5953
invalid: [{
@@ -71,6 +65,30 @@ ruleTester.run("no-extend-native", rule, {
7165
data: { builtin: "BigInt" },
7266
type: "AssignmentExpression"
7367
}]
68+
}, {
69+
code: "WeakRef.prototype.p = 0",
70+
env: { es2021: true },
71+
errors: [{
72+
messageId: "unexpected",
73+
data: { builtin: "WeakRef" },
74+
type: "AssignmentExpression"
75+
}]
76+
}, {
77+
code: "FinalizationRegistry.prototype.p = 0",
78+
env: { es2021: true },
79+
errors: [{
80+
messageId: "unexpected",
81+
data: { builtin: "FinalizationRegistry" },
82+
type: "AssignmentExpression"
83+
}]
84+
}, {
85+
code: "AggregateError.prototype.p = 0",
86+
env: { es2021: true },
87+
errors: [{
88+
messageId: "unexpected",
89+
data: { builtin: "AggregateError" },
90+
type: "AssignmentExpression"
91+
}]
7492
}, {
7593
code: "Function.prototype['p'] = 0",
7694
errors: [{

0 commit comments

Comments
 (0)