Skip to content

Filename and directory structure #817

@tleunen

Description

@tleunen

I have a question about the naming convention, the styleguide specifies that if the file exports a single class, the name of the file should be the name of the class. (see https://github.com/airbnb/javascript#naming--filename-matches-export)

So something like this:

import CheckBox from './CheckBox';

What about the directory structure? Is there any preference?
Because, these 2 structures are good based on the styleguide, but the import syntax will be different.

├── src
│   ├── CheckBox
│   │   ├── index.js
│   │   ├── CheckBox.js
import CheckBox from './CheckBox';
├── src
│   ├── checkbox
│   │   ├── index.js
│   │   ├── CheckBox.js
import CheckBox from './checkbox';

Does airbnb have a preference?
For internal component, I find it ok to have import with capital letters, but in an external library, it doesn't seem very common to have import CheckBox from 'component-lib/CheckBox';

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions