我的.eslintrc中有以下内容(项目位于https://github.com/jrgleason/jest/tree/UPGRADE)
overrides: [
...
{
files: [
'e2e/__tests__/**/*',
],
rules: {
'import/no-unresolved': "off",
},
},
]
但是当我跑步时我看到了...
代码/ jest / e2e / 测试 /haste_map_sha1.test.js 14:26错误无法解析模块'jest-haste-map'导入/无法解析的路径
为什么不将其关闭?
答案 0 :(得分:0)
这是因为您使用的是无效的json格式:
{
files: [
'e2e/__tests__/**/*',
'packages/babel-jest/**/*.test.js',
'packages/babel-plugin-jest-hoist/**/*.test.js',
'packages/babel-preset-jest/**/*.test.js',
'packages/eslint-config-fb-strict/**/*.test.js',
'packages/eslint-plugin-jest/**/*.test.js',
'packages/jest-changed-files/**/*.test.js',
'packages/jest-circus/**/*.test.js',
'packages/jest-diff/**/*.test.js',
'packages/jest-docblock/**/*.test.js',
'packages/jest-editor-support/**/*.test.js',
'packages/jest/**/*.test.js',
'packages/pretty-format/**/*.test.js',
],
rules: {
'import/no-unresolved': "off",
'flowtype/require-valid-file-annotation': [2, 'always'],
},
},
这些应该是双引号。
更新:eslint支持JSON5,因此请尝试:
'import/no-unresolved': "off",
答案 1 :(得分:0)
答案是由于ESLINT中的错误,我不能这样做