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

[es6] "Duplicate class method" when two methods' names are got from an object #2350

Closed
nicolo-ribaudo opened this Issue Apr 29, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@nicolo-ribaudo
Copy link
Contributor

nicolo-ribaudo commented Apr 29, 2015

/*jslint esnext: true */

const a = {
  b: 1,
  c: 2
};

class D {
  [a.b]() {}
  [a.c]() {}
}

I get this warning: Duplicate class method '.'.

@rwaldron

This comment has been minimized.

Copy link
Member

rwaldron commented Apr 29, 2015

This is a good one, thanks!

@jugglinmike

This comment has been minimized.

Copy link
Member

jugglinmike commented Apr 29, 2015

Thanks for the report!

@jugglinmike jugglinmike added the P2 label Apr 29, 2015

@nicolo-ribaudo nicolo-ribaudo changed the title [es6] "Duplicate class method" when two methods' names are got from the same object [es6] "Duplicate class method" when two methods' names are got from an object Apr 29, 2015

@nicolo-ribaudo

This comment has been minimized.

Copy link
Contributor

nicolo-ribaudo commented May 5, 2015

I get the same warning using functions as methods' name.

/*jshint esnext: true */

class A {
  [Symbol("a")]() {}
  [Symbol("b")]() {}
}

Duplicate class method '('.


When using arrays

/*jshint esnext: true */

const a = [ 1, 2 ];

class D {
  [a[0]]() {}
  [a[1]]() {}
}

Duplicate class method '['.


When using template strings

/*jshint esnext: true */

class D {
  [`a`]() {}
  [`b`]() {}
}

Duplicate class method '{b}'.

@jugglinmike

This comment has been minimized.

Copy link
Member

jugglinmike commented May 14, 2015

Expect the fix for this in the next release of JSHint (version > 2.7.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment