Skip to content

Commit 47a3600

Browse files
committed
Highlight code in package.json with json mode
Escape * in code.
1 parent 431fceb commit 47a3600

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/content/3/en/part3a.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The file defines, for instance, that the entry point of the application is the <
4141

4242
Let's make a small change to the <i>scripts</i> object by adding a new script command.
4343

44-
```bash
44+
```json
4545
{
4646
// ...
4747
"scripts": {
@@ -72,7 +72,7 @@ npm start
7272

7373
The <i>start</i> npm script works because we defined it in the <i>package.json</i> file:
7474

75-
```bash
75+
```json
7676
{
7777
// ...
7878
"scripts": {
@@ -370,7 +370,7 @@ Now, changes to the application's code will cause the server to restart automati
370370

371371
Let's define a custom <i>npm script</i> in the <i>package.json</i> file to start the development server:
372372

373-
```bash
373+
```json
374374
{
375375
// ..
376376
"scripts": {
@@ -735,7 +735,7 @@ The function body contains a row that looks a bit intriguing:
735735
Math.max(...notes.map(n => Number(n.id)))
736736
```
737737

738-
What exactly is happening in that line of code? <em>notes.map(n => n.id)</em> creates a new array that contains all the ids of the notes in number form. [Math.max](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) returns the maximum value of the numbers that are passed to it. However, <em>notes.map(n => Number(n.id))</em> is an <i>array</i> so it can't directly be given as a parameter to _Math.max_. The array can be transformed into individual numbers by using the "three dot" [spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) syntax <em>...</em>.
738+
What exactly is happening in that line of code? <em>notes.map(n => Number(n.id))</em> creates a new array that contains all the ids of the notes in number form. [Math.max](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) returns the maximum value of the numbers that are passed to it. However, <em>notes.map(n => Number(n.id))</em> is an <i>array</i> so it can't directly be given as a parameter to _Math.max_. The array can be transformed into individual numbers by using the "three dot" [spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) syntax <em>...</em>.
739739

740740
</div>
741741

src/content/3/en/part3b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ Because in development mode the frontend is at the address <i>localhost:5173</i>
457457
458458
If the project was created with Vite, this problem is easy to solve. It is enough to add the following declaration to the <i>vite.config.js</i> file of the frontend directory.
459459
460-
```bash
460+
```js
461461
import { defineConfig } from 'vite'
462462
import react from '@vitejs/plugin-react'
463463

src/content/3/en/part3d.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export default [
249249
]
250250
```
251251

252-
So far, our ESLint configuration file defines the _files_ option with _["**/*.js"]_, which tells ESLint to look at all JavaScript files in our project folder. The _languageOptions_ property specifies options related to language features that ESLint should expect, in which we defined the _sourceType_ option as "commonjs". This indicates that the JavaScript code in our project uses the CommonJS module system, allowing ESLint to parse the code accordingly.
252+
So far, our ESLint configuration file defines the _files_ option with _["\*\*/\*.js"]_, which tells ESLint to look at all JavaScript files in our project folder. The _languageOptions_ property specifies options related to language features that ESLint should expect, in which we defined the _sourceType_ option as "commonjs". This indicates that the JavaScript code in our project uses the CommonJS module system, allowing ESLint to parse the code accordingly.
253253

254254
The _globals_ property specifies global variables that are predefined. The spread operator applied here tells ESLint to include all global variables defined in the _globals.node_ settings such as the _process_. In the case of browser code we would define here _globals.browser_ to allow browser specific global variables like _window_, and _document_.
255255

0 commit comments

Comments
 (0)