From bc73d54a9dd0eb9e54957e7839d99b2b6fd032f9 Mon Sep 17 00:00:00 2001 From: Bernd Storath <999999bst@gmail.com> Date: Mon, 5 Aug 2024 14:42:35 +0200 Subject: [PATCH] add prettier eslint config --- src/eslint.config.mjs | 3 ++- src/package.json | 1 + src/pnpm-lock.yaml | 16 ++++++++++++++++ src/server/utils/WireGuard.ts | 14 ++++++++------ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/eslint.config.mjs b/src/eslint.config.mjs index 988b20ff..ad6fe8e4 100644 --- a/src/eslint.config.mjs +++ b/src/eslint.config.mjs @@ -1,3 +1,4 @@ import { createConfigForNuxt } from '@nuxt/eslint-config/flat'; +import eslintConfigPrettier from 'eslint-config-prettier'; -export default createConfigForNuxt({}); +export default createConfigForNuxt().append(eslintConfigPrettier); diff --git a/src/package.json b/src/package.json index cd51a256..297195b7 100644 --- a/src/package.json +++ b/src/package.json @@ -35,6 +35,7 @@ "@types/debug": "^4.1.12", "@types/qrcode": "^1.5.5", "eslint": "^9.8.0", + "eslint-config-prettier": "^9.1.0", "prettier": "^3.3.3", "typescript": "^5.5.4", "vue-tsc": "^2.0.29" diff --git a/src/pnpm-lock.yaml b/src/pnpm-lock.yaml index ab0644aa..5ac8f4d5 100644 --- a/src/pnpm-lock.yaml +++ b/src/pnpm-lock.yaml @@ -56,6 +56,9 @@ importers: eslint: specifier: ^9.8.0 version: 9.8.0 + eslint-config-prettier: + specifier: ^9.1.0 + version: 9.1.0(eslint@9.8.0) prettier: specifier: ^3.3.3 version: 3.3.3 @@ -3458,6 +3461,15 @@ packages: integrity: sha512-OEUbS2wzzYtUfshjOqzFo4Bl4lHykXUdM08TCnYNl7ki+niW4Q1R0j0FDFDr0vjVsI5ZFOz5LvluxOP+Ew+dYw==, } + eslint-config-prettier@9.1.0: + resolution: + { + integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==, + } + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + eslint-flat-config-utils@0.3.0: resolution: { @@ -9631,6 +9643,10 @@ snapshots: find-up-simple: 1.0.0 parse-gitignore: 2.0.0 + eslint-config-prettier@9.1.0(eslint@9.8.0): + dependencies: + eslint: 9.8.0 + eslint-flat-config-utils@0.3.0: dependencies: '@types/eslint': 9.6.0 diff --git a/src/server/utils/WireGuard.ts b/src/server/utils/WireGuard.ts index 66aa2e29..a797f464 100644 --- a/src/server/utils/WireGuard.ts +++ b/src/server/utils/WireGuard.ts @@ -73,7 +73,7 @@ class WireGuard { const config = await this.__buildConfig(); await this.__saveConfig(config); - await exec('wg-quick down wg0').catch(() => { }); + await exec('wg-quick down wg0').catch(() => {}); await exec('wg-quick up wg0').catch((err) => { if ( err && @@ -125,8 +125,9 @@ PostDown = ${WG_POST_DOWN} # Client: ${client.name} (${clientId}) [Peer] PublicKey = ${client.publicKey} -${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' - }AllowedIPs = ${client.address}/32`; +${ + client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' +}AllowedIPs = ${client.address}/32`; } debug('Config saving...'); @@ -227,8 +228,9 @@ ${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\ [Peer] PublicKey = ${config.server.publicKey} -${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' - }AllowedIPs = ${WG_ALLOWED_IPS} +${ + client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' +}AllowedIPs = ${WG_ALLOWED_IPS} PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE} Endpoint = ${WG_HOST}:${WG_CONFIG_PORT}`; } @@ -378,7 +380,7 @@ Endpoint = ${WG_HOST}:${WG_CONFIG_PORT}`; // Shutdown wireguard async Shutdown() { - await exec('wg-quick down wg0').catch(() => { }); + await exec('wg-quick down wg0').catch(() => {}); } }