eslint - 如何为特定文件设置 sourceType
eslint - how to set the sourceType for a specific file
在eslint中有没有办法像规则和环境设置一样在文件中设置sourceType?
类似
/*eslint sourceType: "module"*/
没看过作品
eslint 的一位团队成员确认目前不支持此功能,目前设置 sourceType 的唯一方法是使用配置文件。
我必须为每个特殊的 Javascript 文件创建一个目录,并在目录中放置一个 .eslintrc
文件,其中包含以下内容:
{
"sourceType": "module"
}
也许最好将所有模块移动到一个目录下,与遗留 JS 文件分开。但是为了临时修复 Parsing error: 'import' and 'export may appear only with 'sourceType: module'
,我只是把 .eslintrc
.
在eslint中有没有办法像规则和环境设置一样在文件中设置sourceType?
类似
/*eslint sourceType: "module"*/
没看过作品
eslint 的一位团队成员确认目前不支持此功能,目前设置 sourceType 的唯一方法是使用配置文件。
我必须为每个特殊的 Javascript 文件创建一个目录,并在目录中放置一个 .eslintrc
文件,其中包含以下内容:
{
"sourceType": "module"
}
也许最好将所有模块移动到一个目录下,与遗留 JS 文件分开。但是为了临时修复 Parsing error: 'import' and 'export may appear only with 'sourceType: module'
,我只是把 .eslintrc
.