如何配置@ typescript-eslint规则

Cor*_*han 1 typescript eslint typescript-eslint

我正在尝试转换为,@typescript-eslint但是文档似乎非常缺乏。例如,我收到这样的错误:

Line 58:  Expected a semicolon             @typescript-eslint/member-delimiter-style
Run Code Online (Sandbox Code Playgroud)

我不想强制使用分号或逗号。我找到了该规则的文档。https://github.com/bradzacher/eslint-plugin-typescript/blob/master/docs/rules/member-delimiter-style.md

但是它似乎没有提供任何有关如何在实际的eslint文件中进行配置的示例!有人知道吗?

小智 6

使用.eslintrc.js配置文件,您必须将其添加到“规则”部分:

"rules": {
    "@typescript-eslint/member-delimiter-style": ["error", {
      multiline: {
        delimiter: 'none',
        requireLast: true,
      },
      singleline: {
        delimiter: 'none',
        requireLast: false,
      },
    }]
}
Run Code Online (Sandbox Code Playgroud)

为我工作了“ @ typescript-eslint / explicit-function-return-type”参数。选项来自github上rules项目站点