diff options
author | Andinus <andinus@nand.sh> | 2021-08-25 20:10:19 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2021-08-25 20:10:19 +0530 |
commit | 3fb698bbe091cbaa8d5d3f2256ebfb776523448d (patch) | |
tree | 46afb9bc82dd810ef9b7b21ed15056721373fe18 /javascript/hello-world | |
parent | 094df4feb1fc02197029764e4f748c9680150574 (diff) | |
download | exercism-3fb698bbe091cbaa8d5d3f2256ebfb776523448d.tar.gz |
JS: Solve hello-world, two-fer, square-root
Diffstat (limited to 'javascript/hello-world')
-rw-r--r-- | javascript/hello-world/.eslintrc | 29 | ||||
-rw-r--r-- | javascript/hello-world/.npmrc | 1 | ||||
-rw-r--r-- | javascript/hello-world/README.md | 64 | ||||
-rw-r--r-- | javascript/hello-world/babel.config.js | 15 | ||||
-rw-r--r-- | javascript/hello-world/hello-world.js | 3 | ||||
-rw-r--r-- | javascript/hello-world/hello-world.spec.js | 7 | ||||
-rw-r--r-- | javascript/hello-world/package.json | 37 |
7 files changed, 156 insertions, 0 deletions
diff --git a/javascript/hello-world/.eslintrc b/javascript/hello-world/.eslintrc new file mode 100644 index 0000000..b8dab20 --- /dev/null +++ b/javascript/hello-world/.eslintrc @@ -0,0 +1,29 @@ +{ + "root": true, + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 7, + "sourceType": "module" + }, + "globals": { + "BigInt": true + }, + "env": { + "es6": true, + "node": true, + "jest": true + }, + "extends": [ + "eslint:recommended", + "plugin:import/errors", + "plugin:import/warnings" + ], + "rules": { + "linebreak-style": "off", + + "import/extensions": "off", + "import/no-default-export": "off", + "import/no-unresolved": "off", + "import/prefer-default-export": "off" + } +} diff --git a/javascript/hello-world/.npmrc b/javascript/hello-world/.npmrc new file mode 100644 index 0000000..d26df80 --- /dev/null +++ b/javascript/hello-world/.npmrc @@ -0,0 +1 @@ +audit=false diff --git a/javascript/hello-world/README.md b/javascript/hello-world/README.md new file mode 100644 index 0000000..21fe8c9 --- /dev/null +++ b/javascript/hello-world/README.md @@ -0,0 +1,64 @@ +# Hello World + +The classical introductory exercise. Just say "Hello, World!". + +["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is +the traditional first program for beginning programming in a new language +or environment. + +The objectives are simple: + +- Write a function that returns the string "Hello, World!". +- Run the test suite and make sure that it succeeds. +- Submit your solution and check it at the website. + +If everything goes well, you will be ready to fetch your first real exercise. + +## Setup + +Go through the setup instructions for Javascript to install the necessary +dependencies: + +[https://exercism.io/tracks/javascript/installation](https://exercism.io/tracks/javascript/installation) + +## Requirements + +Please `cd` into exercise directory before running all below commands. + +Install assignment dependencies: + +```bash +$ npm install +``` + +## Making the test suite pass + +Execute the tests with: + +```bash +$ npm test +``` + +In the test suites all tests but the first have been skipped. + +Once you get a test passing, you can enable the next one by changing `xtest` to +`test`. + + +## Submitting Solutions + +Once you have a solution ready, you can submit it using: + +```bash +exercism submit hello-world.js +``` + +## Submitting Incomplete Solutions + +It's possible to submit an incomplete solution so you can see how others have +completed the exercise. + +## Exercise Source Credits + +This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) + diff --git a/javascript/hello-world/babel.config.js b/javascript/hello-world/babel.config.js new file mode 100644 index 0000000..5cec972 --- /dev/null +++ b/javascript/hello-world/babel.config.js @@ -0,0 +1,15 @@ +module.exports = { + presets: [ + [ + '@babel/preset-env', + { + targets: { + node: 'current', + }, + useBuiltIns: 'entry', + corejs: 3, + }, + ], + ], + plugins: ['@babel/plugin-syntax-bigint'], +}; diff --git a/javascript/hello-world/hello-world.js b/javascript/hello-world/hello-world.js new file mode 100644 index 0000000..7e071c7 --- /dev/null +++ b/javascript/hello-world/hello-world.js @@ -0,0 +1,3 @@ +export const hello = () => { + return "Hello, World!"; +}; diff --git a/javascript/hello-world/hello-world.spec.js b/javascript/hello-world/hello-world.spec.js new file mode 100644 index 0000000..cd0b7ec --- /dev/null +++ b/javascript/hello-world/hello-world.spec.js @@ -0,0 +1,7 @@ +import { hello } from './hello-world'; + +describe('Hello World', () => { + test('Say Hi!', () => { + expect(hello()).toEqual('Hello, World!'); + }); +}); diff --git a/javascript/hello-world/package.json b/javascript/hello-world/package.json new file mode 100644 index 0000000..b642b30 --- /dev/null +++ b/javascript/hello-world/package.json @@ -0,0 +1,37 @@ +{ + "name": "@exercism/javascript", + "description": "Exercism exercises in Javascript.", + "author": "Katrina Owen", + "private": true, + "repository": { + "type": "git", + "url": "https://github.com/exercism/javascript" + }, + "devDependencies": { + "@babel/cli": "^7.12.10", + "@babel/core": "^7.12.10", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/preset-env": "^7.12.11", + "@types/jest": "^26.0.19", + "@types/node": "^14.14.14", + "babel-eslint": "^10.1.0", + "babel-jest": "^26.6.3", + "core-js": "^3.8.1", + "eslint": "^7.15.0", + "eslint-plugin-import": "^2.22.1", + "jest": "^26.6.3" + }, + "jest": { + "modulePathIgnorePatterns": [ + "package.json" + ] + }, + "scripts": { + "test": "jest --no-cache ./*", + "watch": "jest --no-cache --watch ./*", + "lint": "eslint ." + }, + "license": "MIT", + "dependencies": {}, + "version": "1.1.0" +} |