From 2a5fd043747b05998383590b515a64e93de264cf Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Sat, 4 Jul 2026 16:07:09 +0530 Subject: [PATCH 1/6] chore: fix JavaScript lint errors (issue #13252) --- lib/node_modules/@stdlib/fs/read-dir/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/fs/read-dir/examples/index.js b/lib/node_modules/@stdlib/fs/read-dir/examples/index.js index 244a18f2d158..689048dd451d 100644 --- a/lib/node_modules/@stdlib/fs/read-dir/examples/index.js +++ b/lib/node_modules/@stdlib/fs/read-dir/examples/index.js @@ -32,7 +32,7 @@ out = readDir.sync( 'beepboop' ); // returns console.log( out instanceof Error ); -// => true +// e.g., => true /* Async */ From d254ed2d27143130327fa013c1b37d50b7c46909 Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Thu, 6 Aug 2026 20:51:15 +0530 Subject: [PATCH 2/6] chore(fs/read-dir): apply isError() in place of instanceof Error --- lib/node_modules/@stdlib/fs/read-dir/README.md | 11 +++++++---- .../@stdlib/fs/read-dir/examples/index.js | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/fs/read-dir/README.md b/lib/node_modules/@stdlib/fs/read-dir/README.md index 30b3f34be611..52b840eeca75 100644 --- a/lib/node_modules/@stdlib/fs/read-dir/README.md +++ b/lib/node_modules/@stdlib/fs/read-dir/README.md @@ -52,8 +52,9 @@ function onRead( error, data ) { Synchronously reads the contents of a directory. ```javascript +var isError = require( '@stdlib/assert/is-error' ); var out = readDir.sync( __dirname ); -if ( out instanceof Error ) { +if ( isError( out ) ) { throw out; } console.log( out ); @@ -84,13 +85,14 @@ console.log( out ); can be replaced by an approach which addresses existence via `error` handling. ```javascript + var isError = require( '@stdlib/assert/is-error' ); var readDir = require( '@stdlib/fs/read-dir' ); var dir = '/path/to/dir'; // Explicitly handle the error... dir = readDir.sync( dir ); - if ( dir instanceof Error ) { + if ( isError( dir ) ) { // You choose what to do... throw dir; } @@ -107,6 +109,7 @@ console.log( out ); ```javascript +var isError = require( '@stdlib/assert/is-error' ); var readDir = require( '@stdlib/fs/read-dir' ); /* Sync */ @@ -114,13 +117,13 @@ var readDir = require( '@stdlib/fs/read-dir' ); var out = readDir.sync( __dirname ); // returns -console.log( out instanceof Error ); +console.log( isError( out ) ); // => false out = readDir.sync( 'beepboop' ); // returns -console.log( out instanceof Error ); +console.log( isError( out ) ); // => true /* Async */ diff --git a/lib/node_modules/@stdlib/fs/read-dir/examples/index.js b/lib/node_modules/@stdlib/fs/read-dir/examples/index.js index 689048dd451d..1c41291ce3f8 100644 --- a/lib/node_modules/@stdlib/fs/read-dir/examples/index.js +++ b/lib/node_modules/@stdlib/fs/read-dir/examples/index.js @@ -18,6 +18,7 @@ 'use strict'; +var isError = require( '@stdlib/assert/is-error' ); var readDir = require( './../lib' ); /* Sync */ @@ -25,14 +26,14 @@ var readDir = require( './../lib' ); var out = readDir.sync( __dirname ); // returns -console.log( out instanceof Error ); +console.log( isError( out ) ); // => false out = readDir.sync( 'beepboop' ); // returns -console.log( out instanceof Error ); -// e.g., => true +console.log( isError( out ) ); +// => true /* Async */ From c106f42cbbf16d367fc511c66cb0a40446e8177e Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Thu, 6 Aug 2026 21:02:29 +0530 Subject: [PATCH 3/6] chore(fs/read-dir): disable ESLint rules for anti-pattern code block in README --- lib/node_modules/@stdlib/fs/read-dir/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/node_modules/@stdlib/fs/read-dir/README.md b/lib/node_modules/@stdlib/fs/read-dir/README.md index 52b840eeca75..0559d0fdd04f 100644 --- a/lib/node_modules/@stdlib/fs/read-dir/README.md +++ b/lib/node_modules/@stdlib/fs/read-dir/README.md @@ -70,6 +70,7 @@ console.log( out ); ## Notes - The difference between this module and [`fs.readdirSync()`][fs] is that [`fs.readdirSync()`][fs] will throw if an `error` is encountered (e.g., if given a non-existent `path`) and this module will return an `error`. Hence, the following anti-pattern + ```javascript var fs = require( 'fs' ); @@ -82,6 +83,8 @@ console.log( out ); } ``` + + can be replaced by an approach which addresses existence via `error` handling. ```javascript From 5e0a6aaebdfd458c240a2a90b6d800974a2698a5 Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Thu, 6 Aug 2026 21:08:45 +0530 Subject: [PATCH 4/6] chore(fs/read-dir): fix markdown lint errors in Notes section --- lib/node_modules/@stdlib/fs/read-dir/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/fs/read-dir/README.md b/lib/node_modules/@stdlib/fs/read-dir/README.md index 0559d0fdd04f..139419d1c73f 100644 --- a/lib/node_modules/@stdlib/fs/read-dir/README.md +++ b/lib/node_modules/@stdlib/fs/read-dir/README.md @@ -69,9 +69,10 @@ console.log( out ); ## Notes -- The difference between this module and [`fs.readdirSync()`][fs] is that [`fs.readdirSync()`][fs] will throw if an `error` is encountered (e.g., if given a non-existent `path`) and this module will return an `error`. Hence, the following anti-pattern +- The difference between this module and [`fs.readdirSync()`][fs] is that [`fs.readdirSync()`][fs] will throw if an `error` is encountered (e.g., if given a non-existent `path`) and this module will return an `error`. Hence, the following anti-pattern + ```javascript var fs = require( 'fs' ); @@ -83,10 +84,10 @@ console.log( out ); } ``` - - can be replaced by an approach which addresses existence via `error` handling. + + ```javascript var isError = require( '@stdlib/assert/is-error' ); var readDir = require( '@stdlib/fs/read-dir' ); From 649daa651f56116f17229d9edf069d2a1487f168 Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Thu, 6 Aug 2026 21:24:31 +0530 Subject: [PATCH 5/6] chore(fs/read-dir): fix markdown lint errors - indent eslint-disable inside list item --- lib/node_modules/@stdlib/fs/read-dir/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/fs/read-dir/README.md b/lib/node_modules/@stdlib/fs/read-dir/README.md index 139419d1c73f..6e59155a7876 100644 --- a/lib/node_modules/@stdlib/fs/read-dir/README.md +++ b/lib/node_modules/@stdlib/fs/read-dir/README.md @@ -69,10 +69,10 @@ console.log( out ); ## Notes - - - The difference between this module and [`fs.readdirSync()`][fs] is that [`fs.readdirSync()`][fs] will throw if an `error` is encountered (e.g., if given a non-existent `path`) and this module will return an `error`. Hence, the following anti-pattern + + ```javascript var fs = require( 'fs' ); @@ -84,9 +84,9 @@ console.log( out ); } ``` - can be replaced by an approach which addresses existence via `error` handling. + - + can be replaced by an approach which addresses existence via `error` handling. ```javascript var isError = require( '@stdlib/assert/is-error' ); From 07a6f6d5172d67d633f61556c30a52811f1c32a9 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 6 Aug 2026 16:23:05 -0700 Subject: [PATCH 6/6] style: add empty line Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/fs/read-dir/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/fs/read-dir/README.md b/lib/node_modules/@stdlib/fs/read-dir/README.md index 6e59155a7876..5d8e23354c48 100644 --- a/lib/node_modules/@stdlib/fs/read-dir/README.md +++ b/lib/node_modules/@stdlib/fs/read-dir/README.md @@ -53,6 +53,7 @@ Synchronously reads the contents of a directory. ```javascript var isError = require( '@stdlib/assert/is-error' ); + var out = readDir.sync( __dirname ); if ( isError( out ) ) { throw out;