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

[Feature Request] support Japanese in typename #3035

Closed
tuchida opened this issue Oct 25, 2024 · 2 comments
Closed

[Feature Request] support Japanese in typename #3035

tuchida opened this issue Oct 25, 2024 · 2 comments
Labels
feature request Feature request

Comments

@tuchida
Copy link
Contributor

tuchida commented Oct 25, 2024

Target Package

@kintone/dts-gen

Why

Supported in version 5, but error in version 8.

# success
$ npx -p @kintone/dts-gen@5 kintone-dts-gen --app-id 12 --type-name 'App取引先Fields'
$ npx -p @kintone/dts-gen@8 kintone-dts-gen --app-id 12 --type-name 'App取引先Fields'
Invalid type-name option!
The namespace and type-name convention:
- Starts with a letter (`a-z` or `A-Z`), underscore (`_`), or dollar sign (`$`).
- Can be followed by any alphanumeric, underscores, or dollar signs.

This pull request is the reason. ref. #2137
The ECMAScript specification allows Japanese for identifiers.
https://262.ecma-international.org/14.0/index.html#prod-IdentifierName

IdentifierStartChar ::
  UnicodeIDStart <-- Japanese included
  $
  _
IdentifierPartChar ::
  UnicodeIDContinue <-- Japanese included
  $
  <ZWNJ>
  <ZWJ>

What

Could you change this regex to the following?

const identifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;

const identifierRegex = /^[\p{ID_Start}_$][\p{ID_Continue}$]*$/u
$ node
Welcome to Node.js v20.17.0.
Type ".help" for more information.
> /^[\p{ID_Start}_$][\p{ID_Continue}$]*$/u.test('取引先')
true
@tuchida tuchida added the feature request Feature request label Oct 25, 2024
@chihiro-adachi
Copy link
Contributor

@tuchida
Thank you! I think it's LGTM.
If you don't mind, could you please make a pull request?

@tuchida
Copy link
Contributor Author

tuchida commented Nov 5, 2024

Thanks!

@tuchida tuchida closed this as completed Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request
Projects
None yet
Development

No branches or pull requests

2 participants