Audit helper-built thrown Error messages - #51412
Merged
pelikhan merged 5 commits intoAug 8, 2026
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix message argument check for CallExpression in require-error-code-in-thrown-error
Audit helper-built thrown Error messages
Aug 8, 2026
pelikhan
marked this pull request as ready for review
August 8, 2026 16:40
pelikhan
deleted the
copilot/eslint-factory-require-error-code-in-thrown-error
branch
August 8, 2026 16:41
Contributor
There was a problem hiding this comment.
Pull request overview
Extends error-code linting to helper-built messages and standardizes MCP validation errors.
Changes:
- Audits local helper calls and flags unresolved calls.
- Adds
ERR_VALIDATIONprefixes to enhanced errors. - Expands rule and MCP tests.
Show a summary per file
| File | Description |
|---|---|
eslint-factory/src/rules/require-error-code-in-thrown-error.ts |
Adds helper-call auditing. |
eslint-factory/src/rules/require-error-code-in-thrown-error.test.ts |
Tests helper-call cases. |
actions/setup/js/mcp_enhanced_errors.cjs |
Prefixes validation messages. |
actions/setup/js/mcp_enhanced_errors.test.cjs |
Updates expected messages. |
Review details
Tip
Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Balanced
Comment on lines
+88
to
+91
| if (!isAuditableMessageExpression(resolved)) return resolved.type === AST_NODE_TYPES.CallExpression ? "needsReview" : "hasCode"; | ||
| return messageReferencesErrorCode(resolved) ? "hasCode" : "missingCode"; | ||
| } | ||
| return "missingCode"; |
| function resolveSimpleLocalCallReturns(node: TSESTree.CallExpression): TSESTree.Expression[] | null { | ||
| if (node.callee.type !== AST_NODE_TYPES.Identifier) return null; | ||
| const variable = findVariableInScopeChain(sourceCode.getScope(node.callee), node.callee.name); | ||
| if (!variable || variable.defs.length !== 1) return null; |
Comment on lines
+104
to
+111
| let body: TSESTree.BlockStatement | TSESTree.Expression | null = null; | ||
| if (def.type === "FunctionName") { | ||
| body = (def.node as TSESTree.FunctionDeclaration).body; | ||
| } else if (def.type === "Variable" && def.node.init && (def.node.init.type === AST_NODE_TYPES.FunctionExpression || def.node.init.type === AST_NODE_TYPES.ArrowFunctionExpression)) { | ||
| body = def.node.init.body; | ||
| } else { | ||
| return null; | ||
| } |
Contributor
|
🎉 This pull request is included in a new release. Release: |
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.
require-error-code-in-thrown-errorskippedthrow new Error(helper()), so helper-built messages in coded files could bypass error-code checks entirely. This left uncoded validation messages accepted silently beside coded sibling errors.callExpressionNeedsReviewfor imported, branched, dynamic, or indirect helper-call messages that cannot be verified statically.MCP validation messages
generateEnhancedErrorMessage()return paths withERR_VALIDATION.Tests