Repository navigation
Remove always-true conditional in findConfigForHtmlFile - #431
Merged
Merged
Conversation
options was only assigned right before an early return, so it was always undefined at the end of the function and the !options check was always true. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KuJTTYq3CpvR1S6x5iQxwH
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused refactor preserves all existing return paths and fallback behavior.
0 open findings
What changed in this PR
Removes a redundant conditional from configuration discovery without changing behavior.
Changes:
- Returns cached configuration directly.
- Unconditionally logs and returns
undefinedwhen no configuration is found.
| File | Description |
|---|---|
htmlhint-server/src/server.ts |
Simplifies findConfigForHtmlFile control flow. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Requested by Christian · project thread
Before:
findConfigForHtmlFileended withif (!options).optionswas only assigned right before an earlyreturn, so at that point it was alwaysundefinedand the check was always true (flagged as a useless conditional).After: the local
optionsvariable is gone. The loop returns the cached config directly, and the end of the function logs "No config file found" and returnsundefinedunconditionally.How: behaviour is unchanged; the function returns the same values in every path. Both packages compile and the file passes Prettier.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KuJTTYq3CpvR1S6x5iQxwH
Generated by Claude Code