> For the complete documentation index, see [llms.txt](https://docs.devland.is/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devland.is/technical-overview/adr/0009-naming-files-and-directories.md).

# Unified Naming Strategy for Files and Directories

* Status: accepted
* Deciders: devs
* Date: 2020-07-03

## Context and Problem Statement

As of the date of this writing, there are multiple different naming styles used in the monorepo, mostly because NX has defaults that differ between schematic types. In order for navigating the monorepo in a consistent rational manner, we should align on naming strategy for files and directories.

## Decision Drivers

* Provide consistency when navigating the codebase
* The earlier we decide on this, the better

## Considered Options

Some mixture of these:

* kebab-case
* PascalCase
* camelCase
* snake\_case

## Decision Outcome

Chosen option: Name files after their default export. If that default export is a React Component, or a class, then the file name should be in PascalCase. Otherwise, the filename should be in camelCase. Basically, for naming files avoid using kebab-case and snake\_case and make sure the name follows the default export of the file.

Naming directories should follow these guidelines: Only use kebab-case when naming NX apps and libraries, or folders containing apps and libraries, e.g. `island-ui` instead of `islandUi`: `import { Box } from '@island.is/island-ui/core'`

Use PascalCase for directories only containing React components:

```
components/CtaButton/index.ts
import 'components/CtaButton'
```

or:

```
components/CtaButton/CtaButton.tsx
import 'components/CtaButton/CtaButton'
```

rather than

```
components/cta-button/CtaButton.tsx
```

In all other cases, use camelCase.

### Positive Consequences

* Easier to navigate the codebase
* File names are more readable, and developers know what to expect
* This approach is the most common practice, and something most JS and TS developers are familiar with.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devland.is/technical-overview/adr/0009-naming-files-and-directories.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
