Skip to content

chore: rethink source file naming, consider camelCase and PascalCase #268

@rodmax

Description

@rodmax

It looks like react world gone craze loves pascalCase.ts and CamelCase.ts naming for source files

personally, i don't like this but my engineering principles require unification with the community if this is an proven (de'facto standard) convention

👀 Discover popular repos:

  • react: files - camelCase,PascalCase, folders - dash-case
  • create-react-app: the same as react 😺
  • ui-material: files - camelCase,PascalCase, folders - corresponding to content camelCase,PascalCase

Starting points:

Match your component-related files with the component name

source https://levelup.gitconnected.com/2-simple-effective-react-file-naming-convention-tips-cce1022328a8

Since your component names are already adhering to the PascalCase naming convention (they are, aren’t they…?), let’s keep this going:

├── components
│   ├── SomeComponent
│   │   ├── SomeComponent.test.jsx
│   │   ├── SomeComponent.jsx
│   │   └── SomeComponent.styles.js

Use dot + suffix to explain tech context {camelCase,PascalCase}.some.{tsx,scss}

*.spec.ts, *.reducer.ts, *.slice.ts *.types.ts *.module.ts

Folder names for folder with code

  • PascalCase for folder whitch contain component, specific class (even if in the folder also lives component related helpers in separate files)
  • camelCase for any other folders with code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions