chore: fix JavaScript lint errors (issue #10000) - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)#10307
Conversation
Replace undefined `proc` references with `process` in module-scoped callback functions. The `proc` variable is only declared inside the `plugin()` function scope, but the callbacks `onError`, `onFinish`, `stdout`, and `stderr` are defined at module scope and need to access the Node.js global `process` object for exitCode and stdio streams.
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
4 similar comments
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
Planeshifter
left a comment
There was a problem hiding this comment.
Thanks for opening a PR!
| */ | ||
| function onError( error ) { | ||
| proc.exitCode = 1; | ||
| process.exitCode = 1; |
There was a problem hiding this comment.
The right fix here is to add the missing import rather than switching to the process global.
If you look at every other sibling makie plugin (e.g., makie-test, makie-benchmark, makie-examples -- all 21 of them), they all have this at line 23:
var proc = require( 'process' );
var spawn = require( 'child_process' ).spawn;This file is the only one missing that require( 'process' ) import. That's the actual root cause of the lint error.
The fix should be to add var proc = require( 'process' ); before the spawn require (line 23) and then revert all four callback changes back to using proc. This keeps consistency with every other plugin in this directory and follows the stdlib convention of using require('process') rather than relying on the process global.
Fixed the
no-undefESLint errors inmakie-install-node-addons/lib/main.jsby replacing undefinedprocreferences withprocess.Resolves #10000
Problem
Four module-scoped callback functions (
onError,onFinish,stdout,stderr) referenceproc, butprocis only declared as a local variable inside theplugin()function. This causes 4 ESLintno-undeferrors:Fix
The callbacks use
proc.exitCode,proc.stdout.write(), andproc.stderr.write()these are operations on the Node.js globalprocessobject, not the child process spawned insideplugin(). Replaced all 4 occurrences ofprocwithprocessin the module-scoped callbacks:function onError( error ) { - proc.exitCode = 1; + process.exitCode = 1; function onFinish( code ) { - proc.exitCode = code; + process.exitCode = code; function stdout( data ) { - proc.stdout.write( data ); + process.stdout.write( data ); function stderr( data ) { - proc.stderr.write( data ); + process.stderr.write( data );The local
var procinsideplugin()continues to hold the child process handle fromspawn()and is unaffected.