Skip to content

Commit b3390e0

Browse files
committed
ci(ext): Check extension formats in Actions
Using typescript-formatter for JavaScript and js-beautify for HTML. This should be quite close to my vtsls + vscode-html-languageservice (which uses js-beautify [1]) Neovim setup, as well as VSCode out of the box. [1] https://code.visualstudio.com/docs/languages/html#_formatting
1 parent 89f31ba commit b3390e0

File tree

6 files changed

+40
-2
lines changed

6 files changed

+40
-2
lines changed

.github/workflows/ci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ jobs:
3131
path: |
3232
external-editor-revived.xpi
3333
34+
format_extension:
35+
name: Format MailExtension
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-node@v4
40+
- name: Format
41+
shell: bash
42+
run: |
43+
pushd ./extension
44+
yarn install
45+
find . -type f -name '*.js' ! -path './node_modules/*' -exec yarn run tsfmt -r '{}' \+
46+
find . -type f -name '*.html' ! -path './node_modules/*' -exec yarn run js-beautify --replace '{}' \+
47+
find . -type f -name '*.html' ! -path './node_modules/*' -exec sh -c "printf '\n' | tee -a '{}'" \;
48+
git diff --exit-code
49+
3450
messaging_host:
3551
name: Build, lint, and test messaging host
3652
runs-on: ${{ matrix.os }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/target
22
/*.xpi
3+
/extension/node_modules
4+
/extension/yarn.lock

extension/.jsbeautifyrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"indent_size": 2,
3+
"end_with_newline": false,
4+
"wrap_line_length": 120,
5+
"extra_liners": [],
6+
"preserve_newlines": true,
7+
"max_preserve_newlines": 32786,
8+
"eol": "\n",
9+
"indent_inner_html": false
10+
}

extension/options/options.html

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
#temp-dir {
6363
width: 100%;
6464
}
65-
6665
</style>
6766
</head>
6867

extension/package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
"main": "background.js",
66
"author": "Frederick Zhang",
77
"license": "GPL-3.0-or-later",
8-
"private": false
8+
"private": false,
9+
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
10+
"devDependencies": {
11+
"js-beautify": "^1.15.3",
12+
"typescript": "^5.7.3",
13+
"typescript-formatter": "^7.2.2"
14+
}
915
}

extension/tsfmt.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"indentSize": 2,
3+
"newLineCharacter": "\n",
4+
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false
5+
}

0 commit comments

Comments
 (0)