-
Notifications
You must be signed in to change notification settings - Fork 0
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
Do not escape underscores inside word #56
base: master
Are you sure you want to change the base?
Conversation
f49e934
to
6535c73
Compare
ping @lundibundi |
CHANGELOG.md
Outdated
@@ -15,6 +15,7 @@ and this project adheres to | |||
### Fixed | |||
|
|||
- Support for functions definitions in parameters. | |||
- Do not escape undescores inside word. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Do not escape undescores inside word. | |
- Do not escape underscores inside words. |
lib/generator.js
Outdated
str[i] === '[' || | ||
str[i] === ']' || | ||
(str[i] === '_' && | ||
!(isAlphaNumeric(str[i - 1]) && isAlphaNumeric(str[i + 1]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would ignore all non-ascii identifier symbols, i.e. const func = (a = _µµ_µµ_) => {}
, would that be fine?
Refs: https://www.ecma-international.org/ecma-262/9.0/index.html#sec-identifier-names
https://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AID_Start%3A%5D&g=&i=
https://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AID_Continue%3A%5D&g=&i=
/cc @belochub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we shouldn't support non-ascii identifier symbols. Moreover, our eslint config won't even allow such identifiers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SemenchenkoVitaliy the rule you linked doesn't check if the identifier contains Unicode characters with code points values higher than 0x7F, it just checks that the identifier is in camel case, and it is possible to use camel case in other languages. As for using underscores in the middle of the identifier with this rule, they can be used when everything else is in uppercase (as in constants), for example:
const ПРИВІТ_СВІТЕ = 'Hello, world!';
83e515f
to
c6cfd00
Compare
c6cfd00
to
0cf0a16
Compare
065d426
to
8ff60eb
Compare
1e056a6
to
1872117
Compare
No description provided.