ref: Enable explicit-function-return-type eslint rule#742
Merged
Conversation
Member
Author
|
hmm looks like I broke some tests 😕 -- setting to draft for now |
Lms24
commented
May 20, 2025
6c7c1ea to
fb03f50
Compare
Lms24
commented
May 20, 2025
| } | ||
| // TODO(v4): Don't export this from the package but keep the utils version | ||
| // eslint-disable-next-line @typescript-eslint/explicit-function-return-type | ||
| export const getBuildInformation = actualGetBuildInformation; |
Member
Author
There was a problem hiding this comment.
We had 1:1 the same implementation in the actualGetBuildInformation util function, so I just removed the duplication (but kept the top level export deprecated).
Comment on lines
+270
to
+287
| /** | ||
| * Simplified `renderChunk` hook type from Rollup. | ||
| * We can't reference the type directly because the Vite plugin complains | ||
| * about type mismatches | ||
| */ | ||
| type RenderChunkHook = ( | ||
| code: string, | ||
| chunk: { | ||
| fileName: string; | ||
| } | ||
| ) => { | ||
| code: string; | ||
| map: SourceMap; | ||
| } | null; | ||
|
|
||
| export function createRollupDebugIdInjectionHooks(): { | ||
| renderChunk: RenderChunkHook; | ||
| } { |
Member
Author
There was a problem hiding this comment.
the comment explains this but maybe just to add: I can't use UnpluginOptions["renderChunk"]; because renderChunk is not a hook known to Unplugin. We manually pass in this hook in a plugin specifically for Rollup and Vite.
Comment on lines
+365
to
+369
| writeBundle: ( | ||
| outputOptions: { dir?: string; file?: string }, | ||
| bundle: { [fileName: string]: unknown } | ||
| ) => Promise<void>; | ||
| } { |
Member
Author
There was a problem hiding this comment.
Same for writeBundle as for renderChunk (see comment above)
andreiborza
approved these changes
May 21, 2025
Member
andreiborza
left a comment
There was a problem hiding this comment.
Thanks for improving this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR turns on the
explicit-function-return-typeeslint rule. I noticed in #741 that we tended to export public API with implicit function return types (and sometimes even declared types dynamically from implicit function return types). This has high potential to introduce accidental breaking changes. While I rewrote the biggest offenders in #741, this PR now turns on an eslint rule to enforce explicit function return types.As a result of the eslint rule, I had to turn add some return types but most of them are very straight forward. I'll leave comments on things that need special attention.