Skip to content

ESLint: Enable recommendedTypeChecking lint rules#3911

Merged
florian-h05 merged 6 commits intoopenhab:mainfrom
jsjames:lint-add-typeChecked
Feb 23, 2026
Merged

ESLint: Enable recommendedTypeChecking lint rules#3911
florian-h05 merged 6 commits intoopenhab:mainfrom
jsjames:lint-add-typeChecked

Conversation

@jsjames
Copy link
Copy Markdown
Contributor

@jsjames jsjames commented Feb 20, 2026

This PR adds in tseslint.configs.recommendedTypeChecked to improve our typescript code. The largest required update is that the "any" type can no longer be used as a crutch as it eliminates any typescript checking.

Most of the files have been updated - there are a few where specific eslint checks have been disabled at the top of the file. Those can be addressed over time.

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Feb 20, 2026

#4696 Bundle Size — 12.83MiB (~+0.01%).

58cc8f0(current) vs bdcaa5f main#4693(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  Change 4 changes Regression 1 regression
                 Current
#4696
     Baseline
#4693
Regression  Initial JS 1.58MiB(~+0.01%) 1.58MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 6.72% 6.67%
Change  Chunks 603(+0.17%) 602
Change  Assets 687(+0.15%) 686
No change  Modules 2595 2595
No change  Duplicate Modules 0 0
No change  Duplicate Code 0% 0%
No change  Packages 123 123
No change  Duplicate Packages 1 1
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#4696
     Baseline
#4693
Regression  JS 11.11MiB (~+0.01%) 11.11MiB
No change  CSS 895.5KiB 895.5KiB
No change  Fonts 526.1KiB 526.1KiB
No change  Media 295.6KiB 295.6KiB
No change  IMG 45.73KiB 45.73KiB
No change  Other 847B 847B

Bundle analysis reportBranch jsjames:lint-add-typeCheckedProject dashboard


Generated by RelativeCIDocumentationReport issue

Signed-off-by: Jeff James <jeff@james-online.com>
@jsjames jsjames force-pushed the lint-add-typeChecked branch from cc8f520 to fbc249b Compare February 20, 2026 20:44
@jsjames jsjames requested a review from digitaldan February 20, 2026 22:31
@jsjames
Copy link
Copy Markdown
Contributor Author

jsjames commented Feb 20, 2026

@digitaldan - could you review the changes made to the thread-provider code. the changes are typescript enhancements to address some of the errors in linting.

Signed-off-by: Florian Hotze <dev@florianhotze.com>
Copy link
Copy Markdown
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

I have reviewed everything except for the thread-provider, over LGTM. A few comments:

Comment thread bundles/org.openhab.ui/web/src/js/openhab/sse.ts Outdated
Comment thread bundles/org.openhab.ui/web/src/js/openhab/auth.ts
@florian-h05 florian-h05 added the main ui Main UI label Feb 21, 2026
Signed-off-by: Jeff James <jeff@james-online.com>
@jsjames
Copy link
Copy Markdown
Contributor Author

jsjames commented Feb 21, 2026

I added the @typescript-eslint/promise-function-async rule and fixed those instances where a functions returned a promise and were not async. I'd recommend (and this is what I implemented) is that we rely on the autowrapping that occurs for async functions - i think that will be cleaner.

As an aside, I think we should enable this rule as well:
"@typescript-eslint/explicit-function-return-type": "error"

This will make the core more readable/documented as it will be clear what the return value is for functions. Thoughts?

@florian-h05
Copy link
Copy Markdown
Contributor

This will make the core more readable/documented as it will be clear what the return value is for functions. Thoughts?

For my part, I don't need it, as IntelliJ does a good job in displaying the return type if none is explicitly written down, and IMO it keeps the code "less verbose" to not write it explicitly.

Signed-off-by: Florian Hotze <dev@florianhotze.com>
Signed-off-by: Florian Hotze <dev@florianhotze.com>
Signed-off-by: Florian Hotze <dev@florianhotze.com>
Copy link
Copy Markdown
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!
Thread network map changes look good as well, but let's wait for @digitaldan to confirm.

@florian-h05 florian-h05 changed the title eslint: Added recommendedTypeChecking to lint rules ESLint: Enabled recommendedTypeChecking lint rules Feb 22, 2026
@florian-h05 florian-h05 added this to the 5.2 milestone Feb 22, 2026
@florian-h05 florian-h05 changed the title ESLint: Enabled recommendedTypeChecking lint rules ESLint: Enable recommendedTypeChecking lint rules Feb 22, 2026
@digitaldan
Copy link
Copy Markdown
Contributor

Sorry, just seeing this today, I just tried this out and it looks good to me 👍

Copy link
Copy Markdown
Contributor

@digitaldan digitaldan left a comment

Choose a reason for hiding this comment

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

LGTM

@florian-h05 florian-h05 merged commit 4c77f86 into openhab:main Feb 23, 2026
5 checks passed
@jsjames jsjames deleted the lint-add-typeChecked branch February 24, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

main ui Main UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants