feat(linter)!: sync sindresorhus/globals; removed Object.prototype properties from builtin and es* globals (#6991)

This commit is contained in:
Boshen 2024-10-29 04:13:20 +00:00
parent 8cbf3f09d6
commit 9fd9f4f5b9
4 changed files with 630 additions and 50 deletions

File diff suppressed because it is too large Load diff

View file

@ -96,8 +96,6 @@ fn test() {
// "/*eslint-env browser*/ window;",
// "/*eslint-env node*/ require(\"a\");",
"Object; isNaN();",
"toString()",
"hasOwnProperty()",
"function evilEval(stuffToEval) { var ultimateAnswer; ultimateAnswer = 42; eval(stuffToEval); }",
"typeof a",
"typeof (a)",
@ -184,6 +182,8 @@ fn test() {
"class C { static { let a; } [a]; }",
"class C { static { function a() {} } [a]; }",
"class C { static { var a; } } a;",
"toString()",
"hasOwnProperty()",
];
Tester::new(NoUndef::NAME, pass, fail).test_and_snapshot();

View file

@ -156,3 +156,15 @@ source: crates/oxc_linter/src/tester.rs
1 │ class C { static { var a; } } a;
· ─
╰────
⚠ eslint(no-undef): 'toString' is not defined.
╭─[no_undef.tsx:1:1]
1 │ toString()
· ────────
╰────
⚠ eslint(no-undef): 'hasOwnProperty' is not defined.
╭─[no_undef.tsx:1:1]
1 │ hasOwnProperty()
· ──────────────
╰────

View file

@ -1,6 +1,9 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to run `cargo run -p javascript_globals`.
use phf::{phf_map, Map};
pub static ENVIRONMENTS: Map<&'static str, Map<&'static str, bool>> = phf_map! {
pub static GLOBALS: Map<&'static str, Map<&'static str, bool>> = phf_map! {
{{#each envs }}
"{{name}}" => phf_map! {
{{#each vars}}