mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 03:57:57 -05:00
naming files containing one class
This commit is contained in:
19
README.md
19
README.md
@@ -1208,6 +1208,25 @@
|
||||
|
||||
- **Note:** IE8 and below exhibit some quirks with named function expressions. See [http://kangax.github.io/nfe/](http://kangax.github.io/nfe/) for more info.
|
||||
|
||||
- If your file exports a single class, your filename should be exactly the name of the class.
|
||||
```javascript
|
||||
// file contents
|
||||
class CheckBox {
|
||||
// ...
|
||||
}
|
||||
module.exports = CheckBox;
|
||||
|
||||
// in some other file
|
||||
// bad
|
||||
var CheckBox = require('./checkBox');
|
||||
|
||||
// bad
|
||||
var CheckBox = require('./check_box');
|
||||
|
||||
// good
|
||||
var CheckBox = require('./CheckBox');
|
||||
```
|
||||
|
||||
**[⬆ back to top](#table-of-contents)**
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user