From e9b573287c405d67b9a92f213df137f11a011913 Mon Sep 17 00:00:00 2001 From: Jake Teton-Landis Date: Wed, 11 Mar 2015 15:01:14 -0700 Subject: [PATCH] naming files containing one class --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 6cf1f6d0..99e286d7 100644 --- a/README.md +++ b/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)**