Skip to content

--check work with --require #18425

@jdalton

Description

@jdalton

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions