Typescript eslint - 缺少文件扩展名“ts”导入/扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/59265981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Typescript eslint - Missing file extension "ts" import/extensions
提问by Nolat
I have a simple Node/Express app made with Typescript. And eslint give me the error
我有一个用 Typescript 制作的简单 Node/Express 应用程序。和 eslint 给我错误
Missing file extension "ts" for "./lib/env" import/extensions
Here is my .eslintrc file
这是我的 .eslintrc 文件
{
"extends": [
"airbnb",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/react",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier", "import"],
"settings": {
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"directory": "./tsconfig.json"
},
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"rules": {
"@typescript-eslint/indent": [2, 2],
"no-console": "off",
"import/no-unresolved": [2, { "commonjs": true, "amd": true }],
"import/named": 2,
"import/namespace": 2,
"import/default": 2,
"import/export": 2
}
}
I have installed eslint-plugin-impor & eslint-import-resolver-typescript. And I cannot figure out why, I got that error.
我已经安装了 eslint-plugin-import 和 eslint-import-resolver-typescript。我不知道为什么,我得到了那个错误。