Skip to content

Commit 46a3c35

Browse files
committed
lint: add lefthook, prettier, typos
Install from npm, because it's simpler, so use lefthook as the pre-commit runner (`yarn install` automatically installs the hooks, which is somewhat nice too). I removed the reference to the `grammarly` vscode extension, since it's no longer available in the marketplace and the github repo is archived.
1 parent fd8fe9b commit 46a3c35

File tree

8 files changed

+210
-17
lines changed

8 files changed

+210
-17
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# See https://bun.sh/docs/install/lockfile
2+
*.lockb binary diff=lockb

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@ _site/
88
/vendor
99
/example/*/build
1010
/.venv
11+
/node_modules
12+
13+
# Yarn 2
14+
.yarn/*
15+
!.yarn/releases
16+
!.yarn/plugins
17+
!.yarn/sdks
18+
!.yarn/versions
19+
.pnp.*

.prettierrc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
overrides:
2+
- files: "*.md"
3+
options:
4+
proseWrap: always

.vscode/settings.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
2-
"grammarly.files.include": [
3-
"**/readme.md",
4-
"**/README.md",
5-
"**/*.txt",
6-
"**/*.md"
7-
],
8-
"grammarly.config.documentDialect": "american",
9-
"grammarly.config.suggestions.OxfordComma": true
2+
"editor.formatOnSave": true,
3+
"[markdown]": {
4+
"editor.formatOnSave": true,
5+
"editor.defaultFormatter": "esbenp.prettier-vscode",
6+
}
107
}

lefthook.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Lefthook configuration:
2+
#
3+
# Refer for explanation to following link:
4+
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
5+
#
6+
7+
pre-commit:
8+
parallel: true
9+
commands:
10+
prettier:
11+
glob: "*.md"
12+
run: yarn prettier --write --prose-wrap=always {staged_files}
13+
typos:
14+
glob: "*.md"
15+
run: yarn typos {staged_files}

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"scripts": {
3+
"lint:prettier": "prettier --check _posts _drafts",
4+
"lint:typos": "typos _posts _drafts",
5+
"lint:prettier:fix": "prettier --write _posts _drafts"
6+
},
7+
"dependencies": {
8+
"lefthook": "^1.6.16",
9+
"prettier": "^3.3.2"
10+
},
11+
"devDependencies": {
12+
"typos-rs-npm": "dalisoft/typos-rs-npm"
13+
}
14+
}

readme.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ Interrupt is a community for embedded software makers and professionals alike.
1111

1212
Interrupt welcomes submissions on embedded software topics.
1313

14-
Prior to getting in touch, you should get yourself acquainted with our [Code of Conduct](https://interrupt.memfault.com/code-of-conduct).
14+
Prior to getting in touch, you should get yourself acquainted with our
15+
[Code of Conduct](https://interrupt.memfault.com/code-of-conduct).
1516

16-
To submit your content, either email us at [email protected], or open a pull request!
17+
To submit your content, either email us at [email protected], or open a
18+
pull request!
1719

18-
See [Contributing](https://interrupt.memfault.com/contributing) for more information.
20+
See [Contributing](https://interrupt.memfault.com/contributing) for more
21+
information.
1922

2023
## Running
2124

2225
### Docker (Recommended)
2326

24-
Follow the instructions in the [Install Docker Engine](https://docs.docker.com/engine/install/) according to your operating system.
27+
Follow the instructions in the
28+
[Install Docker Engine](https://docs.docker.com/engine/install/) according to
29+
your operating system.
2530

2631
Clone the repo, run in docker:
2732

@@ -36,9 +41,13 @@ You can now access the server at [http://0.0.0.0:4000](http://0.0.0.0:4000)
3641
### Locally
3742

3843
You'll need:
44+
3945
- Python 3.8 or later
4046
- Ruby 2.7.7
4147

48+
Optionally, to run the linters, you'll need `yarn` (easy way is via
49+
[`volta`](https://volta.sh/)).
50+
4251
#### Install Dependencies
4352

4453
Clone the repo and install Python dependencies:
@@ -55,9 +64,9 @@ $ pip install -r requirements.txt
5564

5665
The virtual environment can be deactivated with `deactivate`.
5766

58-
We highly recommend setting up a version manager for Ruby, such as
59-
`rbenv`. Follow the instructions [here](https://github.com/rbenv/rbenv) to set it
60-
up for your operating system and install the right version of Ruby.
67+
We highly recommend setting up a version manager for Ruby, such as `rbenv`.
68+
Follow the instructions [here](https://github.com/rbenv/rbenv) to set it up for
69+
your operating system and install the right version of Ruby.
6170

6271
Install Ruby dependencies:
6372

@@ -67,17 +76,26 @@ $ ruby -v
6776
$ bundle install
6877
```
6978

79+
Optionally, install `yarn` dependencies (this also installs the git hooks):
80+
81+
```bash
82+
$ yarn install
83+
```
84+
7085
#### Launch
7186

72-
Serve with the following command, which will also open up the site in your browser:
87+
Serve with the following command, which will also open up the site in your
88+
browser:
7389

7490
```bash
7591
$ bundle exec jekyll serve --drafts --livereload --open-url
7692
```
7793

7894
## Acknowledgements
7995

80-
Interrupt is based on the Emerald theme by [Jacopo Rabolini](https://www.jacoporabolini.com/). Emerald is available on [Github](https://github.com/KingFelix/emerald).
96+
Interrupt is based on the Emerald theme by
97+
[Jacopo Rabolini](https://www.jacoporabolini.com/). Emerald is available on
98+
[Github](https://github.com/KingFelix/emerald).
8199

82100
---
83101

yarn.lock

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# This file is generated by running "yarn install" inside your project.
2+
# Manual changes might be lost - proceed with caution!
3+
4+
__metadata:
5+
version: 8
6+
cacheKey: 10c0
7+
8+
"binary2npm@https://github.com/dalisoft/binary2npm#v0.3.8":
9+
version: 0.3.7
10+
resolution: "binary2npm@git+ssh://[email protected]/dalisoft/binary2npm.git#commit=76b8dd261f75c0b672ccd29ed2b018f43fed0ddb"
11+
checksum: 10c0/981594c3b1e846cee268f8cf8503200425a7cb6674fb678aa20c958fb43bfe3b8db30d7254c852527645da7e102c1cd1e5e0715eb341d3bdb5099820f36012b5
12+
languageName: node
13+
linkType: hard
14+
15+
"lefthook-darwin-arm64@npm:1.6.16":
16+
version: 1.6.16
17+
resolution: "lefthook-darwin-arm64@npm:1.6.16"
18+
conditions: os=darwin & cpu=arm64
19+
languageName: node
20+
linkType: hard
21+
22+
"lefthook-darwin-x64@npm:1.6.16":
23+
version: 1.6.16
24+
resolution: "lefthook-darwin-x64@npm:1.6.16"
25+
conditions: os=darwin & cpu=x64
26+
languageName: node
27+
linkType: hard
28+
29+
"lefthook-freebsd-arm64@npm:1.6.16":
30+
version: 1.6.16
31+
resolution: "lefthook-freebsd-arm64@npm:1.6.16"
32+
conditions: os=freebsd & cpu=arm64
33+
languageName: node
34+
linkType: hard
35+
36+
"lefthook-freebsd-x64@npm:1.6.16":
37+
version: 1.6.16
38+
resolution: "lefthook-freebsd-x64@npm:1.6.16"
39+
conditions: os=freebsd & cpu=x64
40+
languageName: node
41+
linkType: hard
42+
43+
"lefthook-linux-arm64@npm:1.6.16":
44+
version: 1.6.16
45+
resolution: "lefthook-linux-arm64@npm:1.6.16"
46+
conditions: os=linux & cpu=arm64
47+
languageName: node
48+
linkType: hard
49+
50+
"lefthook-linux-x64@npm:1.6.16":
51+
version: 1.6.16
52+
resolution: "lefthook-linux-x64@npm:1.6.16"
53+
conditions: os=linux & cpu=x64
54+
languageName: node
55+
linkType: hard
56+
57+
"lefthook-windows-arm64@npm:1.6.16":
58+
version: 1.6.16
59+
resolution: "lefthook-windows-arm64@npm:1.6.16"
60+
conditions: os=win32 & cpu=arm64
61+
languageName: node
62+
linkType: hard
63+
64+
"lefthook-windows-x64@npm:1.6.16":
65+
version: 1.6.16
66+
resolution: "lefthook-windows-x64@npm:1.6.16"
67+
conditions: os=win32 & cpu=x64
68+
languageName: node
69+
linkType: hard
70+
71+
"lefthook@npm:^1.6.16":
72+
version: 1.6.16
73+
resolution: "lefthook@npm:1.6.16"
74+
dependencies:
75+
lefthook-darwin-arm64: "npm:1.6.16"
76+
lefthook-darwin-x64: "npm:1.6.16"
77+
lefthook-freebsd-arm64: "npm:1.6.16"
78+
lefthook-freebsd-x64: "npm:1.6.16"
79+
lefthook-linux-arm64: "npm:1.6.16"
80+
lefthook-linux-x64: "npm:1.6.16"
81+
lefthook-windows-arm64: "npm:1.6.16"
82+
lefthook-windows-x64: "npm:1.6.16"
83+
dependenciesMeta:
84+
lefthook-darwin-arm64:
85+
optional: true
86+
lefthook-darwin-x64:
87+
optional: true
88+
lefthook-freebsd-arm64:
89+
optional: true
90+
lefthook-freebsd-x64:
91+
optional: true
92+
lefthook-linux-arm64:
93+
optional: true
94+
lefthook-linux-x64:
95+
optional: true
96+
lefthook-windows-arm64:
97+
optional: true
98+
lefthook-windows-x64:
99+
optional: true
100+
bin:
101+
lefthook: bin/index.js
102+
checksum: 10c0/1199bff516aafd31edac387abe9978b12278aec90903764dfc54fee4487cbe2f46481bd7095ecf5554a1c8fd103686ce74797c7e3777b38a7e0776122f586df3
103+
languageName: node
104+
linkType: hard
105+
106+
"prettier@npm:^3.3.2":
107+
version: 3.3.2
108+
resolution: "prettier@npm:3.3.2"
109+
bin:
110+
prettier: bin/prettier.cjs
111+
checksum: 10c0/39ed27d17f0238da6dd6571d63026566bd790d3d0edac57c285fbab525982060c8f1e01955fe38134ab10f0951a6076da37f015db8173c02f14bc7f0803a384c
112+
languageName: node
113+
linkType: hard
114+
115+
"root-workspace-0b6124@workspace:.":
116+
version: 0.0.0-use.local
117+
resolution: "root-workspace-0b6124@workspace:."
118+
dependencies:
119+
lefthook: "npm:^1.6.16"
120+
prettier: "npm:^3.3.2"
121+
typos-rs-npm: dalisoft/typos-rs-npm
122+
languageName: unknown
123+
linkType: soft
124+
125+
typos-rs-npm@dalisoft/typos-rs-npm:
126+
version: 1.22.7
127+
resolution: "typos-rs-npm@git+ssh://[email protected]/dalisoft/typos-rs-npm.git#commit=98179e72aba777535d5d44745077885db9d00d90"
128+
dependencies:
129+
binary2npm: "https://github.com/dalisoft/binary2npm#v0.3.8"
130+
bin:
131+
typos: ./typos
132+
checksum: 10c0/37f34d6cf57f0f329b194fa7ee5f05ee6391acc065413d2bb3a44f2fcfd4d3edcb26427c58ff9f75503cea3ed6b95745e95cb3fe703b6d27e14ee0bbe6237d8b
133+
languageName: node
134+
linkType: hard

0 commit comments

Comments
 (0)