Skip to content

Commit 26c331b

Browse files
authored
yarn format - prettier improvements & add .editorconfig (#1471)
Some dev improvements: * Add .editorconfig config file https://editorconfig.org/ * move the singleQuote spec into .editorconfig and add old .changesets/*.md to .prettierignore so that we don't incorrectly reformat new changeset files to single quote from the double quote which they can be autogenerated with in github * .gitignore Ignore emacs chaff files * Add `yarn format:head` a convenience command to run prettier against just those files in the head commit * Some mention of `yarn format` in the docs * Fix some test html closing tags; authoring mistakes, rather than deliberately malformed html — picked up by an explicit `yarn prettier --write '**/*.html'`
1 parent e96f668 commit 26c331b

File tree

11 files changed

+155
-22
lines changed

11 files changed

+155
-22
lines changed

.changeset/format-head-prettier.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
# initialized from https://prettier.io/docs/en/configuration.html#editorconfig
4+
[*]
5+
charset = utf-8
6+
insert_final_newline = true
7+
end_of_line = lf
8+
indent_style = space
9+
indent_size = 2
10+
max_line_length = 80
11+
quote_type = single
12+
13+
[.changeset/*.md]
14+
quote_type = double

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ dist
1818

1919
.turbo
2020

21+
# emacs working files end in a tilde
22+
*~
23+
2124
# `.yarn/install-state.gz` is an optimization file that you shouldn't ever have to commit.
2225
# It simply stores the exact state of your project so that the next commands can boot without having to resolve your workspaces all over again.
2326
.yarn/install-state.gz

.prettierignore

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# list of old changeset files that were mutated to use single quotes by a previous version of prettier:
2+
.changeset/attribute-text-reductions.md
3+
.changeset/avoid-costly-createlement.md
4+
.changeset/brave-numbers-joke.md
5+
.changeset/breezy-cats-heal.md
6+
.changeset/breezy-mice-breathe.md
7+
.changeset/calm-bulldogs-speak.md
8+
.changeset/calm-oranges-sin.md
9+
.changeset/chatty-cherries-train.md
10+
.changeset/clean-plants-play.md
11+
.changeset/clean-shrimps-lay.md
12+
.changeset/cold-eyes-hunt.md
13+
.changeset/cold-hounds-teach.md
14+
.changeset/controller-finish-flag.md
15+
.changeset/cool-grapes-hug.md
16+
.changeset/cuddly-readers-warn.md
17+
.changeset/curvy-apples-lay.md
18+
.changeset/curvy-balloons-brake.md
19+
.changeset/date-now-guard.md
20+
.changeset/dirty-rules-dress.md
21+
.changeset/eight-terms-hunt.md
22+
.changeset/empty-bikes-cheer.md
23+
.changeset/event-single-wrap.md
24+
.changeset/fair-dragons-greet.md
25+
.changeset/fast-chefs-smell.md
26+
.changeset/few-rockets-travel.md
27+
.changeset/few-turkeys-reflect.md
28+
.changeset/five-peas-lay.md
29+
.changeset/fluffy-planes-retire.md
30+
.changeset/forty-elephants-attack.md
31+
.changeset/fresh-cars-impress.md
32+
.changeset/fresh-spoons-drive.md
33+
.changeset/friendly-numbers-leave.md
34+
.changeset/gold-apples-joke.md
35+
.changeset/gold-terms-look.md
36+
.changeset/grumpy-ways-own.md
37+
.changeset/hip-worms-relax.md
38+
.changeset/hungry-dodos-taste.md
39+
.changeset/itchy-dryers-double.md
40+
.changeset/khaki-dots-bathe.md
41+
.changeset/large-ants-prove.md
42+
.changeset/lazy-squids-draw.md
43+
.changeset/lazy-toes-confess.md
44+
.changeset/lemon-lamps-switch.md
45+
.changeset/light-fireants-exercise.md
46+
.changeset/little-radios-thank.md
47+
.changeset/little-suits-leave.md
48+
.changeset/loud-seals-raise.md
49+
.changeset/lovely-pears-cross.md
50+
.changeset/lovely-students-boil.md
51+
.changeset/mean-tips-impress.md
52+
.changeset/mighty-ads-worry.md
53+
.changeset/mighty-bulldogs-begin.md
54+
.changeset/mighty-frogs-sparkle.md
55+
.changeset/modern-doors-watch.md
56+
.changeset/moody-dots-refuse.md
57+
.changeset/nervous-buses-pump.md
58+
.changeset/nervous-kiwis-nail.md
59+
.changeset/nervous-mirrors-perform.md
60+
.changeset/nervous-poets-grin.md
61+
.changeset/nervous-tables-travel.md
62+
.changeset/new-snakes-call.md
63+
.changeset/nice-pugs-reply.md
64+
.changeset/old-dryers-hide.md
65+
.changeset/polite-olives-wave.md
66+
.changeset/pretty-plums-rescue.md
67+
.changeset/pretty-schools-remember.md
68+
.changeset/proud-experts-jam.md
69+
.changeset/rare-adults-sneeze.md
70+
.changeset/README.md
71+
.changeset/real-masks-explode.md
72+
.changeset/real-trains-switch.md
73+
.changeset/rich-crews-protect.md
74+
.changeset/rich-dots-lay.md
75+
.changeset/rich-jars-remember.md
76+
.changeset/rotten-spies-enjoy.md
77+
.changeset/serious-ants-juggle.md
78+
.changeset/silver-pots-sit.md
79+
.changeset/silver-windows-float.md
80+
.changeset/sixty-impalas-laugh.md
81+
.changeset/small-olives-arrive.md
82+
.changeset/smart-ears-refuse.md
83+
.changeset/smart-geckos-cover.md
84+
.changeset/smooth-papayas-boil.md
85+
.changeset/smooth-poems-bake.md
86+
.changeset/spotty-bees-destroy.md
87+
.changeset/stupid-ghosts-help.md
88+
.changeset/swift-dancers-rest.md
89+
.changeset/swift-peas-film.md
90+
.changeset/thin-vans-applaud.md
91+
.changeset/thirty-baboons-punch.md
92+
.changeset/three-baboons-bow.md
93+
.changeset/tidy-swans-repair.md
94+
.changeset/tidy-yaks-joke.md
95+
.changeset/tiny-buckets-love.md
96+
.changeset/tiny-candles-whisper.md
97+
.changeset/tiny-chairs-build.md
98+
.changeset/tricky-panthers-guess.md
99+
.changeset/twenty-goats-kneel.md
100+
.changeset/twenty-lies-switch.md
101+
.changeset/twenty-planets-repeat.md
102+
.changeset/violet-melons-itch.md
103+
.changeset/violet-zebras-cry.md
104+
.changeset/wise-spiders-jog.md
105+
.changeset/witty-kids-talk.md
106+
.changeset/yellow-mails-cheat.md
107+
.changeset/young-timers-grow.md

.prettierrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"singleQuote": true,
32
"trailingComma": "all"
43
}

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ clear and has sufficient instructions to be able to reproduce the issue.
3131
- Run a cobrowsing/mirroring session locally: `yarn live-stream`
3232
- Test: `yarn test` or `yarn test:watch`
3333
- Lint: `yarn lint`
34+
- Rewrite files with prettier: `yarn format` or `yarn format:head`
3435

3536
## Coding style
3637

docs/development/coding-style.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Coding Style
22

3-
These are the style guidelines for coding in Electron.
3+
These have been adapted from the style guidelines for coding in Electron.
44

55
You can run `yarn lint` to show any style issues detected by `eslint`.
66

@@ -9,6 +9,8 @@ You can run `yarn lint` to show any style issues detected by `eslint`.
99
- End files with a newline.
1010
- Using a plain `return` when returning explicitly at the end of a function.
1111
- Not `return null`, `return undefined`, `null` or `undefined`
12+
- run `yarn format` to rewrite all files in the standard format
13+
- run `yarn format:head` to rewrite files from your last commit
1214

1315
## Documentation
1416

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"test:watch": "yarn turbo run test:watch",
4242
"test:update": "yarn turbo run test:update",
4343
"format": "yarn prettier --write '**/*.{ts,md}'",
44+
"format:head": "git diff --name-only HEAD^ |grep '\\.ts$\\|\\.md$' |xargs yarn prettier --write",
4445
"dev": "yarn turbo run dev",
4546
"repl": "cd packages/rrweb && npm run repl",
4647
"live-stream": "cd packages/rrweb && yarn live-stream",

packages/rrweb/test/__snapshots__/integration.test.ts.snap

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,29 +1716,34 @@ exports[`record integration tests can record clicks 1`] = `
17161716
\\"childNodes\\": [
17171717
{
17181718
\\"type\\": 3,
1719-
\\"textContent\\": \\"link\\\\n \\\\n \\",
1719+
\\"textContent\\": \\"link\\",
17201720
\\"id\\": 22
1721-
},
1722-
{
1723-
\\"type\\": 2,
1724-
\\"tagName\\": \\"script\\",
1725-
\\"attributes\\": {},
1726-
\\"childNodes\\": [
1727-
{
1728-
\\"type\\": 3,
1729-
\\"textContent\\": \\"SCRIPT_PLACEHOLDER\\",
1730-
\\"id\\": 24
1731-
}
1732-
],
1733-
\\"id\\": 23
1734-
},
1721+
}
1722+
],
1723+
\\"id\\": 21
1724+
},
1725+
{
1726+
\\"type\\": 3,
1727+
\\"textContent\\": \\"\\\\n \\\\n \\",
1728+
\\"id\\": 23
1729+
},
1730+
{
1731+
\\"type\\": 2,
1732+
\\"tagName\\": \\"script\\",
1733+
\\"attributes\\": {},
1734+
\\"childNodes\\": [
17351735
{
17361736
\\"type\\": 3,
1737-
\\"textContent\\": \\"\\\\n \\\\n \\\\n\\\\n\\",
1737+
\\"textContent\\": \\"SCRIPT_PLACEHOLDER\\",
17381738
\\"id\\": 25
17391739
}
17401740
],
1741-
\\"id\\": 21
1741+
\\"id\\": 24
1742+
},
1743+
{
1744+
\\"type\\": 3,
1745+
\\"textContent\\": \\"\\\\n \\\\n \\\\n\\\\n\\",
1746+
\\"id\\": 26
17421747
}
17431748
],
17441749
\\"id\\": 16
@@ -15688,7 +15693,7 @@ exports[`record integration tests should record shadow DOM 1`] = `
1568815693
},
1568915694
{
1569015695
\\"type\\": 3,
15691-
\\"textContent\\": \\"\\\\n \\\\n \\\\n \\",
15696+
\\"textContent\\": \\"\\\\n \\\\n \\",
1569215697
\\"id\\": 39
1569315698
},
1569415699
{

packages/rrweb/test/html/link.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
<body>
1111
<span id="not-a-link">not link</span>
12-
<a href="about:blank#clicked">link</span>
12+
<a href="about:blank#clicked">link</a>
1313
</body>
1414
</html>

0 commit comments

Comments
 (0)