Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #924 from solita/prettier-update
Browse files Browse the repository at this point in the history
Prettier update
  • Loading branch information
Juholei authored Mar 23, 2023
2 parents a292c50 + b5423ff commit 5b4c3e7
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"arrowParens": "avoid",
"svelteSortOrder": "options-scripts-styles-markup",
"svelteAllowShorthand": true,
"svelteBracketNewLine": false
"bracketSameLine": true
}
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/energiatodistus/energiatodistukset.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
{i18n('energiatodistus.haku.sarakkeet.laatija')}
</th>
{#if Kayttajat.isLaatija(whoami)}
<th class="etp-table--th etp-table--th__center">
<th class="etp-table--th etp-table--th__center">
<span class="material-icons"> delete_forever </span>
</th>
{/if}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/energiatodistus/energiatodistus-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
</script>

<H3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
$: ostoenergiatSum = EtUtils.sumEtValues(ostoenergiat);
$: toteutuneetOstoenergiatPerLammitettyNettoala = EtUtils.perLammitettyNettoala(
energiatodistus,
ostoenergiat
);
$: toteutuneetOstoenergiatPerLammitettyNettoala =
EtUtils.perLammitettyNettoala(energiatodistus, ostoenergiat);
$: toteutuneetOstoenergiatPerLammitettyNettoalaSum = R.compose(
EtUtils.sumEtValues
Expand Down
10 changes: 2 additions & 8 deletions src/pages/energiatodistus/signing.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,7 @@
</p>
{/if}

{#if R.includes(currentState.status, [
status.not_started,
status.already_started
])}
{#if R.includes( currentState.status, [status.not_started, status.already_started] )}
<p>
{i18n('energiatodistus.signing.messages.connection-success')}
</p>
Expand Down Expand Up @@ -266,10 +263,7 @@
{/each}

<div class="buttons">
{#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()}
<div class="mr-10 mt-5">
<Button
prefix="signing-submit"
Expand Down
18 changes: 12 additions & 6 deletions src/pages/energiatodistus/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ const requiredCondition = {
'lahtotiedot.ilmanvaihto.kuvaus-fi': isIlmanvaihtoKuvausRequired,
'lahtotiedot.ilmanvaihto.kuvaus-sv': isIlmanvaihtoKuvausRequired,

'lahtotiedot.lammitys.lammitysmuoto-1.kuvaus-fi': isLammitysmuoto1KuvausRequired,
'lahtotiedot.lammitys.lammitysmuoto-1.kuvaus-sv': isLammitysmuoto1KuvausRequired,
'lahtotiedot.lammitys.lammitysmuoto-1.kuvaus-fi':
isLammitysmuoto1KuvausRequired,
'lahtotiedot.lammitys.lammitysmuoto-1.kuvaus-sv':
isLammitysmuoto1KuvausRequired,

'lahtotiedot.lammitys.lammitysmuoto-2.kuvaus-fi': isLammitysmuoto2KuvausRequired,
'lahtotiedot.lammitys.lammitysmuoto-2.kuvaus-sv': isLammitysmuoto2KuvausRequired,
'lahtotiedot.lammitys.lammitysmuoto-2.kuvaus-fi':
isLammitysmuoto2KuvausRequired,
'lahtotiedot.lammitys.lammitysmuoto-2.kuvaus-sv':
isLammitysmuoto2KuvausRequired,

'lahtotiedot.lammitys.lammonjako.kuvaus-fi': isLammonjakoKuvausRequired,
'lahtotiedot.lammitys.lammonjako.kuvaus-sv': isLammonjakoKuvausRequired,
Expand Down Expand Up @@ -88,11 +92,13 @@ const requiredConstraints = R.map(R.juxt([predicate, R.identity]));

const assertValue = R.curry((property, value) => {
if (R.isNil(value) || !Maybe.isMaybe(value)) {
throw 'Required property: ' +
throw (
'Required property: ' +
property +
' value: ' +
value +
' must be in monad Maybe[A] or Either[Maybe[A]].';
' must be in monad Maybe[A] or Either[Maybe[A]].'
);
}
});

Expand Down
44 changes: 21 additions & 23 deletions src/pages/kayttaja/existing-kayttaja.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,27 @@
}
);
const submitAineistoasiakas = (whoami, id) => (
updatedKayttaja,
updatedKayttajaAineistot
) =>
fork(
'kayttaja',
Future.parallelObject(2, {
kayttaja: KayttajaApi.putKayttajaById(
whoami.rooli,
fetch,
id,
updatedKayttaja
),
aineistot: KayttajaApi.putKayttajaAineistot(
fetch,
id,
updatedKayttajaAineistot
)
}),
_ => {
idTranslateStore.updateKayttaja(updatedKayttaja);
}
);
const submitAineistoasiakas =
(whoami, id) => (updatedKayttaja, updatedKayttajaAineistot) =>
fork(
'kayttaja',
Future.parallelObject(2, {
kayttaja: KayttajaApi.putKayttajaById(
whoami.rooli,
fetch,
id,
updatedKayttaja
),
aineistot: KayttajaApi.putKayttajaAineistot(
fetch,
id,
updatedKayttajaAineistot
)
}),
_ => {
idTranslateStore.updateKayttaja(updatedKayttaja);
}
);
const load = params => {
overlay = true;
Expand Down
5 changes: 1 addition & 4 deletions src/pages/valvonta-kaytto/valvonta.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@

<H2 text={i18n(i18nRoot + '.toimenpiteet')} />

{#each tapahtumat([
R.map(keyed('toimenpide'), toimenpiteet),
R.map(keyed('note'), notes)
]) as tapahtuma (tapahtuma.key)}
{#each tapahtumat( [R.map(keyed('toimenpide'), toimenpiteet), R.map(keyed('note'), notes)] ) as tapahtuma (tapahtuma.key)}
<div class="mb-8">
{#if isToimenpide(tapahtuma)}
<Toimenpide
Expand Down
17 changes: 4 additions & 13 deletions src/pages/valvonta-oikeellisuus/toimenpiteet.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,10 @@ export const typeKey = id => types[id];
export const isType = R.propEq('type-id');

const isDeadlineType = R.includes(R.__, [3, 5, 6, 9, 10, 11, 13]);
export const isDialogType = R.includes(R.__, [
0,
1,
2,
3,
5,
6,
9,
10,
11,
13,
14
]);
export const isDialogType = R.includes(
R.__,
[0, 1, 2, 3, 5, 6, 9, 10, 11, 13, 14]
);
const isResponseType = R.includes(R.__, [4, 8, 12]);

export const hasDeadline = R.propSatisfies(isDeadlineType, 'type-id');
Expand Down
5 changes: 1 addition & 4 deletions src/pages/valvonta-oikeellisuus/valvonta.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,7 @@
<HR compact={true} />

<H2 text={i18n(i18nRoot + '.toimenpiteet')} />
{#each tapahtumat([
R.map(keyed('toimenpide'), toimenpiteet),
R.map(keyed('note'), notes)
]) as tapahtuma (tapahtuma.key)}
{#each tapahtumat( [R.map(keyed('toimenpide'), toimenpiteet), R.map(keyed('note'), notes)] ) as tapahtuma (tapahtuma.key)}
<div class="mb-8">
{#if isToimenpide(tapahtuma)}
<Toimenpide
Expand Down
10 changes: 5 additions & 5 deletions src/utils/deep-objects_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ describe('Deep objects:', () => {
assert.deepEqual(objects.values(R.F, { a: { b: { c: 1 } } }), [1]);

assert.deepEqual(objects.values(R.F, { a: { b: 1 }, c: 1 }), [1, 1]);
assert.deepEqual(objects.values(R.F, { a: { b: 1 }, c: { d: 1 } }), [
1,
1
]);
assert.deepEqual(
objects.values(R.F, { a: { b: 1 }, c: { d: 1 } }),
[1, 1]
);
});

it('Value objects', () => {
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('Deep objects:', () => {

it('Mixed', () => {
assert.deepEqual(objects.mergeRight(R.F, [1], { a: 2 }), {
'0': 1,
0: 1,
a: 2
});
});
Expand Down
5 changes: 3 additions & 2 deletions src/utils/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ export const formatTimeInstantMinutes = time =>
dfns.format(time, 'd.M.yyyy H:mm');

export const numberFormat = Intl.NumberFormat('fi-FI').format;
export const percentFormat = Intl.NumberFormat('fi-FI', { style: 'percent' })
.format;
export const percentFormat = Intl.NumberFormat('fi-FI', {
style: 'percent'
}).format;

export const optionalString = Maybe.orSome('');
export const optionalNumber = R.compose(Maybe.orSome(''), R.map(numberFormat));
Expand Down
11 changes: 2 additions & 9 deletions src/utils/future-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@ import * as R from 'ramda';

export { Fluture };

export const {
Future,
resolve,
reject,
encaseP,
promise,
attemptP,
cache
} = Fluture;
export const { Future, resolve, reject, encaseP, promise, attemptP, cache } =
Fluture;

/**
* @sig Future [a,c] -> Future [a,b] -> Future [a,c]
Expand Down

0 comments on commit 5b4c3e7

Please sign in to comment.