Skip to content

Commit d137db1

Browse files
Format using prettier (#1917)
Format using prettier
1 parent 87cd20f commit d137db1

File tree

62 files changed

+3061
-2802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3061
-2802
lines changed

.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-after.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"uuid": "0f998f19-69ee-4c64-80ef-01b086feab80",
7070
"description": "Imaginary part of a number with real and imaginary part",
7171
"property": "imaginary",
72-
"input": {
72+
"input": {
7373
"z": [1, 2]
7474
},
7575
"expected": 2
@@ -331,7 +331,7 @@
331331
"uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60",
332332
"description": "Euler's identity/formula",
333333
"property": "exp",
334-
"input": {
334+
"input": {
335335
"z": [0, "pi"]
336336
},
337337
"expected": [-1, 0]

.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-before.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"uuid": "0f998f19-69ee-4c64-80ef-01b086feab80",
7070
"description": "Imaginary part of a number with real and imaginary part",
7171
"property": "imaginary",
72-
"input": {
72+
"input": {
7373
"z": [1, 2]
7474
},
7575
"expected": 2
@@ -331,7 +331,7 @@
331331
"uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60",
332332
"description": "Euler's identity/formula",
333333
"property": "exp",
334-
"input": {
334+
"input": {
335335
"z": [0, "pi"]
336336
},
337337
"expected": [-1, 0]

.github/workflow-tests/immutability-check/canonical-data-deleted-case.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"uuid": "0f998f19-69ee-4c64-80ef-01b086feab80",
6060
"description": "Imaginary part of a number with real and imaginary part",
6161
"property": "imaginary",
62-
"input": {
62+
"input": {
6363
"z": [1, 2]
6464
},
6565
"expected": 2
@@ -321,7 +321,7 @@
321321
"uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60",
322322
"description": "Euler's identity/formula",
323323
"property": "exp",
324-
"input": {
324+
"input": {
325325
"z": [0, "pi"]
326326
},
327327
"expected": [-1, 0]

.github/workflow-tests/immutability-check/canonical-data-mutated-and-deleted.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"uuid": "0f998f19-69ee-4c64-80ef-01b086feab80",
6969
"description": "Imaginary part of a number with real and imaginary part",
7070
"property": "imaginary",
71-
"input": {
71+
"input": {
7272
"z": [1, 2]
7373
},
7474
"expected": 2
@@ -320,7 +320,7 @@
320320
"uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60",
321321
"description": "Euler's identity/formula",
322322
"property": "exp",
323-
"input": {
323+
"input": {
324324
"z": [0, "pi"]
325325
},
326326
"expected": [-1, 0]

.github/workflow-tests/immutability-check/canonical-data-mutated.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"uuid": "0f998f19-69ee-4c64-80ef-01b086feab80",
6969
"description": "Imaginary part of a number with real and imaginary part",
7070
"property": "imaginary",
71-
"input": {
71+
"input": {
7272
"z": [1, 2]
7373
},
7474
"expected": 2
@@ -330,7 +330,7 @@
330330
"uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60",
331331
"description": "Euler's identity/formula",
332332
"property": "exp",
333-
"input": {
333+
"input": {
334334
"z": [0, "pi"]
335335
},
336336
"expected": [-1, 0]

.github/workflow-tests/immutability-check/canonical-data-new-test.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"uuid": "0f998f19-69ee-4c64-80ef-01b086feab80",
7878
"description": "Imaginary part of a number with real and imaginary part",
7979
"property": "imaginary",
80-
"input": {
80+
"input": {
8181
"z": [1, 2]
8282
},
8383
"expected": 2
@@ -339,7 +339,7 @@
339339
"uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60",
340340
"description": "Euler's identity/formula",
341341
"property": "exp",
342-
"input": {
342+
"input": {
343343
"z": [0, "pi"]
344344
},
345345
"expected": [-1, 0]

.github/workflow-tests/immutability-check/canonical-data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"uuid": "0f998f19-69ee-4c64-80ef-01b086feab80",
6969
"description": "Imaginary part of a number with real and imaginary part",
7070
"property": "imaginary",
71-
"input": {
71+
"input": {
7272
"z": [1, 2]
7373
},
7474
"expected": 2
@@ -330,7 +330,7 @@
330330
"uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60",
331331
"description": "Euler's identity/formula",
332332
"property": "exp",
333-
"input": {
333+
"input": {
334334
"z": [0, "pi"]
335335
},
336336
"expected": [-1, 0]

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,28 @@ jobs:
126126
with:
127127
globs: |
128128
**/*.md
129+
130+
json-lint:
131+
name: Lint json files
132+
runs-on: ubuntu-latest
133+
steps:
134+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
135+
136+
- name: Get yarn cache directory path
137+
id: yarn-cache-dir-path
138+
run: echo "::set-output name=dir::$(yarn cache dir)"
139+
140+
- name: Cache yarn
141+
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
142+
id: yarn-cache
143+
with:
144+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
145+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
146+
restore-keys: |
147+
${{ runner.os }}-yarn-
148+
149+
- name: Install dependencies
150+
run: yarn install
151+
152+
- name: Verify that json files are formatted correctly
153+
run: yarn test-json-formatting

.prettierignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
exercises/allergies/canonical-data.json
2+
exercises/book-store/canonical-data.json
3+
exercises/bowling/canonical-data.json
4+
exercises/change/canonical-data.json
5+
exercises/connect/canonical-data.json
6+
exercises/diamond/canonical-data.json
7+
exercises/dominoes/canonical-data.json
8+
exercises/flatten-array/canonical-data.json
9+
exercises/forth/canonical-data.json
10+
exercises/go-counting/canonical-data.json
11+
exercises/grep/canonical-data.json
12+
exercises/house/canonical-data.json
13+
exercises/kindergarten-garden/canonical-data.json
14+
exercises/knapsack/canonical-data.json
15+
exercises/markdown/canonical-data.json
16+
exercises/minesweeper/canonical-data.json
17+
exercises/ocr-numbers/canonical-data.json
18+
exercises/pascals-triangle/canonical-data.json
19+
exercises/poker/canonical-data.json
20+
exercises/pov/canonical-data.json
21+
exercises/pythagorean-triplet/canonical-data.json
22+
exercises/rectangles/canonical-data.json
23+
exercises/reverse-string/canonical-data.json
24+
exercises/roman-numerals/canonical-data.json
25+
exercises/rotational-cipher/canonical-data.json
26+
exercises/saddle-points/canonical-data.json
27+
exercises/scale-generator/canonical-data.json
28+
exercises/sieve/canonical-data.json
29+
exercises/spiral-matrix/canonical-data.json
30+
exercises/tournament/canonical-data.json
31+
exercises/transpose/canonical-data.json
32+
exercises/variable-length-quantity/canonical-data.json
33+
exercises/word-search/canonical-data.json

CONTRIBUTING.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ This guide covers several common scenarios pertaining to **improving the languag
2222
* [Track Anatomy](#track-anatomy)
2323
* [Starting a New Track](#starting-a-new-track)
2424
* [Beta-Testing a Language Track](#beta-testing-a-language-track)
25-
* [Useful Tidbits](#useful-tidbits)
25+
* [Useful Tidbits](#useful-tidbits)
2626
* [Pull Request Guidelines](#pull-request-guidelines)
2727
* [Anatomy of an Exercise](#anatomy-of-an-exercise)
2828
* [Track configuration file (config.json)](#track-configuration-file)
2929
* [Track-Level Linting With Configlet](#track-level-linting-with-configlet)
3030
* [Git Basics](#git-basics)
3131
* [Improving Consistency By Extracting Shared Test Data](#improving-consistency-by-extracting-shared-test-data)
32+
* [Formatting](#formatting)
3233

3334
## We Will Gladly Help You Help Us
3435

@@ -301,6 +302,18 @@ TODO: add more sections:
301302

302303
We are maintaining this section, since many open issues link to it.
303304

305+
## Formatting
306+
307+
This repository uses [prettier][prettier] to automatically format its JSON files.
308+
If you've added or modified a JSON file, you can format it using:
309+
310+
```shell
311+
yarn install
312+
yarn format-json
313+
```
314+
315+
Note: if you use VS Code as your editor, you can install the [prettier plugin][prettier-vs-code] to automatically handle formatting for you.
316+
304317
[contributing]: https://exercism.org/contributing
305318
[support-chat]: https://gitter.im/exercism/support
306319
[exercism-issues]: https://github.com/exercism/exercism/issues
@@ -322,3 +335,5 @@ We are maintaining this section, since many open issues link to it.
322335
[git-basics]: https://github.com/exercism/legacy-docs/blob/main/contributing/git-basics.md
323336
[improve-exercise-metadata]: https://github.com/exercism/legacy-docs/blob/main/you-can-help/improve-exercise-metadata.md
324337
[legacy-docs]: https://github.com/exercism/legacy-docs
338+
[prettier]: https://prettier.io/
339+
[prettier-vs-code]: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode

0 commit comments

Comments
 (0)