我将Eslint用于我的项目,请使用:
WITH rsqfc ( id, col, string_start, string_end ) AS (
SELECT id,
col,
1,
INSTR( col, ',', 1, 2 )
FROM test_data
UNION ALL
SELECT id,
col,
string_end + 1,
INSTR( col, ',', string_end + 1, 2 )
FROM rsqfc
WHERE string_end > 0
)
SELECT id,
CASE string_end
WHEN 0
THEN SUBSTR( col, string_start )
ELSE SUBSTR( col, string_start, string_end - string_start )
END AS pair
FROM rsqfc;
1.4.2 @typescript-eslint/parser
1.4.2 @typescript-eslint/eslint-plugin
1.1.1 eslint-import-resolver-typescript
和airbnb-base
或者您可以检查我的plugin:@typescript-eslint/recommended
:
.eslintrc
在文件{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": ["airbnb-base", "plugin:@typescript-eslint/recommended"],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"import/resolver": {
"typescript": {}
}
},
"rules": {
"no-plusplus": "off",
"import/no-cycle": "warn",
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/explicit-member-accessibility": "off"
}
}
中,我使用:A.ts
并从export type Id = string;
导入:B.ts
我尝试使用:
import { Id } from '../A';
并调用A.Id但出现同伴抛出错误:
A仅引用类型,但在此处被用作命名空间
两种方法都有错误,一种来自import A from '../A';
,一种来自IDE(Vs Code,也许是Tshint)
您能帮我修复其中一个吗?
提前谢谢!
答案 0 :(得分:3)
我不认为您的错误与Eslint有关。据我看来,这似乎是基本的Typescript错误。
您的A.ts
不包含默认导出。为了从A.ts
导入整个模块,您应该使用
import * as A from '../A';
答案 1 :(得分:0)
您尝试过吗?
import A as A from '../A';