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

eslint-plugin-ember@11.11.0 detects single-line components as zero-line components #1937

Closed
neilthawani opened this issue Aug 21, 2023 · 3 comments · Fixed by #1941
Closed
Labels

Comments

@neilthawani
Copy link

neilthawani commented Aug 21, 2023

For components with one property, the linter mistakenly thinks they are empty and triggers this rule:

https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-empty-glimmer-component-classes.md

Example code that triggers this linter rule, as of v11.11.0.

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';

/**
    Component to view, filter, and select tags in a dropdown.
    @class QuestionsFilter
    @arg {Boolean} availableTags - The available list of tags to filter.
    @arg {Array} selectedTags - The list of tags that are selected.
    @extends {Component}
*/
export default class QuestionsFilter extends Component {
    // {Boolean} showTagDropdown - True if the tag dropdown should be shown.
    @tracked showTagDropdown = false;
}
import Component from '@glimmer/component';
import { guidFor } from '@ember/object/internals';

/**
    A component to ask a user to select, enter or upload samples.
    @class {TableBuilderComponent}
    @extends {Component}
*/
export default class TableBuilderComponent extends Component {
    /**
        A unique id for this component.
        @property guid
        @type {String}
    */
    guid = guidFor(this);
}
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';

/**
    Typeset in MathJax 2 and 4.
    @class {MathJax2And4}
    @extends {Component}
*/
export default class MathJax2And4 extends Component {
    // @property {String} input The input to typeset.
    @tracked input = '';
}
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';

/**
    Chevron. Used in a variety of settings to show activity completion.
    @class Chevron
    @arg {Boolean} check - Denotes whether or not chevron should show a check inside. Does not work if outline is set to true.
    @arg {Boolean} fade - Denotes whether the chevron should be filled in with an alpha version of the color. Only makes sense when |filled| is set to true.
    @arg {Boolean} filled - Indicates if chevron should be filled in with color denoted by |color|.
    @arg {Boolean} letter - Letter to stick in chevron. There are no checks for anything other than one letter so proceed at your own risk.
    @arg {Boolean} outline - Indicates if we should show an outline around the chevron. Cannot be used in conjunction with |check|.
    @arg {Boolean} size - Indicates size of chevron. Valid values include 'small', 'medium', and 'large'. Setting any other value will revert chevron back to 'large'.
    @extends {GlimmerComponent}
*/
export default class Chevron extends Component {
    // @property {AccessibilityToggleService} accessibleToggle - A service to see if the student turned on accessibility.
    @service accessibleToggle; // eslint-disable-line ember/no-unused-services
}
@neilthawani neilthawani changed the title eslint-plugin-ember@11.11.0 results in eslint-plugin-ember@11.11.0 detects single-line components as zero-line components Aug 21, 2023
@bmish bmish added the bug label Aug 21, 2023
@bmish
Copy link
Member

bmish commented Aug 21, 2023

@patricklx @NullVoxPopuli

@kategengler
Copy link
Member

Also seeing this in the tutorial, where the rule is triggering on:

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';

export default class RentalsComponent extends Component {
  @tracked query = '';
}

@Techn1x
Copy link

Techn1x commented Aug 22, 2023

Can confirm, my project was seeing this issue too, once I was definitely using the "custom parser" from this addon in 11.11.0

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