Closed Bug 1771751 Opened 2 years ago Closed 2 years ago

Add ESLint rule that rejects static import for system ESM from non-system ESM

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(firefox103 fixed)

RESOLVED FIXED
103 Branch
Tracking Status
firefox103 --- fixed

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

At the top-level of the system ESM, other system ESMs can be imported with static import declaration.
This works as expected only inside system ESM, and doing the same in non-system ESM (such as module loaded by <script type="module" ...> in chrome-priv window) doesn't work as expected:

  • the module (and dependents) is loaded into different global than then shared global, and it's not the per-process singleton
  • it doesn't immediately throw error, because system ESM is subset of standard ESM

And this situation likely to happen by copy-paste the code that imports system ESM, from system ESM to non-system ESM.

we'd better having an ESLint rule that detects such situation and throw error.

Component: XPConnect → Lint and Formatting
Product: Core → Firefox Build System
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/b94c92657e73
Reject static import for system module from non-system module. r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: