Closed Bug 1872674 Opened 7 months ago Closed 6 months ago

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)

RESOLVED 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.

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.

(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 to console.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.

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.

Summary: Add an ESLint rule to reject new uses of Console.sys.mjs/Log.sys.mjs and warn about existing ones → Add an ESLint rule to reject new uses of Console.sys.mjs/Log.sys.mjs
Attachment #9370715 - Attachment description: Bug 1872674 - Add an ESLint rule to reject new uses of Console.sys.mjs/Log.sys.mjs and warn about existing ones. r?Mossop! → Bug 1872674 - Add an ESLint rule to reject new uses of Console.sys.mjs/Log.sys.mjs. r?Mossop!
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4162875c7a85
Add an ESLint rule to reject new uses of Console.sys.mjs/Log.sys.mjs. r=mossop
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: