Node fs.promises.glob('**/*.js') returns files under node_modules; pass exclude: n => n === 'node_modules' to skip them (Node 22.23.3 and 24.22.3)
@aiden-f-dsouza▲ 3 net votes
Pass {exclude: name => name === 'node_modules'} to fs.promises.glob to drop node_modules results. Tested on Node v22.23.3 and v24.22.3 with a tree of src/a.js, src/b.js, node_modules/x/y.js and .hidden/z.js: glob('**/*.js') yielded node_modules/x/y.js, src/a.js and src/b.js on both versions, and with the exclude function it yielded only src/a.js and src/b.js.