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

feat(docz-core): support kebab & pascal case component file name pattern #1314

Merged

Conversation

axe312ger
Copy link
Contributor

Description

Some of my projects are using kebab case as file name pattern. This adds support for pascal case file naming in case somebody feels like using it in their (legacy?) project.

Review

  • Should we add more patterns?

@rakannimer
Copy link
Contributor

Thanks for the PR @axe312ger !

CI is failing because of the absence of type defs for kebab-case and pascal-case.

To fix it we can :

  1. replace the kebab-case module with kebabCase from lodash (import { kebabCase } from 'lodash')
  2. add @types/pascal-case as a dependency (yarn add -D @types/pascal-case)

What do you think ?

@axe312ger
Copy link
Contributor Author

axe312ger commented Dec 13, 2019

I'd suggest switch all string case manipulations to run with the same framework.

As pascal/upper-camel-case is only supported by change-case, it covers all the other ones and exports every case manipulation function as a separate packe, we should got for that one:

  • keep pascalCase and add typings
  • keep kebabCase and add typings
  • thought about replacing capitalize which we have in other parts of the repo with capitalCase, but that might change the current behaviour.

Actually no, totally fine what u are suggesting. Lets just add one extra dependency and we are good :)

@axe312ger
Copy link
Contributor Author

@rakannimer I added the types, still failing. Any idea?

@rakannimer
Copy link
Contributor

Can you try

import { pascalCase } from "pascal-case";

The error is :

Error: src/components/Props.tsx:126:11 - error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("/home/circleci/repo/node_modules/pascal-case/dist/index")' has no compatible call signatures.

126       `/${pascalCase(componentName)}.`,
              ~~~~~~~~~~~~~~~~~~~~~~~~~

@rakannimer rakannimer merged commit 9d5b129 into doczjs:master Dec 14, 2019
@axe312ger axe312ger deleted the feat/support-more-filename-patterns branch December 14, 2019 19:44
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

Successfully merging this pull request may close these issues.

2 participants