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

kebab-case parameters #177

Open
ysKuga opened this issue May 17, 2023 · 0 comments
Open

kebab-case parameters #177

ysKuga opened this issue May 17, 2023 · 0 comments

Comments

@ysKuga
Copy link

ysKuga commented May 17, 2023

Description

When I use query or slug in kebab case, the generated file has a syntax error, and I want to solve this problem by enclosing the description in quotation marks.

翻訳処理前の日本語 kebab case での query や slug を使用すると生成されるファイルが syntax error となるので、記述をクォーテーションなどで囲うことで解決したい。
src/pages/
└── test
    ├── [test-id]
    │   └── index.js
    └── index.js
install -Dv /dev/null src/pages/test/index.js
install -Dv /dev/null src/pages/test/[test-id]/index.js
node bin/index.js

current output

image

export const pagesPath = {
  "test": {
    _test-id: (test-id: string | number) => ({
      $url: (url?: { hash?: string }) => ({ pathname: '/test/[test-id]' as const, query: { test-id }, hash: url?.hash })
    }),
    $url: (url?: { hash?: string }) => ({ pathname: '/test' as const, hash: url?.hash })
  }
}

export type PagesPath = typeof pagesPath

modified output

export const pagesPath = {
  "test": {
    "_test-id": (test_id: string | number) => ({
      $url: (url?: { hash?: string }) => ({ pathname: '/test/[test-id]' as const, query: { 'test-id': test_id }, hash: url?.hash })
    }),
・・・

Describe the solution you'd like

  • properties are not renamed by enclosing it in quotation marks
  • variable are set to snake case

Additional context

pull request for the forked repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant