ES Lint rules for SJS files incorrectly emit warnings on importation of the URLSearchParams method.
Categories
(Developer Infrastructure :: Lint and Formatting, defect)
Tracking
(firefox-esr91 unaffected, firefox94 unaffected, firefox95 wontfix, firefox96 fixed)
Tracking | Status | |
---|---|---|
firefox-esr91 | --- | unaffected |
firefox94 | --- | unaffected |
firefox95 | --- | wontfix |
firefox96 | --- | fixed |
People
(Reporter: bigiri, Assigned: standard8)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
Many *.sjs files use Components.utils.importGlobalProperties(["URLSearchParams"]);
to import the URLSearchParams
method. Unfortunately, the ES Lint rules trigger a warning for this common use case.
The ES Lint warning for this is warning Use Cu rather than Components.utils mozilla/use-cc-etc (eslint)
If the suggestion replace Components.utls
with Cu
is followed then the following warning show up instead Unnecessary call to Cu.importGlobalProperties (webidl names are automatically imported)
Unfortunately, that import is necessary to use URLSearchParams
in an *.sjs file.
ES Lint rules should be modified to allow the import of URLSearchParams
and anything else that may be necessary in *.sjs files without emitting warnings.
These warning are emitted here:
Comment 1•3 years ago
|
||
Comment 2•3 years ago
|
||
(In reply to Bernard Igiri from comment #0)
Many *.sjs files use
Components.utils.importGlobalProperties(["URLSearchParams"]);
to import theURLSearchParams
method. Unfortunately, the ES Lint rules trigger a warning for this common use case.The ES Lint warning for this is
warning Use Cu rather than Components.utils mozilla/use-cc-etc (eslint)
.
To be clear, this warning is correct. It's purely stylistic, Components.utils
is the same as Cu
, but the latter is shorter and easier to read.
If the suggestion replace
Components.utils
withCu
is followed then the following warning show up insteadUnnecessary call to Cu.importGlobalProperties (webidl names are automatically imported)
Unfortunately, that import is necessary to use
URLSearchParams
in an *.sjs file.
This seems to mean that we should drop this rule from the .sjs file list. Mark, does that seem right?
Assignee | ||
Comment 3•3 years ago
|
||
(In reply to :Gijs (he/him) from comment #2)
(In reply to Bernard Igiri from comment #0)
Many *.sjs files use
Components.utils.importGlobalProperties(["URLSearchParams"]);
to import theURLSearchParams
method. Unfortunately, the ES Lint rules trigger a warning for this common use case.The ES Lint warning for this is
warning Use Cu rather than Components.utils mozilla/use-cc-etc (eslint)
.To be clear, this warning is correct. It's purely stylistic,
Components.utils
is the same asCu
, but the latter is shorter and easier to read.
In production code, Cu
is slightly better performance than Components.utils
as it avoids the dot. Keeping the same style everywhere is what we should do though.
If the suggestion replace
Components.utils
withCu
is followed then the following warning show up insteadUnnecessary call to Cu.importGlobalProperties (webidl names are automatically imported)
Unfortunately, that import is necessary to use
URLSearchParams
in an *.sjs file.This seems to mean that we should drop this rule from the .sjs file list. Mark, does that seem right?
I checked with Nika today about possible solutions. Whilst we will at some stage need to fix it for bug 1501127 and friends, there isn't a quick and easy solution for sjs files which use a custom sandbox.
Therefore, for now at least, we'll disable the rule on sjs files.
Assignee | ||
Comment 4•3 years ago
|
||
sjs files have a separate sandbox, and require Cu.importGlobalProperties for now.
Updated•3 years ago
|
Comment 6•3 years ago
|
||
Set release status flags based on info from the regressing bug 1576768
Assignee | ||
Updated•3 years ago
|
Comment 7•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Updated•2 years ago
|
Description
•