Not: it is quoted from google javascript guide document
https://google.github.io/styleguide/jsguide.html
File names must be all lowercase and may include underscores (_) or dashes (-), but no additional punctuation. Follow the convention that your project uses. Filenames’ extension must be .js. example: user-relations.js
Classes, enums, functions, constants, and other symbols are exported using the exports object. Exported symbols may be defined directly on the exports object, or else declared locally and exported separately. Symbols are only exported if they are meant to be used outside the module. Non-exported module-local symbols are not declared @private nor do their names end with an underscore. There is no prescribed ordering for exported and module-local symbols.
const /** !Array<number> */ exportedArray = [1, 2, 3];
const /** !Array<number> */ moduleLocalArray = [4, 5, 6];
/** @return {number} */
function moduleLocalFunction() {
return moduleLocalArray.length;
}
/** @return {number} */
function exportedFunction() {
return moduleLocalFunction() * 2;
}
exports = {exportedArray, exportedFunction};
ES module files must use the import statement to import other ES module files.
import './sideeffects.js';
import * as goog from '../closure/goog/goog.js';
import * as parent from '../parent.js';
import {name} from './sibling.js';
Module import names (import * as name) are lowerCamelCase names that are derived from the imported file name.
import * as fileOne from '../file-one.js';
import * as fileTwo from '../file_two.js';
import * as fileThree from '../filethree.js';
import * as libString from './lib/string.js';
import * as math from './math/math.js';
import * as vectorMath from './vector/math.js';
Default import names are derived from the imported file name and follow the rules in 6.2 Rules by identifier type.
import MyClass from '../my-class.js'; // for class
import myFunction from '../my_function.js'; // for function
import SOME_CONSTANT from '../someconstant.js'; // constants
// Do not use default exports:
export default class Foo { ... } // BAD!
// Use named exports:
export class Foo { ... }
// Alternate style named exports:
class Foo { ... }
export {Foo};