NullVoxPopuli / eslint-plugin-decorator-position

ESLint plugin for enforcing decorator position

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enforcing @action to be on a separate line

iamdtang opened this issue · comments

Screen Shot 2022-02-02 at 4 14 29 PM

This is what's happening for me. The one method fails linting as expected, but as soon as I define a body like in method two, linting passes when I expect it to fail. This is all of the code:

import Component from '@glimmer/component';
import { action } from '@ember/object';

export default class Foo extends Component {
  @action one() {}

  @action two() {
    return 2;
  }
}

👋 Hello!!

what's your lint config look like?

Reason I ask is because I added this test:
image
and it passed 🤔

hey 👋!

Here is my config:

{
  "decorator-position/decorator-position": [
    "error",
    {
      "properties": "prefer-inline",
      "methods": "above"
    }
  ]
}

With the above, shouldn't it fail if @action is inline?

yeah, I'd expect two errors, one for each action.

if you run eslint . --fix, what happens?

eslint . --fix only fixes the first one which is failing. I created a reproduction repo here: https://github.com/skaterdav85/decorator-linting-reproduction

Thanks, I've copied that into the test suite here: #475

dunno when I'll have time to fix -- but thanks for reporting!!!