Skip to content

Commit

Permalink
Update: report es2021 globals in no-extend-native (refs #13602) (#14177)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Mar 9, 2021
1 parent c295581 commit 5ad91aa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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",
Expand Down
30 changes: 24 additions & 6 deletions tests/lib/rules/no-extend-native.js
Expand Up @@ -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: [{
Expand All @@ -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: [{
Expand Down

0 comments on commit 5ad91aa

Please sign in to comment.