Skip to content

kebab-case parameters #177

@ysKuga

Description

@ysKuga

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions