Filename and directory structure
See original GitHub issueI 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';
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
File naming and structure - Research Data Management at ...
File naming best practices: · Files should be named consistently · File names should be short but descriptive (<25 characters) (Briney, 2015) ...
Read more >Filename - Wikipedia
A filename or file name is a name used to uniquely identify a computer file in a directory structure. Different file systems impose...
Read more >preserving the original sub-folder and filename
The PreservedFilename tag is the most common place to store an original filename. You could store the directory there as well if you...
Read more >Chapter 4. Organizing and Naming Files and Folders - O'Reilly
The directory structure is the organization of files into a hierarchy of folders. It should be stable and scalable; ... Working File Directory...
Read more >File and Directory Names: File, Path, Paths (Java Files Tutorial)
io.File . A file object can represent a filename, a directory name, a relative file or directory path, or an absolute file or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, ideally the directory name would match the name of the default export of
index.js
. Perhaps some tweaking of https://github.com/airbnb/javascript#naming--filename-matches-export is needed.Great, thanks! You can close the ticket, or leave it open as a reminder to tweak the guide.