sofie-core icon indicating copy to clipboard operation
sofie-core copied to clipboard

feat: Add ESLint rule to standardise file extensions on imports

Open rjmunro opened this issue 3 months ago • 1 comments

About the Contributor

Type of Contribution

This is a code improvement

Current Behavior

Between release52 and release53, particularly in d02f4162, the standard for imports seemed to be changed to include .js on the end of the filename. This caused merge conflicts when I was trying to rebase a branch targeted at release52 onto release53.

New Behavior

Use an eslint plugin to enforce extensions on file imports. This enabled me to automatically resolve a bunch of merge conflicts using my git resolve-formatting-conflicts tool.

Currently I have applied this is just to the webui package because that's where I was working. It could probably be done more widely.

Testing

  • [ ] I have added one or more unit tests for this PR
  • [ ] I have updated the relevant unit tests
  • [X] No unit test changes are needed for this PR

Affected areas

This PR affects code formatting and it's enforcement.

Time Frame

  • Not urgent

Other Information

It looks like there is a script to do the modification here: https://github.com/Sofie-Automation/sofie-core/pull/1432/commits/88c500fff3821b76ce27167bae9d01070711675c. The advantage of this is that it is part of normal ESLint formatting, so IDEs and will highlight and auto-correct, CI will catch it, and it will work with tools like git resolve-formatting-conflicts without any further customisation.

Status

  • [x] PR is ready to be reviewed.
  • [ ] The functionality has been tested by the author.
  • [ ] Relevant unit tests has been added / updated.
  • [ ] Relevant documentation (code comments, system documentation) has been added / updated.

rjmunro avatar Oct 16 '25 13:10 rjmunro

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests.

:loudspeaker: Thoughts on this report? Let us know!

codecov-commenter avatar Oct 16 '25 13:10 codecov-commenter