docs(@stdlib/math/base/tools/evalpoly-compile): use relative require path in example#12401
Closed
Planeshifter wants to merge 1 commit into
Closed
docs(@stdlib/math/base/tools/evalpoly-compile): use relative require path in example#12401Planeshifter wants to merge 1 commit into
Planeshifter wants to merge 1 commit into
Conversation
…path in example
The `lint_random_files` workflow (develop, 2026-05-30T00:34 UTC, run
26668990373) flagged `stdlib/require-last-path-relative` at line 23 of
`evalpoly-compile/examples/index.js`. The last `require()` call in AST
order was `require('@stdlib/utils/try-require')`, a non-relative path.
The `evalpoly-compile` package is pure JavaScript: no `binding.gyp`, no
native source, and empty `dependencies`/`devDependencies`. The
`tryRequire` guard was included by analogy with native addon packages
but is unnecessary here. Replacing it with a direct
`require('./../lib')` aligns the example with the sibling `evalpoly`
package and satisfies the lint rule.
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. |
kgryte
requested changes
May 31, 2026
Member
kgryte
left a comment
There was a problem hiding this comment.
I already rejected this change in a separate PR. See it for explanation.
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 loading pattern in@stdlib/math/base/tools/evalpoly-compile/examples/index.jswitha direct
require( './../lib' ), resolving thestdlib/require-last-path-relativeESLint violation that causesthe
lint_random_filesworkflow to fail ondevelop.Failing run: https://github.com/stdlib-js/stdlib/actions/runs/26668990373
(2026-05-30T00:34 UTC)
Symptom:
stdlib/require-last-path-relativeerror atexamples/index.js:23— the lastrequire()call in AST order wasrequire('@stdlib/utils/try-require'), a non-relative path.Root cause: The example used the
tryRequireguard pattern, whichis intended for packages with optional native addons that may fail to
compile.
evalpoly-compileis pure JavaScript: itslib/directorycontains only
index.js,main.js, andtemplates/; it has nobinding.gyp, no native source, and emptydependenciesanddevDependencies. The guard is therefore both unnecessary andcounter-productive — the
tryRequire( resolve( __dirname, '..', 'lib' ) )call is not a
require()call per the rule's AST traversal, so itdoes not reset the "last require" pointer, leaving
require('@stdlib/utils/try-require')as the final flagged path.Fix: Remove
path,@stdlib/utils/try-require, the error guard,and the
main()wrapper. Load the package withrequire( './../lib' ),which is both the correct relative-path form and the convention used
by sibling packages such as
@stdlib/math/base/tools/evalpoly.Related Issues
This pull request has the following related issues:
Questions
No.
Other
Validation: Fix reviewed by three independent agents prior to commit.
require('./../lib')resolves correctly,tryRequireis genuinely unnecessary for a pure-JS package, and observable example output is preserved.examples/index.jschanged; tests do not import examples; no platform-specific behavior change; diff is minimal.'./../lib'satisfies the lint rule (starts with./); copyright header preserved; spacing,vardeclarations, and comment style match stdlib conventions and sibling example.Note:
@stdlib/math/base/tools/evalrational-compilehas anidentical
tryRequirepattern in its example file and will triggerthe same lint rule in a future automated run. That file is out of
scope for this PR (no open 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. Root-cause analysis, fix, three-agent validation, and
commit were produced by the agent; the diff was reviewed against the
ESLint rule implementation and sibling package examples before being
staged.
@stdlib-js/reviewers
Generated by Claude Code