Skip to content

Commit

Permalink
chore: make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
callmemagnus committed Nov 4, 2023
1 parent 75857e8 commit 7bec523
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0", "8.1"]
php-versions: ["8.1"]

name: php-lint

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit-oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
php-versions: ["8.0"]
php-versions: ["8.3"]
server-versions: ["master"]

services:
Expand Down
10 changes: 9 additions & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ Files: package-lock.json package.json composer.json composer.lock src/.prettierr
Copyright: Magnus Anderssen <[email protected]>
License: AGPL-3.0-or-later

Files: l10n/*.js l10n/*.json bin/tools/translationtool.phar
Files: bin/tools/translationtool.phar
Copyright: Nextcloud translators <https://www.transifex.com/nextcloud/>
License: AGPL-3.0-or-later

Files: l10n/*.js l10n/*.json
Copyright: Magnus Anderssen <[email protected]>
License: AGPL-3.0-or-later

Files:*.svelte *.ts
Copyright: Magnus Anderssen <[email protected]>
License: AGPL-3.0-or-later

Files: .github/* bin/*.sh translationfiles/*/*.po translationfiles/templates/thesearchpage.pot
Copyright: Magnus Anderssen <[email protected]>
License: AGPL-3.0-or-later
10 changes: 6 additions & 4 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ class PageController extends Controller
private $labels;


public function __construct(IRequest $request, private IL10N $l, private IInitialState $state,
)
{
public function __construct(
IRequest $request,
private IL10N $l,
private IInitialState $state,
) {
parent::__construct(Application::APP_ID, $request);

$this->labels = [
Expand All @@ -39,7 +41,7 @@ public function __construct(IRequest $request, private IL10N $l, private IInitia
"Clear current query",
"Search",
"Click to change providers",
"Filters",
"Filters",
];
}

Expand Down
19 changes: 15 additions & 4 deletions src/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"plugins": [
"prettier-plugin-svelte"
],
"pluginSearchDirs": [
"."
],
"svelteBracketNewLine": false,
"bracketSameLine": true,
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
5 changes: 3 additions & 2 deletions src/components/Header/ProviderSelector.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import type { ChangeEventHandler } from 'svelte/elements';
import { writable } from 'svelte/store';
import { PROVIDER_ALL, PROVIDER_ALL_LABEL } from '../../lib/search';
import { _t } from '../../lib/translate';
Expand Down Expand Up @@ -28,14 +29,14 @@
}
});
function updateAll(event: InputEvent) {
const updateAll: ChangeEventHandler<HTMLInputElement> = (event) => {
const target = event.target as HTMLInputElement;
if (target.checked) {
displayedSelection.set(providers.map(({ id }) => id));
} else {
displayedSelection.set([]);
}
}
};
</script>

<div class="mwb-checkboxes-container">
Expand Down
10 changes: 5 additions & 5 deletions src/lib/log.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* Warn with a magnifying glass
* @param rest
* @param rest
*/
export function cwarn(...rest: unknown[]) {
console.warn('🔎 SEARCH_PAGE::', ...rest)
console.warn('🔎 SEARCH_PAGE::', ...rest);
}

/**
* Log with a magnifying glass
* @param rest
* @param rest
*/
export function clog(...rest: unknown[]) {
console.log('🔎 SEARCH_PAGE::', ...rest)
}
console.log('🔎 SEARCH_PAGE::', ...rest);
}
4 changes: 2 additions & 2 deletions src/lib/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export function saveInSession(terms: string, providerIds: string[]) {
newState.append('terms', terms);
}
if (providerIds) {
providerIds.forEach(p => {
providerIds.forEach((p) => {
newState.append('provider', p);
})
});
}

try {
Expand Down
6 changes: 4 additions & 2 deletions src/lib/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@

import { get } from 'svelte/store';
import { labels } from '../states/initialStates';
import { cwarn } from './log'
import { cwarn } from './log';

export function _t(label: string) {
const translations = get(labels);
if (translations[label]) {
return translations[label];
}

cwarn(`Missing label "${label}" in used language: please help translate: https://github.com/callmemagnus/nextcloud-searchpage`);
cwarn(
`Missing label "${label}" in used language: please help translate: https://github.com/callmemagnus/nextcloud-searchpage`
);
return label;
}
6 changes: 3 additions & 3 deletions src/states/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const session = loadFromSession();

export const terms = writable(session.terms);
export const providerId = writable(session.providers[0]);
export const providerIds = writable(session.providers)
export const providerIds = writable(session.providers);

terms.subscribe((t) => {
saveInSession(t.trim(), [get(providerId)]);
Expand All @@ -17,5 +17,5 @@ providerId.subscribe((p) => {
saveInSession(get(terms), [p]);
});
providerIds.subscribe((pIds) => {
saveInSession(get(terms), pIds)
})
saveInSession(get(terms), pIds);
});

0 comments on commit 7bec523

Please sign in to comment.