我最近升级了我的angular应用程序,使用eslint而不是tslint。
我现在正在努力启用call-signature typedef。
所以,在此之前,我有这样的经历:
"typedef": [
true,
...,
"call-signature"
]但在埃斯林特,我找不到同等的东西。在浏览their git page时,我看到了以下内容:
type Options = {
arrayDestructuring?: boolean;
arrowParameter?: boolean;
memberVariableDeclaration?: boolean;
objectDestructuring?: boolean;
parameter?: boolean;
propertyDeclaration?: boolean;
variableDeclaration?: boolean;
variableDeclarationIgnoreFunction?: boolean;
};如何启用调用签名?
这样做不会触发任何警告,尽管将所有内容都设置为true:
public someMethod() {}下面是我的tslint配置:
"@typescript-eslint/typedef": [
"warn",
{
"arrayDestructuring": true,
"arrowParameter": true,
"memberVariableDeclaration": true,
"objectDestructuring": true,
"parameter": true,
"propertyDeclaration": true,
"variableDeclaration": true,
"variableDeclarationIgnoreFunction": true
}
]我试图添加call-signature,但它没有帮助。
发布于 2021-08-09 17:54:28
根据文档,您必须使用此规则来强制类型定义。
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
]这将在函数、箭头函数和类方法上强制执行与TSLint相同的返回类型定义规则集。
https://stackoverflow.com/questions/68374703
复制相似问题