[英]Private/public modifiers with Typescript and eslint
How to configure eslint to allow Typescript class member modifiers (private, public)?如何配置 eslint 以允许 Typescript 类成员修饰符(私有、公共)?
Currently if I write:目前,如果我写:
class Foo {
constructor(private bar) {
}
}
eslint tells me: error Parsing error: Unexpected token
eslint 告诉我:
error Parsing error: Unexpected token
I'm using "parser": "babel-eslint"
in my .eslintrc
我在我的
.eslintrc
使用"parser": "babel-eslint"
TSLint is deprecated TSLint 已弃用
Try @typescript-eslint/eslint-plugin
package instead.试试
@typescript-eslint/eslint-plugin
包。
Check this for more information about typescript eslint plugin.检查 此有关打字稿 eslint 插件的更多信息。
babel-eslint doesn't support TypeScript . babel-eslint 不支持 TypeScript 。 You might be better off using TSLint instead.
您最好改用TSLint 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.