带有@ stencil / eslint-plugin的eslint抛出“无法读取未定义的属性'typeAnnotation'

问题描述

@stencil/plugin-eslint添加到我的eslint配置extends部分后,eslint已开始引发以下错误

Oops! Something went wrong! :(

ESLint: 7.11.0

TypeError: Cannot read property 'typeAnnotation' of undefined

解决方法

在我的媒体资源中添加类型注释可以解决此问题:

@Component({
    tag: 'my-component',shadow: true,})
export class MyComponent implements ComponentWillLoad {

    // @Element() host; // before
    @Element() host: HTMLMyComponentElement;  // after

另外,将其添加到我的tsconfig.json-> compilerOptions中会导致这种情况以早期错误的形式出现:

"noImplicitAny": true,