ESLint告诉我,在我的index.js文件顶部不需要使用
然而,运行
为什么会这样不一致呢?难道node不知道这个node模块默认就是严格模式吗?这可能是由于node、ESLint或我的IDE的一些简单配置问题吗?
"use strict"
(它是一个简单的服务器,就像https://nodejs.org/en/about/上的6行代码一样)。显然,所有的node模块已经处于严格模式。这很有道理。然而,运行
node index.js
时,会出现"SyntaxError: [let] not supported outside strict mode."错误。加上"多余的""use strict"
却可以运行。为什么会这样不一致呢?难道node不知道这个node模块默认就是严格模式吗?这可能是由于node、ESLint或我的IDE的一些简单配置问题吗?
--use-strict
标志来运行 Node。 - Explosion Pills/*eslint strict:0*/
。 - Amit