Update `getIsGlobalScope` to cover class static block
Categories
(Developer Infrastructure :: Lint and Formatting, task)
Tracking
(firefox103 fixed)
Tracking | Status | |
---|---|---|
firefox103 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(3 files, 1 obsolete file)
getIsGlobalScope
in helpers.js
covers functions, but not new things such as class static block, and maybe also class property, depending on what the "is global scope" expects
getIsFunctionNode(node) {
switch (node.type) {
case "ArrowFunctionExpression":
case "FunctionDeclaration":
case "FunctionExpression":
return true;
}
return false;
},
...
getIsGlobalScope(ancestors) {
for (let parent of ancestors) {
if (this.getIsFunctionNode(parent)) {
return false;
}
}
return true;
},
Assignee | ||
Comment 1•3 years ago
|
||
Apparently we mis-calculate the global variables in the following case:
class C {
static {
this.foo = 10;
}
}
foo
becomes a part of global variables because it's not enclosed by function, but this
there is class C
.
I'll fix the case and add testcase for globals.js
Assignee | ||
Comment 2•3 years ago
|
||
The helper function must be explicit about what it's actually calculating, and each consumer should be explicit about what it wants.
For the case in globals.js
, it's about what the this
value is. that's not about scope actually, and arrow function should be ignored.
For the case in reject-top-level-await.js
, it's about whether it's top-level script or not.
For the case in var-only-at-top-level.js
, it's about where the var
declaration belongs to, so it's really about scope.
All of them are different conditions.
Assignee | ||
Comment 3•3 years ago
|
||
Updated•3 years ago
|
Assignee | ||
Comment 4•3 years ago
|
||
Depends on D149606
Assignee | ||
Comment 5•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Backed out for causing node test failures on globals.js
Failure line: TEST-UNEXPECTED-FAIL | globals.js | should reflect top-level this property assignment | Cannot find module '@babel/plugin-syntax-jsx'
[task 2022-06-22T12:24:53.943Z] TEST-PASS | consistent-if-bracing.js | if (true) {1} else if (true) {2} else 0
[task 2022-06-22T12:24:53.945Z] TEST-PASS | consistent-if-bracing.js | if (true) {1} else if (true) {2} else if (true) 3; else {0}
[task 2022-06-22T12:24:53.946Z] TEST-PASS | consistent-if-bracing.js | if (true) {if (true) 1; else {0}} else {0}
[task 2022-06-22T12:24:53.954Z] TEST-UNEXPECTED-FAIL | globals.js | should reflect top-level this property assignment | Cannot find module '@babel/plugin-syntax-jsx'
[task 2022-06-22T12:24:53.954Z] Require stack:
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/plugins.js
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/index.js
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/index.js
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/babel-core.cjs
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/handle-message.cjs
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/client.cjs
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/index.cjs
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/avoid-removeChild.js
[task 2022-06-22T12:24:53.954Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js
[task 2022-06-22T12:24:53.955Z] TEST-UNEXPECTED-FAIL | globals.js | should reflect this property assignment inside block | Cannot find module '@babel/plugin-syntax-jsx'
[task 2022-06-22T12:24:53.955Z] Require stack:
[task 2022-06-22T12:24:53.955Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/plugins.js
[task 2022-06-22T12:24:53.955Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/index.js
[task 2022-06-22T12:24:53.955Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/index.js
[task 2022-06-22T12:24:53.955Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/babel-core.cjs
[task 2022-06-22T12:24:53.955Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/handle-message.cjs
[task 2022-06-22T12:24:53.955Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/client.cjs
[task 2022-06-22T12:24:53.955Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/index.cjs
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/avoid-removeChild.js
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js
[task 2022-06-22T12:24:53.956Z] TEST-UNEXPECTED-FAIL | globals.js | should ignore this property assignment inside function declaration | Cannot find module '@babel/plugin-syntax-jsx'
[task 2022-06-22T12:24:53.956Z] Require stack:
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/plugins.js
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/index.js
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/index.js
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/babel-core.cjs
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/handle-message.cjs
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/client.cjs
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/index.cjs
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/avoid-removeChild.js
[task 2022-06-22T12:24:53.956Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js
[task 2022-06-22T12:24:53.957Z] TEST-UNEXPECTED-FAIL | globals.js | should ignore this property assignment inside function expression | Cannot find module '@babel/plugin-syntax-jsx'
[task 2022-06-22T12:24:53.957Z] Require stack:
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/plugins.js
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/index.js
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/index.js
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/babel-core.cjs
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/handle-message.cjs
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/client.cjs
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/index.cjs
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/avoid-removeChild.js
[task 2022-06-22T12:24:53.957Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js
[task 2022-06-22T12:24:53.958Z] TEST-UNEXPECTED-FAIL | globals.js | should ignore this property assignment inside method | Cannot find module '@babel/plugin-syntax-jsx'
[task 2022-06-22T12:24:53.958Z] Require stack:
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/plugins.js
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/index.js
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/index.js
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/babel-core.cjs
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/handle-message.cjs
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/client.cjs
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/index.cjs
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/avoid-removeChild.js
[task 2022-06-22T12:24:53.958Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js
[task 2022-06-22T12:24:53.959Z] TEST-UNEXPECTED-FAIL | globals.js | should ignore this property assignment inside accessor | Cannot find module '@babel/plugin-syntax-jsx'
[task 2022-06-22T12:24:53.959Z] Require stack:
<...>
[task 2022-06-22T12:24:53.965Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
[task 2022-06-22T12:24:53.965Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/avoid-removeChild.js
[task 2022-06-22T12:24:53.965Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js
[task 2022-06-22T12:24:53.966Z] TEST-UNEXPECTED-FAIL | globals.js | should ignore this property assignment inside class static private property | Cannot find module '@babel/plugin-syntax-jsx'
[task 2022-06-22T12:24:53.966Z] Require stack:
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/plugins.js
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/config/files/index.js
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/core/lib/index.js
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/babel-core.cjs
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/worker/handle-message.cjs
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/client.cjs
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/node_modules/@babel/eslint-parser/lib/index.cjs
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/avoid-removeChild.js
[task 2022-06-22T12:24:53.966Z] - /builds/worker/checkouts/gecko/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-removeChild.js
[task 2022-06-22T12:24:53.967Z] TEST-PASS | lazy-getter-object-name.js | | ChromeUtils.defineESModuleGetters(lazy, {| Services: "resource://gre/modules/Services.sys.mjs",| });|
[task 2022-06-22T12:24:53.968Z] TEST-PASS | lazy-getter-object-name.js | | ChromeUtils.defineESModuleGetters(obj, {| Services: "resource://gre/modules/Services.sys.mjs",| });|
[task 2022-06-22T12:24:53.969Z] TEST-PASS | lazy-getter-object-name.js | | ChromeUtils.defineESModuleGetters(this, {| Services: "resource://gre/modules/Services.sys.mjs",| });|
[task 2022-06-22T12:24:53.970Z] TEST-PASS | lazy-getter-object-name.js | | ChromeUtils.defineESModuleGetters(window, {| Services: "resource://gre/modules/Services.sys.mjs",| });|
[task 2022-06-22T12:24:53.972Z] TEST-PASS | mark-exported-symbols-as-used.js | var EXPORTED_SYMBOLS = ['foo'];
Assignee | ||
Comment 8•3 years ago
|
||
Assignee | ||
Updated•3 years ago
|
Comment 10•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cc9b5695283b
https://hg.mozilla.org/mozilla-central/rev/3aa5e8a9fa07
https://hg.mozilla.org/mozilla-central/rev/33eec495fb13
Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Description
•