Add an ESLint rule to reject new uses of Console.sys.mjs/Log.sys.mjs
Categories
(Developer Infrastructure :: Lint and Formatting, task, P3)
Tracking
(firefox123 fixed)
| Tracking | Status | |
|---|---|---|
| firefox123 | --- | fixed |
People
(Reporter: standard8, Assigned: standard8)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
As we want to stop using Console.sys.mjs/Log.sys.mjs, I think we should have an ESLint rule to reject new instances and warn about existing ones. This help to highlight to and remind developers about the fact they should be using console.createInstance instead. Especially as it looks like there's been some new instances relatively recently.
| Assignee | ||
Comment 1•2 years ago
|
||
Depends on D197503
Comment 2•2 years ago
|
||
Should be hold off warning about Log.sys.mjs before console.createInstance() is suitable as a replacement? I don't believe moving all these files to console.createInstance() will actually be possible in the current state of the world.
| Assignee | ||
Comment 3•2 years ago
|
||
(In reply to Mark Hammond [:markh] [:mhammond] from comment #2)
Should be hold off warning about Log.sys.mjs before
console.createInstance()is suitable as a replacement? I don't believe moving all these files toconsole.createInstance()will actually be possible in the current state of the world.
I forgot to mention this in the first comment, but I'd also like to get teams to start looking at what they are missing / why they can't use it, and discussing the issues and getting them filed and hopefully fixed. Having an active warning will hopefully help to remind those teams to do so, whilst also not preventing them from using it. I believe it is a better replacement in a lot of instances, but I agree not everyone is going to be able to switch to it straight-off.
I think if we are going to do something, we have to start somewhere - at the moment we're not making any progress, if anything, we're going backward. I think this is primarily due to lack of knowledge about the desire to remove the old ones. The best way we can communicate that is through linting.
Additionally, some of the file globs for where we'll report warnings rather than errors are also quite large, so I would prefer to have warnings there to ensure that new instances get raised.
| Assignee | ||
Comment 4•2 years ago
|
||
After some discussion with Gijs and :Mossop, we have decided to change the approach slightly. We will still report failures for new code, but won't report warnings on the existing code.
We will then firstly look to replace Console.sys.mjs with console.createInstance, since that is currently the closest. There's a couple of minor differences, which will hopefully not be too hard to resolve.
We will also still want to replace Log.sys.mjs and will start looking at that alongside other things, but if there are critical things that anyone knows are currently missing from the existing console.createInstance please can they be filed as blocking bug 1828156.
Updated•2 years ago
|
Comment 6•2 years ago
|
||
| bugherder | ||
Description
•