Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--check work with --require #18425

Closed
jdalton opened this issue Jan 29, 2018 · 2 comments
Closed

--check work with --require #18425

jdalton opened this issue Jan 29, 2018 · 2 comments

Comments

@jdalton
Copy link
Member

jdalton commented Jan 29, 2018

Node flags like --eval and --print work with --require allowing module(s) to be loaded before evaling or printing to enable prerequisite scripts to be run. However, --check doesn't work with --require when specifying a filename. It would be nice if it was possible. The relevant bits look to be

// check if user passed `-c` or `--check` arguments to Node.
if (process._syntax_check_only != null) {
const fs = NativeModule.require('fs');
// read the source
const filename = Module._resolveFilename(process.argv[1]);
var source = fs.readFileSync(filename, 'utf-8');
checkScriptSyntax(source, filename);
process.exit(0);
}

Update:

I noticed that using pipes I can use --require with --check for stdin.

Related to #11680, #11689.

@jdalton
Copy link
Member Author

jdalton commented Mar 25, 2018

PR at #19600.

@jdalton
Copy link
Member Author

jdalton commented Apr 5, 2018

Closed by #19600 🎉

@jdalton jdalton closed this as completed Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant