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

Conflicting rules for getters and setters pairs ordering #33

Closed
web-padawan opened this issue Jan 9, 2023 · 0 comments · Fixed by #39
Closed

Conflicting rules for getters and setters pairs ordering #33

web-padawan opened this issue Jan 9, 2023 · 0 comments · Fixed by #39

Comments

@web-padawan
Copy link
Member

Description

After #29 we now have conflicting rules for getters and setters:

  • @typescript-eslint/member-ordering requires all the getters to be placed before all the setters in the same class,
  • @typescript-eslint/adjacent-overload-signatures and grouped-accessor-pairs require them to be grouped.

Steps to reproduce

  1. Clone the project https://github.com/web-padawan/test-eslint-config-vaadin
  2. Run npm install & npm run lint

Input

test-1.js

export class FooBar {
  get foo() {
    return this.__foo;
  }

  set foo(foo) {
    this.__foo = foo;
  }

  get bar() {
    return this.__bar;
  }

  set bar(bar) {
    this.__bar = bar;
  }
}

test-2.js

export class FooBar {
  get foo() {
    return this.__foo;
  }

  get bar() {
    return this.__bar;
  }

  set foo(foo) {
    this.__foo = foo;
  }

  set bar(bar) {
    this.__bar = bar;
  }
}

Output

/Users/serhii/cf/test-eslint/test-1.js
  10:3  error  Member bar should be declared before all public instance set definitions  @typescript-eslint/member-ordering

/Users/serhii/cf/test-eslint/test-2.js
  10:3  error  All foo signatures should be adjacent                          @typescript-eslint/adjacent-overload-signatures
  10:3  error  Accessor pair getter 'foo' and setter 'foo' should be grouped  grouped-accessor-pairs
  14:3  error  All bar signatures should be adjacent                          @typescript-eslint/adjacent-overload-signatures
  14:3  error  Accessor pair getter 'bar' and setter 'bar' should be grouped  grouped-accessor-pairs
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

Successfully merging a pull request may close this issue.

1 participant