nodejs / nodejs/node

--use-strict flag doesn't apply strict mode to script

未关闭
#30,039 8 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

confirmed-bug v8 engine
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

  • 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
>

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先重现报告中的命令 node --use-strict test,并将其行为与文档中的 REPL 示例进行比较。跟踪 --use-strict 在脚本启动期间的应用方式;当脚本抛出预期的 ReferenceError,且现有的 REPL 行为仍然正确时,该 issue 即完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, nodejs
领域
cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。