Skip to content

Commit

Permalink
fix no empty glimmer class
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Aug 22, 2023
1 parent 58328dc commit 8c5a5cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/rules/no-empty-glimmer-component-classes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const { isGlimmerComponent } = require('../utils/ember');
const { isClassPropertyOrPropertyDefinition } = require('../utils/types');

const ERROR_MESSAGE = 'Do not create empty backing classes for Glimmer components.';
const ERROR_MESSAGE_TEMPLATE_TAG =
Expand Down Expand Up @@ -40,8 +39,7 @@ module.exports = {
context.report({ node, message: ERROR_MESSAGE });
} else if (
node.body.body.length === 1 &&
(isClassPropertyOrPropertyDefinition(node.body.body[0]) ||
node.body.body[0].type === 'GlimmerTemplate') &&
node.body.body[0].type === 'GlimmerTemplate' &&
!subClassHasTypeDefinition
) {
context.report({ node, message: ERROR_MESSAGE_TEMPLATE_TAG });
Expand Down
10 changes: 10 additions & 0 deletions tests/lib/rules/no-empty-glimmer-component-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ ruleTester.run('no-empty-glimmer-component-classes', rule, {
code: `
import Component from '@glimmer/component';
export default class MyComponent extends Component {
property = '';
}
`,
parser: require.resolve('@typescript-eslint/parser'),
},
{
code: `
import Component from '@glimmer/component';
export interface SomeSig {}
export interface SomeOtherSig {}
Expand Down

0 comments on commit 8c5a5cf

Please sign in to comment.