ESLint: Enable recommendedTypeChecking lint rules#3911
ESLint: Enable recommendedTypeChecking lint rules#3911florian-h05 merged 6 commits intoopenhab:mainfrom
Conversation
#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
Bundle size by type
Bundle analysis report Branch jsjames:lint-add-typeChecked Project dashboard Generated by RelativeCI Documentation Report issue |
Signed-off-by: Jeff James <jeff@james-online.com>
cc8f520 to
fbc249b
Compare
|
@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>
florian-h05
left a comment
There was a problem hiding this comment.
I have reviewed everything except for the thread-provider, over LGTM. A few comments:
Signed-off-by: Jeff James <jeff@james-online.com>
|
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: 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>
florian-h05
left a comment
There was a problem hiding this comment.
LGTM, thanks!
Thread network map changes look good as well, but let's wait for @digitaldan to confirm.
|
Sorry, just seeing this today, I just tried this out and it looks good to me 👍 |
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.