This project focuses on ES6 (ECMAScript 2015) features and concepts in JavaScript. You'll be working on various tasks to understand and apply ES6 features.
In this project, you will work with various ES6 features and concepts in JavaScript. You will complete a series of tasks, each focusing on different aspects of ES6.
- Ubuntu 18.04 LTS
- NodeJS 12.11.x
- Allowed Editors: vi, vim, emacs, Visual Studio Code
- All files should have a
.js
extension. - Project should use Jest Testing Framework for testing.
- ESLint should be used with specific rules provided.
- All functions must be exported.
To set up the project, follow these steps:
- Install NodeJS 12.11.x:
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh sudo bash nodesource_setup.sh sudo apt install nodejs -y
nodejs -v
npm -v
In your project directory, install Jest, Babel and ESList by using the supplied package.json and run npm install.
Add the files below to your project directory
package.json
{
"scripts": {
"lint": "./node_modules/.bin/eslint",
"check-lint": "lint [0-9]*.js",
"dev": "npx babel-node",
"test": "jest",
"full-test": "./node_modules/.bin/eslint [0-9]*.js && jest"
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@babel/node": "^7.8.0",
"@babel/preset-env": "^7.6.0",
"eslint": "^6.4.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.17.0",
"jest": "^24.9.0"
}
}
babel.config.js
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
};
.eslintrc.js
```javascript
module.exports = {
env: {
browser: false,
es6: true,
jest: true,
},
extends: [
'airbnb-base',
'plugin:jest/all',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['jest'],
rules: {
'no-console': 'off',
'no-shadow': 'off',
'no-restricted-syntax': [
'error',
'LabeledStatement',
'WithStatement',
],
},
overrides:[
{
files: ['*.js'],
excludedFiles: 'babel.config.js',
}
]
};
### Finally…
Don’t forget to run npm install from the terminal of your project folder to install all necessary project dependencies.