Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Method names should support symbol properties #459

Closed
slikts opened this issue Jul 19, 2018 · 4 comments
Closed

Method names should support symbol properties #459

slikts opened this issue Jul 19, 2018 · 4 comments
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Bug
Milestone

Comments

@slikts
Copy link

slikts commented Jul 19, 2018

The current function-name rule fails when implementing an iterable:

const it: Iterable<any> = {
  // [tslint] Method name does not match /^[a-z][\w\d]+$/: [Symbol.iterator] (function-name)
  [Symbol.iterator](): any {}
}

It should not fail; symbol properties and the iterable protocol are standard parts of JS since many years ago and should be supported.

@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Jul 19, 2018

Hi slikts 👋 thanks for the issue! You're absolutely right, this is a bug and should be fixed.

@JoshuaKGoldberg JoshuaKGoldberg added Type: Bug Status: Accepting PRs Good First Issue 🙌 Howdy, neighbor! Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. labels Jul 19, 2018
@elado
Copy link

elado commented Jul 23, 2018

here's my override:

"function-name": [true, {
  "method-regex": "^\\*?\\[?[a-zA-Z][\\w\\d\\.]*\\]?$",
  "private-method-regex": "^\\*?\\[?[a-zA-Z][\\w\\d\\.]*\\]?$",
  "protected-method-regex": "^\\*?\\[?[a-zA-Z][\\w\\d\\.]*\\]?$",
  "static-method-regex": "^\\*?\\[?[a-zA-Z][\\w\\d\\.]*\\]?$",
  "function-regex": "^\\*?\\[?[a-zA-Z][\\w\\d\\.]*\\]?$"
}],

(and it also allows lowercase static methods, so it's a bit different than the original)

@joelalejandro
Copy link

@JoshuaKGoldberg Is there a scheduled date for the 5.2.2 version of the package to include this fix? We're using this set of rules via tslint-config-airbnb and we're finding the same issue. We're applying a local override in the meantime, but it would be nice to see this go live :)

@JoshuaKGoldberg
Copy link

Thanks for bringing his up @joelalejandro - I'm planning on releasing a version after Hacktoberfest ends / early first week of November. It wasn't mentioned at all so I'll file a separate issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Bug
Projects
None yet
Development

No branches or pull requests

4 participants