Skip to content

Enable more lints - #897

Merged
Nutomic merged 4 commits into
mainfrom
enable-lints
Mar 24, 2026
Merged

Enable more lints#897
Nutomic merged 4 commits into
mainfrom
enable-lints

Conversation

@Nutomic

@Nutomic Nutomic commented Mar 16, 2026

Copy link
Copy Markdown
Member

No description provided.

Comment thread src/http.ts
interface LemmyErrorDummy {
error: string;
message?: string;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Had to add this because LemmyErrorType doesnt always have message, and so TS throws an error.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Isn't that accurate? shouldn't it be then json2.message ?? ""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Seems your right. Strange that there is no lint error.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

But then you should be able to use LemmyErrorType ? its basically the same definition, every option has error but some have message?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just make message in LemmyError optional, then you shouldn't need this dummy type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not working: Property 'message' does not exist on type '{ error: "block_keyword_too_short"; }'

Comment thread src/other_types.ts
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-empty-object-type */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Errors about the empty interface definitions below. It suggests using export type ListMediaI = ListMedia which passes lint, but not sure if its correct.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

lukeautry/tsoa#1841

@Nutomic

Nutomic commented Mar 17, 2026

Copy link
Copy Markdown
Member Author

I tried to revert the changes from #888 and #891 to see if lint catches them now. Strangely there are no errors thrown. Seems like something is still missing for proper linting.

Comment thread tsconfig.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably needs prettier, and the woodpecker prettier lint should also check this file.

@Nutomic Nutomic Mar 23, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done, wasnt running prettier in CI at all.

Comment thread eslint.config.mjs
"quote-props": 0,
"unicorn/filename-case": 0,
},
rules: {},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe its not finding any because rules here is empty?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removing this line makes no difference.

Comment thread src/http.ts
headers: this.#headers,
});
return response.json();
return response.json() as ResponseType;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Surprised this needs an as cast

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This one actually throws an error: Unsafe return of a value of type Promise @typescript-eslint/no-unsafe-return

Comment thread src/http.ts
interface LemmyErrorDummy {
error: string;
message?: string;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just make message in LemmyError optional, then you shouldn't need this dummy type.

@dessalines dessalines left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tried messing with some things a little, but its probably fine as is. The as casting seems to be necessary for errors.

@Nutomic
Nutomic merged commit f351816 into main Mar 24, 2026
2 checks passed
dessalines added a commit that referenced this pull request Mar 24, 2026
* 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>
dessalines added a commit that referenced this pull request Mar 24, 2026
* 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>
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