Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Add Travis CI, ESLint, Prettier, unit tests for homework in preparation for class 19 #202

Merged
merged 6 commits into from
Jan 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions .eslintrc

This file was deleted.

24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"extends": ["airbnb", "prettier"],
"plugins": ["prettier"],
"env": {
"browser": true,
"jest": true
},
"rules": {
"prettier/prettier": ["error"],
"strict": "off",
"func-names": "off",
"import/no-dynamic-require": "off",
"no-console": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-restricted-syntax": "off",
"object-shorthand": "off",
"operator-assignment": "off",
"prefer-arrow-callback": "off",
"prefer-destructuring": "off",
"prefer-template": "off",
"trailing-comma": "off"
}
}
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- '10'

script:
- npm run lint
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"codewars",
"keyup",
"maartje's",
"maartjes",
"roverjs",
"taalmap",
"trollface"
Expand Down
68 changes: 27 additions & 41 deletions Week1/MAKEME.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,95 +2,81 @@

```
Topics discussed in class this week:
• Capturing user input
• Capturing user input
• Events
• Basic DOM manipulations (img src, innerHTML)
• Code debugging using the browser
• Code debugging using the browser
• Code commenting
• Structuring code files
• Code formatting
• Handing in homework via PR
```

>[Here](/Week2/README.md) you find the readings you have to complete before the second lecture.
> [Here](/Week2/README.md) you find the readings you have to complete before the second lecture.

## Step 0: Make a small dance
Give yourself (or your neighbor) a little tap on the shoulder, you've made it to JS2! :muscle:


## Step 1: Implement feedback

_Deadline Monday_

Your fellow students and teachers have provided you with feedback on your last JavaScript1 homework in Trello.

- Implement both feedback from Trello and Github.
- Check on one of your fellow students code and issues and see if her or she implemented their feedback correctly. If there are some things that can be improved make an issue suggesting further improvements. If you think that the feedback has been implemented correctly create a issue saying something like: "nice work you can clear your issues".

## Step 2: Custom DOM manipulation challenge :mortar_board:
Give yourself (or your neighbor) a little tap on the shoulder, you've made it to JS2! :muscle:

_Deadline Saturday_
## Step 1: Custom DOM manipulation challenge :mortar_board:

> **Preparation**: Fork this repository and use the [Homework Pull Request Workflow](../../../../fundamentals/blob/master/fundamentals/homework_pr.md) to hand in your homework.
_Deadline Thursday evening_

Modify the (mostly empty) files in the `Week1/homework` folder for this step.

**2.1** Open the `apps.js` and start by declaring an array that contains 10 strings. These strings should be of book titles you have read (or made up) and be lowercase without spaces so that you can use these later as HTML `id` attributes. (Example: _Harry Potter's - The Chamber of Secrets_ -> `harry_potter_chamber_secrets`). Add a console.log statement to output this array to console. (This is for debugging and making sure everything is in order. Delete it later when you're done :))
**1.1** Open the `apps.js` and start by declaring an array that contains 10 strings. These strings should be of book titles you have read (or made up) and be lowercase without spaces so that you can use these later as HTML `id` attributes. (Example: _Harry Potter's - The Chamber of Secrets_ -> `harry_potter_chamber_secrets`). Add a console.log statement to output this array to console. (This is for debugging and making sure everything is in order. Delete it later when you're done :))

**2.2** Open the empty `index.html` and add the required HTML to load the `app.js` file. Open `index.html` in the browser and confirm that the `console.log` statement shows the array. (Open the Chrome Developer Tools and inspect the console.)
**1.2** Open the empty `index.html` and add the required HTML to load the `app.js` file. Open `index.html` in the browser and confirm that the `console.log` statement shows the array. (Open the Chrome Developer Tools and inspect the console.)

**2.3** Remove the temporary `console.log` from step 2.1. Make a function (or functions) that generate a `ul` with `li` elements for each book ID in the array using a `for` loop. Make sure that the function names you choose are an accurate reflection of what they do. As a reminder, here are the recommended [Naming Conventions](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/naming_conventions.md).
**1.3** Remove the temporary `console.log` from step 1.1. Make a function (or functions) that generate a `ul` with `li` elements for each book ID in the array using a `for` loop. Make sure that the function names you choose are an accurate reflection of what they do. As a reminder, here are the recommended [Naming Conventions](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/naming_conventions.md).

**2.4** Make an object (_not an array!_) containing information for each book. Each property of this object should be another (i.e., nested) object with the book ID you thought up in step 2.1 as a key, and at least the following properties: `title`, `language` and `author`.
**1.4** Make an object (_not an array!_) containing information for each book. Each property of this object should be another (i.e., nested) object with the book ID you thought up in step 1.1 as a key, and at least the following properties: `title`, `language` and `author`.

**2.5** Now change the function from step 2.3 that you used to display the book ID's in a list to take the actual information about the book from the object and display that. Make sure you choose the correct HTML elements for each piece of info, for instance, a heading for the title.
**1.5** Now change the function from step 1.3 that you used to display the book ID's in a list to take the actual information about the book from the object and display that. Make sure you choose the correct HTML elements for each piece of info, for instance, a heading for the title.

**2.6** Beautify your html page with css (use the `style.css` file for that), add sources and alts to each of the images.

**2.7** Find and download book covers for each book and construct a new object which has as keys the book IDs again, and as value the path to the image source (e.g. `{ harry_potter_blabla: './img/harry_potter_blabla.jpg', ... }`).
**1.6** Beautify your html page with css (use the `style.css` file for that), add sources and alts to each of the images.

Loop over these entries (_hint: `Object.keys(objectName)` gives you an array containing the keys_). Then write a function which places an image at the corresponding `li` element. Remember that objects are not ordered, so you cannot guarantee that the first key is the first `li` element. (_Hint: you could give each `li` item an `id` tag by modifying the function you made before._)
**1.7** Find and download book covers for each book and construct a new object which has as keys the book IDs again, and as value the path to the image source (e.g. `{ harry_potter_blabla: './img/harry_potter_blabla.jpg', ... }`).

**1.8** Loop over these entries (_hint: `Object.keys(objectName)` gives you an array containing the keys_). Then write a function which places an image at the corresponding `li` element. Remember that objects are not ordered, so you cannot guarantee that the first key is the first `li` element. (_Hint: you could give each `li` item an `id` tag by modifying the function you made before._)

### How to hand in your homework:

Go over your homework one last time:

- Does every file run without errors and with the correct results when you run them with Node?
- Does every file start with `'use strict';`?
- Have you used `const` and `let` and avoided `var`?
- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)?
- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/code_formatting.md))?
- Does your JavaScript file start with `'use strict';`?
- Do the variable, function and argument names you created follow the [Naming Conventions](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/naming_conventions.md)?
- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)?

If the answer is 'yes' to all preceding questions you are ready to follow these instructions:

- [Handing in homework](../../../../fundamentals/blob/master/fundamentals/homework_pr.md)
- [Handing in homework](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/homework_pr.md)

## Step 4: **FreeCodeCamp challenges:**
## Step 2: **FreeCodeCamp challenges:**

_Deadline Sunday morning_

-[Build JavaScript Objects](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects)
- Use a Constructor to Create Objects
- https://www.freecodecamp.com/challenges/make-instances-of-objects-with-a-constructor-function
- https://www.freecodecamp.com/challenges/make-unique-objects-by-passing-parameters-to-our-constructor
- https://www.freecodecamp.com/challenges/make-object-properties-private
- [Build JavaScript Objects](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects)

Use a Constructor to Create Objects

And just for fun ... https://www.freecodecamp.com/challenges/sum-all-numbers-in-a-range
- [Define a Constructor Function](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/define-a-constructor-function)
- [Extend Constructors to Receive Argument](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/extend-constructors-to-receive-arguments)

## Step 5: Read before next lecture
And just for fun ... [Sum All Numbers in a Range](https://www.freecodecamp.com/challenges/sum-all-numbers-in-a-range)

## Step 3: Read before next lecture

_Deadline Sunday morning_

Go trough the reading material in the [README.md](/Week2/README.md) to prepare for your next class

## :boom: Bonus homework :boom:

the Bonus homework for this week (for those of you want an extra challenge) do the following:

- Sign up on codewars.com
- In you account setting under “clan” write “Hack Your Future”
- In you account setting under “clan” write “Hack Your Future”
- Go do the challenges in the following playlist: https://www.codewars.com/collections/fun-fun-fundamentals

Codewars is really a lot of fun, and you can compete against each other who has the most points :trollface:
Expand Down
64 changes: 45 additions & 19 deletions Week1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,47 @@ In week one we will discuss the following topics:
• Handing in homework via PR
```

- Chrome DevTools [Debugging](https://developers.google.com/web/tools/chrome-devtools/)
## Software installation for the JavaScript 2 Module

### A Refresher from some previous covered topics:
**_To save time, please do these preparations at home before coming to the first lecture._**

Links to MDN (Mozilla Developer Network) topics:
1. Install the following extensions in VSCode (you may have installed some of them already):

- [Strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)
- Code Spell Checker
- ESLint
- Prettier - Code formatter
- open in browser
- Live Server
- Bracket Pair Colorizer

2. Install the ESLint tool globally by issuing the following command from the command line:

```
npm install -g eslint
```

3. Fork this repository (i.e., **JavaScript2**) and clone your fork to your laptop.

4. Open the `JavaScript2` folder from the cloned repository in VSCode.

5. Open a terminal window in VSCode and type the following command:

## Review
```
npm install
```

Review through the topics of JavaScript1:
## Review of JavaScript1

### JavaScript1 - Week 2
As a refresher, go through the topics of JavaScript1:

### Week 2

- [Variables (var, let, const)](./../../../../fundamentals/blob/master/fundamentals/variables.md)
- [Basic Data types (Strings, Numbers, Arrays, Booleans)](./../../../../fundamentals/blob/master/fundamentals/values.md)
- [Operators](./../../../../fundamentals/blob/master/fundamentals/operators.md)
- [Naming conventions](./../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)

### JavaScript1 - Week 3
### Week 3

- [Advanced data types (objects)](./../../../../fundamentals/blob/master/fundamentals/objects.md)
- [Conditional execution](./../../../../fundamentals/blob/master/fundamentals/conditional_execution.md) <br>
Expand All @@ -40,7 +61,7 @@ Review through the topics of JavaScript1:
- [Functions](./../../../../fundamentals/blob/master/fundamentals/functions.md)
- [Scope](./../../../../fundamentals/blob/master/fundamentals/scope.md)

### Required readings
## Required readings for the first lecture

(No reading material available at this time for the crossed-out topics)

Expand All @@ -53,6 +74,11 @@ Review through the topics of JavaScript1:
- [Code formatting](./../../../../fundamentals/blob/master/fundamentals/code_formatting.md)
- [Handing in homework via PR](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/homework_pr.md)

Extras:

- [Strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)
- [Chrome DevTools Debugging](https://developers.google.com/web/tools/chrome-devtools/)

### Recommended readings

These chapters from _Eloquent JavaScript_ give in-depth explanations of the topics that will be discussed during the lecture. Highly recommended (if time permits).
Expand All @@ -61,20 +87,20 @@ These chapters from _Eloquent JavaScript_ give in-depth explanations of the topi

- Chapter 14: [The Document Object Model](http://eloquentjavascript.net/14_dom.html)

_You can skip the following sections:_
_You can skip the following sections:_

- Moving through the tree
- Moving through the tree

- Chapter 15: [Handling Events](http://eloquentjavascript.net/15_event.html)

Notes: for the lectures and homework you only need to know about these events: `click`, `change`, `keyup` and `load`.
_You can skip the following sections (but come to these sections when doing the React module):_
Notes: for the lectures and homework you only need to know about these events: `click`, `change`, `keyup` and `load`.

_You can skip the following sections (but come to these sections when doing the React module):_

- Touch events
- Scroll events
- Focus events
- Events and the Event Loop
- Debouncing
- Touch events
- Scroll events
- Focus events
- Events and the Event Loop
- Debouncing

_Please go through the material and come to class prepared!_
2 changes: 1 addition & 1 deletion Week1/homework/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

{
const bookTitles = [
// Replace with your own book titles
'harry_potter_chamber_secrets'
];


// Replace with your own code
console.log(bookTitles);
}
Loading