From 8c64f99316748b44198397ef32b6437679c140f4 Mon Sep 17 00:00:00 2001 From: Eric Lavault <39483232+lvlte@users.noreply.github.com> Date: Mon, 11 Oct 2021 16:23:02 +0200 Subject: [PATCH] Officially switching to ES Module system. --- CONTRIBUTING.md | 8 +++++++- babel.config.js => babel.config.cjs | 0 package.json | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) rename babel.config.js => babel.config.cjs (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 38a263781..e2cd9109c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,6 +61,12 @@ should add unique value. * **Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not. +#### Module System + +We use the [ES Module](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) system, which bring an official, standardized module system to JavaScript. + +It roughly means you will need to use `export` and `import` statements instead of `module.exports` and `require()`. + #### Testing Be confident that your code works. When was the last time you committed a code change, your build failed, and half of @@ -125,7 +131,7 @@ function sumOfArray (arrayOfNumbers) { return (sum) } ``` -* +* * Avoid using global variables and avoid `==` * Please use `let` over `var` * Please refrain from using `console.log` or any other console methods diff --git a/babel.config.js b/babel.config.cjs similarity index 100% rename from babel.config.js rename to babel.config.cjs diff --git a/package.json b/package.json index a870694dd..d4f8414ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "javascript", "version": "1.0.0", + "type": "module", "description": "A repository for All algorithms implemented in Javascript (for educational purposes only)", "main": "", "scripts": {