Should have a custom eslint that devtools/client modules don't require devtools/server modules and vice versa




Developer Tools
a year ago
a year ago


(Reporter: fitzgen, Unassigned)


Firefox Tracking Flags

(Not tracked)


This has been coming up during the actor decoupling.

Our module requirements should be a dag, where if we simplify/group the module dependency graph to just devtools/server, devtools/shared, and devtools/client, then we should get this DAG (A->B == A requires B):

                         ^     ^
                         |     |
               .---------'     '---------.
               |                         |
               |                         |
    devtools/client            devtools/server

devtools/client should not depend on devtools/server and devtools/server should not depend on devtools/client.

Sometimes when this relationship is broken, the result is a module not being able to be loaded in Fennec (but not desktop). Sometimes everything silently works, entrenching us in future suckiness when untangling everything.

We should define a custom lint to statically assert these requirements.
Custom mozilla eslint rules can be found in the mozilla eslint plugin located at:

The new rule should go in \lib\rules\ and some usage doc should be written in \doc\
The new rule should also be indexed and turned off by default in \lib\index.js

This rule should be configurable. Something like this:

"no-unallowed-require": [
    {"from": "devtools/client", "to": "devtools/server"},
    {"from": "devtools/server", "to": "devtools/client"}
A small aside is at the moment, it's a bit hard to change the rules that run on try because (after bug 1265082) they are uploaded to tooltool which only some people have access to.  :mratcliffe has access on our team, and I am requesting access as well.

We should probably rework this design so the in-tree rules can be changed without updating tooltool, but anyway that's the current state of things.

Anyway, you can at least make local changes and test them locally.  Someone with tooltool access would be needed to update automation.
Severity: normal → enhancement
Priority: -- → P3

Comment 3

a year ago
Bug 1264649 added a "reject-some-requires" rule that can do this.
You need to log in before you can comment on or make changes to this bug.