[英]TypeScript TSLint “interface-name” not working in VSC
I would like to have the I letter prepend every interface name in TypeScript. 我想让I字母在TypeScript中的每个接口名称之前。 Some time ago it started working.
不久前它开始工作。 Added a rule to explicitly check for 'I'.
添加了一条规则以明确检查“ I”。
The tslist.json file looks like this: tslist.json文件如下所示:
{
"defaultSeverity": "error",
"extends": [
"tslint:latest",
"tslint-react",
"tslint-config-prettier"
],
"linterOptions": {
"exclude": [
"node_modules/**/*.ts"
]
},
"rules": {
"no-console": false,
"interface-name": [true, "always-prefix"]
}
}
According to the docs - https://palantir.github.io/tslint/rules/interface-name/ 根据文档-https: //palantir.github.io/tslint/rules/interface-name/
What could be the issue? 可能是什么问题? Using Visual Studio Code with a TSLint extension.
使用带有TSLint扩展名的Visual Studio Code。
My tslist.json file used: 我的tslist.json文件使用:
"extends": [
"tslint:latest",
...
"tslint-config-prettier"
],
However my package.json file missed corresponding npm-package - https://www.npmjs.com/package/tslint-config-prettier . 但是我的package.json文件缺少相应的npm-package- https: //www.npmjs.com/package/tslint-config-prettier。
The error could be clearly seen in VSC Output panel, saying Linter is missing a dependant module. 在VSC输出面板中可以清楚地看到该错误,表示Linter缺少从属模块。
After installing tslint-config-prettier , TSLint compiler everything went back working as it should. 安装tslint-config-prettier之后,TSLint编译器一切恢复正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.