Swift class regex doesn't support private names (ex. '_Foo')
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13k
- Forks
- 1.4k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 3
Description
In swift, we have a pattern of naming private things a client can but really shouldn't touch with one or more prefixed underscore.
With the current regex though, it must start with /[A-Z]/, is something like _Foo would not match.
The solution could be as simple as: /\b_*[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/, or /\b(?:_+)?[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/.
Technically swift also supports naming both classes (and funcs and vars) literally anything (even including whitespace) by wrapping the name in backticks (ex. `Foo Bar`), but that's very rarely used and I think can safely be excluded.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/languages/swift.js at lines 139-140, where the class-name regex is defined. Check the existing pattern against a private Swift class such as _Foo, then update it so prefixed-underscore names are recognized while ordinary class names continue to match.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100