TL/DR: When requiring another script in Node.js and defining it as a const should the variable name still be in camelCase like it was usual with var or should it instead be in SCREAMING_SNAKE_CASE as is more usual for a const?
const someVariable = require('...js');
vs
const SOME_VARIABLE = require('...js');
Longer version: In Node.js another script is usually imported using
var someScript = require('path/to/someScript.js');
With ES6 being available in Node.js such a var could instead be declared as a const (or in some cases as a let if it's ever redefined).
Now as we're working on defining a style guide for our development we came to the conclusion in other languages like Typescript (Angular 2) that whenever we declare a const we write the variable name in SCREAMING_SNAKE_CASE like
const SOME_CONSTANT_VARIABLE = '123';
Now we would conclude that this means that in Node.js we should define our script variables like
const SOME_SCRIPT = require('path/to/someScript.js');
As you're usually using those script variables a lot in Node.js code can become quite difficult to read. Also I couldn't see a lot of examples of other people doing it similarly and instead often use it like
const someScript = ...;
so still writing the variable name in camelCase.
My question is as a What is the preferred / best practice way of writing those variable names using ES6 const?
var
s could usually beconst
.