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

[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
Labels

Comments

@nicolo-ribaudo
Copy link
Contributor

/*jslint esnext: true */

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

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

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

@rwaldron
Copy link
Member

This is a good one, thanks!

@jugglinmike
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

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

jugglinmike pushed a commit to jugglinmike/jshint that referenced this issue Jun 3, 2015
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.

3 participants