js-sdk icon indicating copy to clipboard operation
js-sdk copied to clipboard

[Feature Request] support Japanese in typename

Open tuchida opened this issue 4 months ago • 1 comments

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? https://github.com/kintone/js-sdk/blob/8e058e5d248b7f04ff822c3b353b757b2e347dad/packages/dts-gen/src/validators/args.ts#L27

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 avatar Oct 25 '24 01:10 tuchida