Skip to content

Commit 0f61d7e

Browse files
chore: enable formatting over the entire codebase in CI (louislam#6655)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 6658f2c commit 0f61d7e

File tree

422 files changed

+30910
-27390
lines changed

Some content is hidden

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

422 files changed

+30910
-27390
lines changed

.eslintrc.js

Lines changed: 54 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
module.exports = {
2-
ignorePatterns: [
3-
"test/*.js",
4-
"server/modules/*",
5-
"src/util.js"
6-
],
2+
ignorePatterns: ["test/*.js", "server/modules/*", "src/util.js"],
73
root: true,
84
env: {
95
browser: true,
@@ -23,94 +19,93 @@ module.exports = {
2319
sourceType: "module",
2420
requireConfigFile: false,
2521
},
26-
plugins: [
27-
"jsdoc",
28-
"@typescript-eslint",
29-
],
22+
plugins: ["jsdoc", "@typescript-eslint"],
3023
rules: {
31-
"yoda": "error",
32-
eqeqeq: [ "warn", "smart" ],
33-
"camelcase": [ "warn", {
34-
"properties": "never",
35-
"ignoreImports": true
36-
}],
37-
"no-unused-vars": [ "warn", {
38-
"args": "none"
39-
}],
24+
yoda: "error",
25+
eqeqeq: ["warn", "smart"],
26+
camelcase: [
27+
"warn",
28+
{
29+
properties: "never",
30+
ignoreImports: true,
31+
},
32+
],
33+
"no-unused-vars": [
34+
"warn",
35+
{
36+
args: "none",
37+
},
38+
],
4039
"vue/max-attributes-per-line": "off",
4140
"vue/singleline-html-element-content-newline": "off",
4241
"vue/html-self-closing": "off",
43-
"vue/require-component-is": "off", // not allow is="style" https://github.com/vuejs/eslint-plugin-vue/issues/462#issuecomment-430234675
44-
"vue/attribute-hyphenation": "off", // This change noNL to "no-n-l" unexpectedly
42+
"vue/require-component-is": "off", // not allow is="style" https://github.com/vuejs/eslint-plugin-vue/issues/462#issuecomment-430234675
43+
"vue/attribute-hyphenation": "off", // This change noNL to "no-n-l" unexpectedly
4544
"vue/multi-word-component-names": "off",
46-
"curly": "error",
45+
curly: "error",
4746
"no-var": "error",
4847
"no-throw-literal": "error",
49-
"no-constant-condition": [ "error", {
50-
"checkLoops": false,
51-
}],
48+
"no-constant-condition": [
49+
"error",
50+
{
51+
checkLoops: false,
52+
},
53+
],
5254
//"no-console": "warn",
5355
"no-extra-boolean-cast": "off",
5456
"no-unneeded-ternary": "error",
5557
//"prefer-template": "error",
56-
"no-empty": [ "error", {
57-
"allowEmptyCatch": true
58-
}],
58+
"no-empty": [
59+
"error",
60+
{
61+
allowEmptyCatch: true,
62+
},
63+
],
5964
"no-control-regex": "off",
60-
"one-var": [ "error", "never" ],
61-
"max-statements-per-line": [ "error", { "max": 1 }],
65+
"one-var": ["error", "never"],
66+
"max-statements-per-line": ["error", { max: 1 }],
6267
"jsdoc/check-tag-names": [
6368
"error",
6469
{
65-
"definedTags": [ "link" ]
66-
}
70+
definedTags: ["link"],
71+
},
6772
],
6873
"jsdoc/no-undefined-types": "off",
69-
"jsdoc/no-defaults": [
70-
"error",
71-
{ "noOptionalParamNames": true }
72-
],
74+
"jsdoc/no-defaults": ["error", { noOptionalParamNames: true }],
7375
"jsdoc/require-throws": "warn",
7476
"jsdoc/require-jsdoc": [
7577
"error",
7678
{
77-
"require": {
78-
"FunctionDeclaration": true,
79-
"MethodDefinition": true,
80-
}
81-
}
79+
require: {
80+
FunctionDeclaration: true,
81+
MethodDefinition: true,
82+
},
83+
},
8284
],
8385
"jsdoc/no-blank-block-descriptions": "error",
8486
"jsdoc/require-returns-description": "warn",
85-
"jsdoc/require-returns-check": [
86-
"error",
87-
{ "reportMissingReturnForUndefinedTypes": false }
88-
],
87+
"jsdoc/require-returns-check": ["error", { reportMissingReturnForUndefinedTypes: false }],
8988
"jsdoc/require-returns": [
9089
"warn",
9190
{
92-
"forceRequireReturn": true,
93-
"forceReturnsWithAsync": true
94-
}
91+
forceRequireReturn: true,
92+
forceReturnsWithAsync: true,
93+
},
9594
],
9695
"jsdoc/require-param-type": "warn",
97-
"jsdoc/require-param-description": "warn"
96+
"jsdoc/require-param-description": "warn",
9897
},
99-
"overrides": [
98+
overrides: [
10099
// Override for TypeScript
101100
{
102-
"files": [
103-
"**/*.ts",
104-
],
105-
extends: [
106-
"plugin:@typescript-eslint/recommended",
107-
],
108-
"rules": {
101+
files: ["**/*.ts"],
102+
extends: ["plugin:@typescript-eslint/recommended"],
103+
rules: {
109104
"jsdoc/require-returns-type": "off",
110105
"jsdoc/require-param-type": "off",
111106
"@typescript-eslint/no-explicit-any": "off",
112107
"prefer-const": "off",
113-
}
114-
}
115-
]
108+
},
109+
},
110+
],
116111
};

.github/workflows/autofix.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ jobs:
3838
run: npm run lint-fix:style
3939
continue-on-error: true
4040

41-
# TODO: disabled until we have agreed that this is the formatting that we want to enforce
42-
# - name: Auto-format code with Prettier
43-
# run: npm run fmt
44-
# continue-on-error: true
41+
- name: Auto-format code with Prettier
42+
run: npm run fmt
43+
continue-on-error: true
4544

4645
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27

.prettierignore

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,2 @@
1-
# Dependencies
2-
node_modules/
3-
4-
# Build output
5-
dist/
6-
build/
7-
8-
# Data directories
9-
data/
10-
11-
# Test output
12-
test-results/
13-
playwright-report/
14-
private/
15-
16-
# Logs
17-
*.log
18-
npm-debug.log*
19-
20-
# OS files
21-
.DS_Store
22-
Thumbs.db
23-
24-
# IDE
25-
.vscode/
26-
.idea/
27-
28-
# Lock files
29-
package-lock.json
30-
pnpm-lock.yaml
31-
yarn.lock
32-
33-
# Generated files
34-
*.min.js
35-
*.min.css
36-
37-
# Docker
38-
docker/
1+
# language files
2+
src/lang/*.json

CONTRIBUTING.md

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ to review the appropriate one for your contribution.
5454
[**PLEASE SEE OUR SECURITY POLICY.**](SECURITY.md)
5555

5656
[advisory]: https://github.com/louislam/uptime-kuma/security/advisories/new
57-
[issue]:
58-
https://github.com/louislam/uptime-kuma/issues/new?template=security_issue.yml
57+
[issue]: https://github.com/louislam/uptime-kuma/issues/new?template=security_issue.yml
5958

6059
</p>
6160
</details>
@@ -65,7 +64,6 @@ to review the appropriate one for your contribution.
6564

6665
If you come across a bug and think you can solve, we appreciate your work.
6766
Please make sure that you follow these rules:
68-
6967
- keep the PR as small as possible, fix only one thing at a time => keeping it
7068
reviewable
7169
- test that your code does what you claim it does.
@@ -79,16 +77,15 @@ to review the appropriate one for your contribution.
7977
- <details><summary><b>Translations / Internationalisation (i18n)</b> (click to expand)</summary>
8078
<p>
8179

82-
Please add **all** strings that are translatable to `src/lang/en.json`. If translation keys are omitted, they cannot be translated. **Do not include any other languages in your initial pull request** (even if it is your mother tongue) to avoid merge conflicts between Weblate and `master`. Once your PR is merged into `master`, the strings can be translated by awesome people donating their language skills.
83-
84-
We use Weblate to localise this project into many languages. If you want to help translate Uptime Kuma into your language, please see [these instructions on how to translate using Weblate](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
85-
80+
Please add **all** strings that are translatable to `src/lang/en.json`. If translation keys are omitted, they cannot be translated. **Do not include any other languages in your initial pull request** (even if it is your mother tongue) to avoid merge conflicts between Weblate and `master`. Once your PR is merged into `master`, the strings can be translated by awesome people donating their language skills.
81+
82+
We use Weblate to localise this project into many languages. If you want to help translate Uptime Kuma into your language, please see [these instructions on how to translate using Weblate](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
83+
8684
There are some cases where a change cannot be done directly in Weblate and requires a PR:
87-
88-
- A text may not yet be localisable. In this case, **adding a new language key** via `{{ $t("Translation key") }}` or [`<i18n-t keypath="Translation key">`](https://vue-i18n.intlify.dev/guide/advanced/component.html) might be necessary.
89-
- Language keys need to be **added to `en.json`** to appear in Weblate. If this has not been done, a PR is appreciated.
90-
- **Adding a new language** requires creating a new file. See [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
91-
85+
- A text may not yet be localisable. In this case, **adding a new language key** via `{{ $t("Translation key") }}` or [`<i18n-t keypath="Translation key">`](https://vue-i18n.intlify.dev/guide/advanced/component.html) might be necessary.
86+
- Language keys need to be **added to `en.json`** to appear in Weblate. If this has not been done, a PR is appreciated.
87+
- **Adding a new language** requires creating a new file. See [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
88+
9289
<sub>Because maintainer time is precious, junior maintainers may merge uncontroversial PRs in this area.</sub>
9390

9491
</p>
@@ -98,7 +95,6 @@ to review the appropriate one for your contribution.
9895
<p>
9996

10097
To set up a new notification provider these files need to be modified/created:
101-
10298
- `server/notification-providers/PROVIDER_NAME.js` is where the heart of the
10399
notification provider lives.
104100

@@ -135,7 +131,6 @@ to review the appropriate one for your contribution.
135131
translations (`{{ $t("Translation key") }}`,
136132
[`i18n-t keypath="Translation key">`](https://vue-i18n.intlify.dev/guide/advanced/component.html))
137133
in `src/lang/en.json` to enable our translators to translate this
138-
139134
- `src/components/notifications/index.js` is where the frontend of the
140135
provider needs to be registered. _If you have an idea how we can skip this
141136
step, we would love to hear about it ^^_
@@ -147,7 +142,6 @@ to review the appropriate one for your contribution.
147142

148143
To make sure you have tested the notification provider, please include
149144
screenshots of the following events in the pull-request description:
150-
151145
- `UP`/`DOWN`
152146
- Certificate Expiry via <https://expired.badssl.com/>
153147
- Domain Expiry via <https://google.com/> and a larger time set
@@ -159,7 +153,7 @@ to review the appropriate one for your contribution.
159153

160154
```md
161155
| Event | Before | After |
162-
|--------------------|-----------------------|----------------------|
156+
| ------------------ | --------------------- | -------------------- |
163157
| `UP` | ![Before](image-link) | ![After](image-link) |
164158
| `DOWN` | ![Before](image-link) | ![After](image-link) |
165159
| Certificate-expiry | ![Before](image-link) | ![After](image-link) |
@@ -177,7 +171,6 @@ to review the appropriate one for your contribution.
177171
<p>
178172

179173
To set up a new notification provider these files need to be modified/created:
180-
181174
- `server/monitor-types/MONITORING_TYPE.js` is the core of each monitor.
182175
The `async check(...)`-function should:
183176
- in the happy-path: set `heartbeat.msg` to a successful message and set `heartbeat.status = UP`
@@ -220,7 +213,6 @@ to review the appropriate one for your contribution.
220213
<p>
221214

222215
Contributing is easy and fun. We will guide you through the process:
223-
224216
1. **Fork** the [Uptime-Kuma repository](https://github.com/louislam/uptime-kuma/) and **clone** it to your local machine.
225217
2. **Create a new branch** for your changes (e.g., `signal-notification-provider`).
226218
3. **Make your changes** and **commit** them with a clear message.
@@ -235,7 +227,6 @@ to review the appropriate one for your contribution.
235227

236228
A PR should remain in **draft status** until all tasks are completed.
237229
Only change the status to **Ready for Review** when:
238-
239230
- You have implemented all planned changes.
240231
- Your code is fully tested and ready for review.
241232
- You have updated or created the necessary tests.
@@ -248,7 +239,6 @@ to review the appropriate one for your contribution.
248239

249240
- Merging multiple issues by a huge PR is more difficult to review and causes
250241
conflicts with other PRs. Please
251-
252242
- (if possible) **create one PR for one issue** or
253243
- (if not possible) **explain which issues a PR addresses and why this PR
254244
should not be broken apart**
@@ -269,6 +259,7 @@ to review the appropriate one for your contribution.
269259
### Continuous Integration
270260

271261
All pull requests must pass our continuous integration checks. These checks include:
262+
272263
- **Linting**: We use ESLint and Stylelint for code quality checks. You can run the linter locally with `npm run lint`.
273264
- **Formatting**: We use Prettier for code formatting. You can format your code with `npm run fmt` (or CI will do this for you)
274265
- **Testing**: We use Playwright for end-to-end tests and have a suite of backend tests. You can run the tests locally with `npm test`.
@@ -297,13 +288,11 @@ you can finally start the app. The goal is to make the Uptime Kuma installation
297288
as easy as installing a mobile app.
298289

299290
- Easy to install for non-Docker users
300-
301291
- no native build dependency is needed (for `x86_64`/`armv7`/`arm64`)
302292
- no extra configuration and
303293
- no extra effort required to get it running
304294

305295
- Single container for Docker users
306-
307296
- no complex docker-compose file
308297
- mapping the volume and exposing the port should be the only requirements
309298

@@ -480,18 +469,16 @@ We have a few procedures we follow. These are documented here:
480469

481470
- <details><summary><b>Set up a Docker Builder</b> (click to expand)</summary>
482471
<p>
483-
484472
- amd64, armv7 using local.
485473
- arm64 using remote arm64 cpu, as the emulator is too slow and can no longer
486474
pass the `npm ci` command.
487-
488475
1. Add the public key to the remote server.
489476
2. Add the remote context. The remote machine must be arm64 and installed
490477
Docker CE.
491478

492-
```bash
493-
docker context create oracle-arm64-jp --docker "host=ssh://root@100.107.174.88"
494-
```
479+
```bash
480+
docker context create oracle-arm64-jp --docker "host=ssh://root@100.107.174.88"
481+
```
495482

496483
3. Create a new builder.
497484

@@ -515,7 +502,6 @@ We have a few procedures we follow. These are documented here:
515502

516503
- <details><summary><b>Release</b> (click to expand)</summary>
517504
<p>
518-
519505
1. Draft a release note
520506
2. Make sure the repo is cleared
521507
3. If the healthcheck is updated, remember to re-compile it:
@@ -528,7 +514,6 @@ We have a few procedures we follow. These are documented here:
528514
9. Deploy to the demo server: `npm run deploy-demo-server`
529515

530516
These Items need to be checked:
531-
532517
- [ ] Check all tags is fine on
533518
<https://hub.docker.com/r/louislam/uptime-kuma/tags>
534519
- [ ] Try the Docker image with tag 1.X.X (Clean install / amd64 / arm64 /
@@ -540,7 +525,6 @@ We have a few procedures we follow. These are documented here:
540525

541526
- <details><summary><b>Release Beta</b> (click to expand)</summary>
542527
<p>
543-
544528
1. Draft a release note, check `This is a pre-release`
545529
2. Make sure the repo is cleared
546530
3. `npm run release-beta` with env vars: `VERSION` and `GITHUB_TOKEN`

0 commit comments

Comments
 (0)