From e387d9c72f02fcf228c908eef55197c173b9f6c0 Mon Sep 17 00:00:00 2001 From: Juho Leinonen Date: Thu, 23 Mar 2023 10:27:32 +0200 Subject: [PATCH 1/2] Update prettier, change scripts newer command format and reconfigure deprecated option --- .prettierrc | 2 +- package-lock.json | 12 ++++++------ package.json | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.prettierrc b/.prettierrc index 75cb4531a..9ce1bf76a 100644 --- a/.prettierrc +++ b/.prettierrc @@ -9,5 +9,5 @@ "arrowParens": "avoid", "svelteSortOrder": "options-scripts-styles-markup", "svelteAllowShorthand": true, - "svelteBracketNewLine": false + "bracketSameLine": true } diff --git a/package-lock.json b/package-lock.json index 4649466de..f912093c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17677,15 +17677,15 @@ "dev": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.6.tgz", + "integrity": "sha512-mtuzdiBbHwPEgl7NxWlqOkithPyp4VN93V7VeHVWBF+ad3I5avc0RVDT4oImXQy9H/AqxA2NSQH8pSxHW6FYbQ==", "dev": true }, "prettier-plugin-svelte": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.1.4.tgz", - "integrity": "sha512-fQfcIyl04VNWI3+JeseT+gLljs2bJJifbKmrTe8yMnTCdv0unfM1jnY2p4etzCfOj6skC1FPFaqBayYk3+7ZZg==", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.10.0.tgz", + "integrity": "sha512-GXMY6t86thctyCvQq+jqElO+MKdB09BkL3hexyGP3Oi8XLKRFaJP1ud/xlWCZ9ZIa2BxHka32zhHfcuU+XsRQg==", "dev": true }, "pretty-bytes": { diff --git a/package.json b/package.json index ca6e1a77f..d0fe28fbe 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "test": "mocha './src/**/*_test.js' --require @babel/register --reporter dot --require init-mocha.js", "coverage": "nyc --reporter=html --reporter=text mocha './src/**/*_test.js' --require init-mocha.js --require @babel/register --reporter dot", "tdd": "mocha './src/**/*_test.js' --require @babel/register --reporter dot --watch --require init-mocha.js", - "format": "prettier --write './src/**/*' modheaders.json", - "check-format": "git diff --name-only origin/develop -- src package.json | xargs -r prettier --check", + "format": "prettier --write src modheaders.json", + "check-format": "prettier --check src", "cypress": "cypress open", "build:docs": "jsdoc -r -c ./jsdoc/conf.json", "watch:docs": "nodemon --exec npm run build:docs --watch src" @@ -47,8 +47,8 @@ "postcss-load-config": "^2.1.0", "postcss-loader": "^3.0.0", "postcss-preset-env": "^6.7.0", - "prettier": "^1.19.1", - "prettier-plugin-svelte": "^2.1.4", + "prettier": "^2.8.6", + "prettier-plugin-svelte": "^2.10.0", "serve": "^11.3.2", "svelte": "^3.37.0", "svelte-loader": "^2.13.6", From b5423ffb1ccb141c212fb6aa5417f7aaf47ea57a Mon Sep 17 00:00:00 2001 From: Juho Leinonen Date: Thu, 23 Mar 2023 10:28:46 +0200 Subject: [PATCH 2/2] Format with new version of prettier --- .../energiatodistus/energiatodistukset.svelte | 2 +- .../energiatodistus/energiatodistus-api.js | 4 +- .../ostetut-polttoaineet.svelte | 15 +++---- .../toteutunut-ostoenergia.svelte | 6 +-- src/pages/energiatodistus/signing.svelte | 10 +---- src/pages/energiatodistus/validation.js | 18 +++++--- src/pages/kayttaja/existing-kayttaja.svelte | 44 +++++++++---------- src/pages/valvonta-kaytto/valvonta.svelte | 5 +-- .../valvonta-oikeellisuus/toimenpiteet.js | 17 ++----- .../valvonta-oikeellisuus/valvonta.svelte | 5 +-- src/utils/deep-objects_test.js | 10 ++--- src/utils/formats.js | 5 ++- src/utils/future-utils.js | 11 +---- 13 files changed, 63 insertions(+), 89 deletions(-) diff --git a/src/pages/energiatodistus/energiatodistukset.svelte b/src/pages/energiatodistus/energiatodistukset.svelte index 81f6e35ac..c961302fc 100644 --- a/src/pages/energiatodistus/energiatodistukset.svelte +++ b/src/pages/energiatodistus/energiatodistukset.svelte @@ -314,7 +314,7 @@ {i18n('energiatodistus.haku.sarakkeet.laatija')} {#if Kayttajat.isLaatija(whoami)} - + delete_forever {/if} diff --git a/src/pages/energiatodistus/energiatodistus-api.js b/src/pages/energiatodistus/energiatodistus-api.js index 57bedaeba..fcc2ba589 100644 --- a/src/pages/energiatodistus/energiatodistus-api.js +++ b/src/pages/energiatodistus/energiatodistus-api.js @@ -40,11 +40,11 @@ const transformationFromSchema = name => ); const versions = { - '2018': { + 2018: { deserializer: transformationFromSchema('deserialize')(schema.v2018), serializer: transformationFromSchema('serialize')(schema.v2018) }, - '2013': { + 2013: { deserializer: transformationFromSchema('deserialize')(schema.v2013), serializer: transformationFromSchema('serialize')(schema.v2013) } diff --git a/src/pages/energiatodistus/form-parts/toteutunut-kulutus/ostetut-polttoaineet.svelte b/src/pages/energiatodistus/form-parts/toteutunut-kulutus/ostetut-polttoaineet.svelte index aca75e856..c8fdc9133 100644 --- a/src/pages/energiatodistus/form-parts/toteutunut-kulutus/ostetut-polttoaineet.svelte +++ b/src/pages/energiatodistus/form-parts/toteutunut-kulutus/ostetut-polttoaineet.svelte @@ -28,20 +28,19 @@ EtUtils.polttoaineet )(energiatodistus); - $: muunnoskerrotutPolttoaineetPerLammitettyNettoala = EtUtils.perLammitettyNettoala( - energiatodistus, - muunnoskerrotutPolttoaineet - ); + $: muunnoskerrotutPolttoaineetPerLammitettyNettoala = + EtUtils.perLammitettyNettoala(energiatodistus, muunnoskerrotutPolttoaineet); $: muunnoskerrotutVapaatPolttoaineet = R.compose( R.map(R.apply(EtUtils.multiplyWithKerroin)), R.converge(R.zip, [EtUtils.vapaatKertoimet, EtUtils.vapaatPolttoaineet]) )(energiatodistus); - $: muunnoskerrotutVapaatPolttoaineetPerLammitettyNettoala = EtUtils.perLammitettyNettoala( - energiatodistus, - muunnoskerrotutVapaatPolttoaineet - ); + $: muunnoskerrotutVapaatPolttoaineetPerLammitettyNettoala = + EtUtils.perLammitettyNettoala( + energiatodistus, + muunnoskerrotutVapaatPolttoaineet + );

{/if} - {#if R.includes(currentState.status, [ - status.not_started, - status.already_started - ])} + {#if R.includes( currentState.status, [status.not_started, status.already_started] )}

{i18n('energiatodistus.signing.messages.connection-success')}

@@ -266,10 +263,7 @@ {/each}
- {#if (R.includes(currentState.status, [ - status.not_started, - status.already_started - ]) && mPollux.version.isSome()) || error.isSome()} + {#if (R.includes( currentState.status, [status.not_started, status.already_started] ) && mPollux.version.isSome()) || error.isSome()}