Skip to content

Conversation

@rjmunro
Copy link
Contributor

@rjmunro rjmunro commented Oct 16, 2025

About the Contributor

Type of Contribution

This is a code improvement

Current Behavior

Between release52 and release53, particularly in d02f416, 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
  • 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: 88c500f. 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

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

@codecov-commenter
Copy link

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

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This was confusing ESLint because it effectively overrode packages/webui/src/client/ui/Collections.ts
@rjmunro rjmunro force-pushed the rjmunro/improve-eslint branch from 95848d1 to 33949da Compare October 16, 2025 14:12
Needed on Linux macOS and other unix-like systems.
@rjmunro rjmunro marked this pull request as ready for review October 22, 2025 13:26
@rjmunro rjmunro requested a review from a team as a code owner October 22, 2025 13:26
Copy link
Member

@Julusian Julusian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like for the backend code there is already a rule in place for this. Perhaps this should use the same plugin instead of adding another one?

I believe that rule is https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/file-extension-in-import.md

That plugin was omitted from the webui as its not using node at runtime, so some of the rules dont make sense. But maybe there are a handful of rules in that plugin which do make sense to enable?

'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'import-extensions/require-extensions': ['error', { expectedExtensions: ['js'] }],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These shouldn't be added here, as these are permanent additions, not Temporary rules to be removed over time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants