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

Order-in-* rules do not work in native class syntax #417

Open
lstrzebinczyk opened this issue May 6, 2019 · 5 comments · May be fixed by #657
Open

Order-in-* rules do not work in native class syntax #417

lstrzebinczyk opened this issue May 6, 2019 · 5 comments · May be fixed by #657
Labels

Comments

@lstrzebinczyk
Copy link

It would seem that, as in issue, if code is written using modern native classess + decorators, the order-in-* rules do not pick it up. Example would be, from my codebase:

import Component from "@ember/component";
import UploadManager from "web/services/upload-manager";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";

export default class extends Component {
  @service uploadManager!: UploadManager;

  tagName = "";

  sideMenuOpen = false;

  @action openSideMenu() {
    this.set("sideMenuOpen", true);
  }

  @action closeSideMenu() {
    this.set("sideMenuOpen", false);
  }
}

If I were to put @service lower in the file, no error is raised. I am also using typescript, but that doesn't seem to matter for other rules.

What is the situation here, is this a known issue? And first of all, do I understand correctly that the expected situation would be for this rule to be applied to native class based ember entities?

@Alonski
Copy link
Contributor

Alonski commented May 23, 2019

@lstrzebinczyk This is a known issue in that I chatted about it with a few folks on Discord a month or so ago. I assume a PR fixing this would be welcome :)
I for one would love this :)

@laurmurclar
Copy link
Contributor

I'll start putting a PR together for these

@Alonski
Copy link
Contributor

Alonski commented Nov 6, 2019

@laurmurclar Id love to see progress on this. I messed around with AST explorer a few months ago but had a tough time understanding how the transforms work. Good luck!

@laurmurclar
Copy link
Contributor

@Alonski sweet. I could give you a hand with that some time if you're interested! Can be hard to get started alone

@laurmurclar
Copy link
Contributor

I don't have time to finish this off right now, but I made a start by updating some util functions that this work will rely on (see #574). If anyone else has time, feel free to pick it up

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

Successfully merging a pull request may close this issue.

4 participants