Skip to content

Commit 879e1cf

Browse files
committed
Make all JSON code syntactically valid
1 parent 35f4aaf commit 879e1cf

File tree

27 files changed

+310
-233
lines changed

27 files changed

+310
-233
lines changed

files/en-us/learn_web_development/core/frameworks_libraries/svelte_deployment_next/index.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,13 @@ By default, when you create a new app with `npx degit sveltejs/template my-svelt
9999
In the file `package.json` you can see that the `build` and `dev` scripts are just calling rollup:
100100

101101
```json
102-
"scripts": {
103-
"build": "rollup -c",
104-
"dev": "rollup -c -w",
105-
"start": "sirv public"
106-
},
102+
{
103+
"scripts": {
104+
"build": "rollup -c",
105+
"dev": "rollup -c -w",
106+
"start": "sirv public"
107+
}
108+
}
107109
```
108110

109111
In the `dev` script we are passing the `-w` argument, which tells rollup to watch files and rebuild on changes.

files/en-us/learn_web_development/extensions/client-side_tools/deployment/index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,11 @@ Let's get started.
192192
2. In your package.json, find your `scripts` member, and update it so that it contains the following test and build commands:
193193

194194
```json
195-
"scripts": {
196-
// …
197-
"test": "vitest"
195+
{
196+
"scripts": {
197+
// …
198+
"test": "vitest"
199+
}
198200
}
199201
```
200202

files/en-us/learn_web_development/extensions/client-side_tools/introducing_complete_toolchain/index.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,12 @@ npx prettier --write ./index.html
195195
You can also replace `./index.html` with any other file or folder to format them. For example, `.` will format everything in the current directory. In case you may forget the syntax, you can add it as a custom script in your package.json too:
196196

197197
```json
198-
"scripts": {
199-
// …
200-
"format": "prettier --write ."
201-
},
198+
{
199+
"scripts": {
200+
// …
201+
"format": "prettier --write ."
202+
}
203+
}
202204
```
203205

204206
Now you can run the following to format the directory:

files/en-us/learn_web_development/extensions/client-side_tools/package_management/index.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,12 @@ We will add two more lines to package.json:
137137
Add these lines right below the `"name"`:
138138

139139
```json
140-
"name": "npm-experiment",
141-
"type": "module",
142-
"private": true,
140+
{
141+
"name": "npm-experiment",
142+
"type": "module",
143+
"private": true
144+
// …
145+
}
143146
```
144147

145148
So this is the config file that defines your package. This is good for now, so let's move on.
@@ -155,8 +158,10 @@ npm install --save-dev vite
155158
Once that's done _All The Things_, take another look at your package.json file. You'll see that npm has added a new field, `devDependencies`:
156159

157160
```json
158-
"devDependencies": {
159-
"vite": "^5.2.13"
161+
{
162+
"devDependencies": {
163+
"vite": "^5.2.13"
164+
}
160165
}
161166
```
162167

@@ -368,17 +373,21 @@ This would run a custom script for starting our project in "development mode". I
368373
If you tried running this in your test project from earlier it would (likely) claim the "dev script is missing". This is because npm, Yarn (and the like) are looking for a property called `dev` in the `scripts` property of your `package.json` file. So, let's create a custom shorthand command — "dev" — in our `package.json`. If you followed the tutorial from earlier, you should have a `package.json` file inside your npm-experiment directory. Open it up, and its `scripts` member should look like this:
369374

370375
```json
371-
"scripts": {
372-
"test": "echo \"Error: no test specified\" && exit 1",
373-
},
376+
{
377+
"scripts": {
378+
"test": "echo \"Error: no test specified\" && exit 1"
379+
}
380+
}
374381
```
375382

376383
Update it so that it looks like this, and save the file:
377384

378385
```json
379-
"scripts": {
380-
"dev": "vite"
381-
},
386+
{
387+
"scripts": {
388+
"dev": "vite"
389+
}
390+
}
382391
```
383392

384393
We've added a custom `dev` command as an npm script.
@@ -398,11 +407,13 @@ This particular one may look unnecessary — `npm run dev` is more characters to
398407
You can add all kinds of things to the `scripts` property that help you do your job. For example, here's what Vite recommends in the template:
399408

400409
```json
401-
"scripts": {
402-
"dev": "vite",
403-
"build": "vite build",
404-
"preview": "vite preview"
405-
},
410+
{
411+
"scripts": {
412+
"dev": "vite",
413+
"build": "vite build",
414+
"preview": "vite preview"
415+
}
416+
}
406417
```
407418

408419
## Summary

files/en-us/learn_web_development/extensions/server-side/express_nodejs/deployment/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,11 @@ v16.17.1
314314
Open **package.json**, and add this information as an **engines > node** as shown (using the version number for your system).
315315

316316
```json
317+
{
317318
"engines": {
318319
"node": ">=22.0.0"
319-
},
320+
}
321+
}
320322
```
321323

322324
The hosting service might not support the specific indicated version of node, but this change should ensure that it attempts to use a version with the same major version number, or a more recent version.

files/en-us/learn_web_development/extensions/server-side/express_nodejs/development_environment/index.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,10 @@ npm install eslint --save-dev
299299
The following entry would then be added to your application's **package.json**:
300300

301301
```json
302-
"devDependencies": {
303-
"eslint": "^9.30.1"
302+
{
303+
"devDependencies": {
304+
"eslint": "^9.30.1"
305+
}
304306
}
305307
```
306308

@@ -317,10 +319,12 @@ In addition to defining and fetching dependencies you can also define _named_ sc
317319
For example, to define a script to run the _eslint_ development dependency that we specified in the previous section we might add the following script block to our **package.json** file (assuming that our application source is in a folder `/src/js`):
318320

319321
```json
320-
"scripts": {
321-
// …
322-
"lint": "eslint src/js"
323-
// …
322+
{
323+
"scripts": {
324+
// …
325+
"lint": "eslint src/js"
326+
// …
327+
}
324328
}
325329
```
326330

files/en-us/learn_web_development/extensions/server-side/express_nodejs/skeleton_website/index.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ npm install -g nodemon
254254
If you open your project's **package.json** file you'll now see a new section with this dependency:
255255

256256
```json
257-
"devDependencies": {
257+
{
258+
"devDependencies": {
258259
"nodemon": "^3.1.10"
260+
}
259261
}
260262
```
261263

@@ -264,11 +266,13 @@ Because the tool isn't installed globally, we can't launch it from the command l
264266
- On Linux and macOS, the scripts section will look like this:
265267

266268
```json
269+
{
267270
"scripts": {
268271
"start": "node ./bin/www",
269272
"devstart": "nodemon ./bin/www",
270273
"serverstart": "DEBUG=express-locallibrary-tutorial:* npm run devstart"
271-
},
274+
}
275+
}
272276
```
273277

274278
- On Windows, the "serverstart" value would instead look like this (if using the command prompt):
@@ -357,11 +361,13 @@ We already modified this section in [Enable server restart on file changes](#ena
357361
These can be used to start the same **./bin/www** file with _nodemon_ rather than _node_ (this version of the scripts is for Linux and macOS, as discussed above).
358362

359363
```json
364+
{
360365
"scripts": {
361366
"start": "node ./bin/www",
362367
"devstart": "nodemon ./bin/www",
363368
"serverstart": "DEBUG=express-locallibrary-tutorial:* npm run devstart"
364-
},
369+
}
370+
}
365371
```
366372

367373
The dependencies include the _express_ package and the package for our selected view engine (_pug_).
@@ -376,14 +382,16 @@ The default versions in the generated project are a little out of date.
376382
Replace the dependencies section of your `package.json` file with the following text, which specifies the latest versions of these libraries at the time of writing:
377383

378384
```json
385+
{
379386
"dependencies": {
380387
"cookie-parser": "^1.4.7",
381388
"debug": "^4.4.1",
382389
"express": "^5.1.0",
383390
"http-errors": "~2.0.0",
384391
"morgan": "^1.10.0",
385392
"pug": "3.0.3"
386-
},
393+
}
394+
}
387395
```
388396

389397
Then update your installed dependencies using the command:

files/en-us/learn_web_development/extensions/testing/automated_testing/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ In the input version of the file, you may have noticed that we put an empty {{ht
257257
4. Add the following property to `package.json`:
258258

259259
```json
260-
"browserslist": [
261-
"last 5 versions"
262-
]
260+
{
261+
"browserslist": ["last 5 versions"]
262+
}
263263
```
264264

265265
5. Change the default task to:

files/en-us/mdn/writing_guidelines/howto/json_structured_data/index.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,30 @@ GroupData does exactly that: for each API, it lists the interfaces, properties,
2626
An entry in `GroupData.json` has the following structure:
2727

2828
```json
29-
"Name_of_the_API": {
30-
"overview": ["name_of_the_overview_page"],
31-
"guides": [
32-
"name_of_guide_1",
33-
(…)
34-
],
35-
"interfaces": [
36-
"name_of_interface_1",
37-
(…)
38-
],
39-
"methods": [
40-
"name_of_additional_method_1",
41-
(…)
42-
],
43-
"properties": [
44-
"name_of_additional_property_1",
45-
(…)
46-
],
47-
"events": [
48-
"name_of_additional_property_1",
49-
(…)
50-
]
29+
{
30+
"Name_of_the_API": {
31+
"overview": ["name_of_the_overview_page"],
32+
"guides": [
33+
"name_of_guide_1"
34+
// …
35+
],
36+
"interfaces": [
37+
"name_of_interface_1"
38+
// …
39+
],
40+
"methods": [
41+
"name_of_additional_method_1"
42+
// …
43+
],
44+
"properties": [
45+
"name_of_additional_property_1"
46+
// …
47+
],
48+
"events": [
49+
"name_of_additional_property_1"
50+
// …
51+
]
52+
}
5153
}
5254
```
5355

@@ -101,9 +103,11 @@ This inheritance data is used when building API sidebars and by the `\{{Inherita
101103
An entry in `InterfaceData.json` has the following structure:
102104

103105
```json
104-
"Name_of_the_interface": {
105-
"inh": "Name_of_the_parent_interface",
106-
"impl": []
106+
{
107+
"Name_of_the_interface": {
108+
"inh": "Name_of_the_parent_interface",
109+
"impl": []
110+
}
107111
}
108112
```
109113

files/en-us/mdn/writing_guidelines/howto/write_an_api_reference/sidebars/index.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,23 @@ For example, look at the [Fetch API](/en-US/docs/Web/API/Fetch_API) page on MDN.
3939
The corresponding entry in `GroupData.json` looks like this:
4040

4141
```json
42-
"Fetch API": {
43-
"overview": [ "Fetch API"],
44-
"interfaces": [ "Headers",
45-
"Request",
46-
"Response",
47-
"FetchController",
48-
"FetchObserver",
49-
"FetchSignal",
50-
"ObserverCallback" ],
51-
"methods": [ "fetch()" ],
42+
{
43+
"Fetch API": {
44+
"overview": ["Fetch API"],
45+
"interfaces": [
46+
"Headers",
47+
"Request",
48+
"Response",
49+
"FetchController",
50+
"FetchObserver",
51+
"FetchSignal",
52+
"ObserverCallback"
53+
],
54+
"methods": ["fetch()"],
5255
"properties": [],
53-
"events": []
54-
},
56+
"events": []
57+
}
58+
}
5559
```
5660

5761
As you can see, we've used "Fetch API" for the name, and inside the object value we include a number of sub-members.

0 commit comments

Comments
 (0)