Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RettentoRectangle opened this issue Sep 21, 2023 · 1 comment

Comments

@RettentoRectangle
Copy link

RettentoRectangle commented Sep 21, 2023

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.

@RettentoRectangle
Copy link
Author

RettentoRectangle commented Sep 21, 2023

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);
        }
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant