ESLint will now warn about uses of OS.File (but you won't get backed out)

14 views
Skip to first unread message

Gijs Kruitbosch

unread,
Jul 28, 2021, 11:33:56 AMJul 28
to firefox-dev, dev-pl...@lists.mozilla.org

Hello,

I just activated Lando on a new linter rule for OS.File use. Once these changes reach mozilla-central, eslint will log warnings for uses of OS.File, suggestion you use IOUtils for asynchronous IO from javascript instead. See this previous message for the history there. Note: these are warnings, not errors, so you won't be backed out for touching code that uses OS.File. ***

IOUtils is more performant and in many ways more user-friendly (for instance, it has convenience APIs for reading and writing JSON and/or compressed files, instead of having to parse and/or stringify things yourself,  it tries to minimize copy operations for such work, and it doesn't require an expensive JS worker and many scripts in them to run).

If writing new code, please use IOUtils instead of OS.File (or worse, synchronous IO). If you're touching old code that uses OS.File, and see linter comments showing up on phabricator or try, please consider if you can easily convert these uses while you're changing that code anyway; if not, consider filing a bug and linking it from the relevant code.

Once specific modules/subdirectories have stopped using OS.File, they may wish to upgrade the warning to an error in their code.

Many thanks to Keefer, Emma and Barret for all their work on IOUtils and updating old code, making changes like this possible!

Thanks,
Gijs


*** We're using a warning rather than an error because there are hundreds of extant uses in the tree still. The overwhelming majority are in tests; we're prioritizing converting non-test uses in the startup path, to help improve Firefox startup performance.

Reply all
Reply to author
Forward
0 new messages