Enable more lints - #897
Conversation
| interface LemmyErrorDummy { | ||
| error: string; | ||
| message?: string; | ||
| } |
There was a problem hiding this comment.
Had to add this because LemmyErrorType doesnt always have message, and so TS throws an error.
There was a problem hiding this comment.
Isn't that accurate? shouldn't it be then json2.message ?? ""
There was a problem hiding this comment.
Seems your right. Strange that there is no lint error.
There was a problem hiding this comment.
But then you should be able to use LemmyErrorType ? its basically the same definition, every option has error but some have message?
There was a problem hiding this comment.
No it throws this error:
src/http.ts:2941:15 - error TS2339: Property 'message' does not exist on type 'LemmyErrorType'.
Property 'message' does not exist on type '{ error: "block_keyword_too_short"; }'.
2941 json2.message,
~~~~~~~
Found 1 error in src/http.ts:2941
There was a problem hiding this comment.
Just make message in LemmyError optional, then you shouldn't need this dummy type.
There was a problem hiding this comment.
Not working: Property 'message' does not exist on type '{ error: "block_keyword_too_short"; }'
| @@ -1,3 +1,4 @@ | |||
| /* eslint-disable @typescript-eslint/no-empty-object-type */ | |||
There was a problem hiding this comment.
Errors about the empty interface definitions below. It suggests using export type ListMediaI = ListMedia which passes lint, but not sure if its correct.
There was a problem hiding this comment.
TSOA fails with type aliases and @queries decorator. So it wouldnt work.
But I have PR to fix that and then you can get rid of these below
There was a problem hiding this comment.
Probably needs prettier, and the woodpecker prettier lint should also check this file.
There was a problem hiding this comment.
Done, wasnt running prettier in CI at all.
| "quote-props": 0, | ||
| "unicorn/filename-case": 0, | ||
| }, | ||
| rules: {}, |
There was a problem hiding this comment.
Maybe its not finding any because rules here is empty?
There was a problem hiding this comment.
Removing this line makes no difference.
| headers: this.#headers, | ||
| }); | ||
| return response.json(); | ||
| return response.json() as ResponseType; |
There was a problem hiding this comment.
Surprised this needs an as cast
There was a problem hiding this comment.
This one actually throws an error: Unsafe return of a value of type Promise @typescript-eslint/no-unsafe-return
| interface LemmyErrorDummy { | ||
| error: string; | ||
| message?: string; | ||
| } |
There was a problem hiding this comment.
Just make message in LemmyError optional, then you shouldn't need this dummy type.
dessalines
left a comment
There was a problem hiding this comment.
I tried messing with some things a little, but its probably fine as is. The as casting seems to be necessary for errors.
* Update dependency lint-staged to v16.4.0 (#893) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency @redocly/cli to v2.21.1 (#892) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update pnpm to v10.32.1 (#894) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update typescript-eslint monorepo to v8.57.0 (#895) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Fix deleteMediaAdmin & deleteMedia wrong OpenAPI documentation #884 (#885) * Fix #887 adding missing async to endpoints (#888) * Fix #890 Some endpoints use 'object' instead of the actual type (#891) * Remove sleepless from codeowners. (#899) * Remove sleepless from codeowners. * Add @Nutomic as a code owner * Rename to importUserSettings & exportUserSettings (#900) * Update typescript-eslint monorepo to v8.57.1 (#901) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency @redocly/cli to v2.24.1 (#902) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency eslint to v10.1.0 (#903) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Enable more lints (#897) * Enable more lints (fixes #896) * review * format * Add nodeinfo (fixes #459) (#898) * Add nodeinfo (fixes #459) * review * ternary * route * fix routes, add superclass * fmt * update * 1.0.0-search.0 * fix tsoa --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Maarten Vercruysse <67873169+MV-GH@users.noreply.github.com> Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
* Adding list_persons, updating types from main * 1.0.0-search-optimizations-1.0 * Search optimizations 1 nutomic (#904) * Update dependency lint-staged to v16.4.0 (#893) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency @redocly/cli to v2.21.1 (#892) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update pnpm to v10.32.1 (#894) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update typescript-eslint monorepo to v8.57.0 (#895) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Fix deleteMediaAdmin & deleteMedia wrong OpenAPI documentation #884 (#885) * Fix #887 adding missing async to endpoints (#888) * Fix #890 Some endpoints use 'object' instead of the actual type (#891) * Remove sleepless from codeowners. (#899) * Remove sleepless from codeowners. * Add @Nutomic as a code owner * Rename to importUserSettings & exportUserSettings (#900) * Update typescript-eslint monorepo to v8.57.1 (#901) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency @redocly/cli to v2.24.1 (#902) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency eslint to v10.1.0 (#903) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Enable more lints (#897) * Enable more lints (fixes #896) * review * format * Add nodeinfo (fixes #459) (#898) * Add nodeinfo (fixes #459) * review * ternary * route * fix routes, add superclass * fmt * update * 1.0.0-search.0 * fix tsoa --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Maarten Vercruysse <67873169+MV-GH@users.noreply.github.com> Co-authored-by: Dessalines <dessalines@users.noreply.github.com> --------- Co-authored-by: Nutomic <me@nutomic.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Maarten Vercruysse <67873169+MV-GH@users.noreply.github.com>
No description provided.