--use-strict flag doesn't apply strict mode to script
Open
Nobody has claimed this yet.
confirmed-bug
v8 engine
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
- Node 12.*:
- Windows 64bit, Debian 64bit:
The --use-strict flag doesn't apply strict mode to script.
reproduction:
echo a = 1 > test.js && node --use-strict test
expected behavior:
ReferenceError: a is not defined is thrown.
behavior:
script executes without any issue.
however it works as expected when node is started first and script is called from repl.
<12 versions aren't affected.
node --use-strict
Welcome to Node.js v12.12.0.
Type ".help" for more information.
> a = 1
Thrown:
ReferenceError: a is not defined
>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported command, node --use-strict test, and compare its behavior with the documented REPL example. Trace how --use-strict is applied during script startup; the issue is done when the script throws the expected ReferenceError while the existing REPL behavior remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100