43081j/eslint-plugin-wc

define-tag-after-class-definition: ignore abstract classes by default

RettentoRectangle opened this issue · 1 comments

It'd be nice to ignore abstract classes by default.
Yes, I know you have to use @typescript-eslint/parser as parser, but please. :P

edit:
Oh, you already depends on typescript-eslint, then it's easy.

I hope it helps:

src\test\rules\define-tag-after-class-definition_test.ts:

const parser = require.resolve('@typescript-eslint/parser');

{
  code: 'abstract class Foo extends HTMLElement {}',
  parser
},

src\rules\define-tag-after-class-definition.ts:

'ClassDeclaration,ClassExpression': (node: ESTree.Class): void => {
        if (
          isCustomElement(context, node, source.getJSDocComment(node)) &&
          node.id?.type === 'Identifier' &&
          // @ts-expect-error -- Yes, we know it.
          !node?.abstract
        ) {
          seenClasses.add(node);
        }
      },