docs: use relative require path in evalpoly-compile example#12372
Open
Planeshifter wants to merge 1 commit into
Open
docs: use relative require path in evalpoly-compile example#12372Planeshifter wants to merge 1 commit into
require path in evalpoly-compile example#12372Planeshifter wants to merge 1 commit into
Conversation
The automated JavaScript lint workflow on develop (run 26668990373)
reported a `stdlib/require-last-path-relative` violation at line 23
in `@stdlib/math/base/tools/evalpoly-compile/examples/index.js`. The
last `require()` call was `require('@stdlib/utils/try-require')`, a
non-relative path.
The file used the `tryRequire` pattern intended for packages with
optional native addons. `evalpoly-compile` is pure JavaScript with
no native dependencies, making the guard unnecessary. This commit
replaces `tryRequire`-based loading with `require('./../lib')` and
removes the unneeded `path` and `@stdlib/utils/try-require` imports,
matching the pattern in sibling packages (e.g., `evalpoly`).
Ref: https://github.com/stdlib-js/stdlib/actions/runs/26668990373
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
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.
Resolves #12359.
Description
This pull request:
tryRequire-based package loading in@stdlib/math/base/tools/evalpoly-compile/examples/index.jswitha direct
require( './../lib' )call, fixing thestdlib/require-last-path-relativelint violation that caused theautomated JavaScript lint workflow to fail on
develop.Failing run: https://github.com/stdlib-js/stdlib/actions/runs/26668990373
(2026-05-30 00:34:49 UTC)
Symptom:
stdlib/require-last-path-relativeerror at line 23 ofevalpoly-compile/examples/index.js— the lastrequire()call wasrequire('@stdlib/utils/try-require'), a non-relative path.Root cause: The example used the
tryRequirepattern (intended forpackages with optional native addons that may fail to compile). The
evalpoly-compilepackage is pure JavaScript: itslib/directorycontains only
index.js,main.js, andtemplates/; it has nonative source, no native dependencies, and no build artifacts. The
tryRequireguard was therefore both unnecessary and counter-productive— it made the last visible
require()a non-relative path, triggeringthe lint rule. The
tryRequire( resolve( __dirname, '..', 'lib' ) )call is not a
require()call per the rule's AST check, so it does notreset the "last require" pointer.
Fix: Remove
path,@stdlib/utils/try-require, the error guard,and the
main()wrapper. Load the package directly withrequire( './../lib' ), which is both the correct relative-path formand the uniform convention used by sibling packages such as
@stdlib/math/base/tools/evalpoly.This matches example in README.md.
Related Issues
This pull request has the following related issues:
Questions
No.
Other
Validation: The fix was reviewed by three independent agents prior to
commit. Reviewer C (style/conventions) caught that the initial draft used
require( '..' ), which does not satisfyisRelativePath(the rulechecks for
'./'or'../'prefix). The fix was corrected torequire( './../lib' )— consistent with sibling packages andunambiguously a relative path — before the commit was staged.
The
evalrational-compilepackage has an identicaltryRequirepatternin its example file and will trigger the same lint rule in a future
automated run. That file is out of scope for this PR (separate failure
event) but warrants a follow-up.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code as part of an automated CI-failure
triage routine. The root-cause analysis, fix, and commit were produced
by the agent; the diff was reviewed against the ESLint rule
implementation and sibling package examples before being committed.
@stdlib-js/reviewers
Generated by Claude Code