import-globals-from doesn't work with some modern ES nodes (mozilla/import-globals)
Categories
(Developer Infrastructure :: Lint and Formatting, defect)
Tracking
(firefox101 fixed)
Tracking | Status | |
---|---|---|
firefox101 | --- | fixed |
People
(Reporter: freaktechnik, Assigned: standard8)
References
Details
Attachments
(1 file)
Since the eslint upgrade eslint seems to produce some AST nodes that aren't supported by estraverse:
Error: Unknown node type PrivateIdentifier.
Occurred while linting /home/martin/dev/mozilla-central/comm/calendar/base/content/calendar-chrome-startup.js:24
Rule: "mozilla/import-globals"
at Controller.traverse (/home/martin/dev/mozilla-central/node_modules/estraverse/estraverse.js:454:31)
at Object.traverse (/home/martin/dev/mozilla-central/node_modules/estraverse/estraverse.js:646:27)
at Object.walkAST (/home/martin/dev/mozilla-central/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js:202:16)
at Object.getGlobalsForFile (/home/martin/dev/mozilla-central/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js:211:13)
at GlobalsForNode.Program (/home/martin/dev/mozilla-central/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js:126:47)
at /home/martin/dev/mozilla-central/tools/lint/eslint/eslint-plugin-mozilla/lib/globals.js:213:39
at Controller.enter (/home/martin/dev/mozilla-central/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js:204:9)
at Controller.__execute (/home/martin/dev/mozilla-central/node_modules/estraverse/estraverse.js:330:31)
at Controller.traverse (/home/martin/dev/mozilla-central/node_modules/estraverse/estraverse.js:434:28)
at Object.traverse (/home/martin/dev/mozilla-central/node_modules/estraverse/estraverse.js:646:27)
I think the code that ultimately leads to the error is in https://searchfox.org/comm-central/source/calendar/base/content/widgets/calendar-filter.js#1012 - so inside a file that globals should be imported from. Since it has private class fields it matches up with the PrivateIdentifier
node.
As a workaround we're not using import-globals-from
but this should probably be fixed so the rule can handle the new AST nodes.
Assignee | ||
Comment 1•2 years ago
|
||
I suspect somehow c-c is picking up the newer version of estraverse or eslint-scope. m-c doesn't seem to have this issue, even though it does use private class fields.
Anyway, the proper fix would probably be to update this list with the PrivateIdentifier
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
Due to babel still requiring an old version of estraverse, this disables our setup checking for changes
to modules in the eslint-plugin-mozilla package.json. For now, we'll need to remember to ensure there
is a top-level update to go with any changes - though that normally happens anyway.
For good measure, this also updates some of the top-level modules to ensure that node_modules is re-installed for everyone.
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cb0804d46705 Update eslint-plugin-mozilla's version of estraverse to fix issues with private identifiers. r=mossop
Comment 4•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Description
•