Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,16 @@ To run an end-to-end test in the frontend folder:
```bash
pnpm test
```

#### Linting

Linting depends partially on generated code, so first:

```bash
pnpm run -r build
```

And then:
```bash
pnpm run -r lint
```
5 changes: 3 additions & 2 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ export default [
files: ['**/*.svelte'],
rules: {
// The Svelte plugin doesn't seem to have typing quite figured out
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
},
},
...svelte.configs.recommended,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/components/FilterBar/FilterBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import { DEFAULT_DEBOUNCE_TIME } from '$lib/util/time';

type DumbFilters = $$Generic<Record<string, unknown>>;
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
type Filters = DumbFilters & Record<typeof searchKey, string>;

let searchInput: PlainInput | undefined = $state();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import type { Confidentiality } from './ProjectFilter.svelte';

interface Props extends Omit<SelectProps, 'label'> {
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- false positive
value: Confidentiality | undefined;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

type Schema = typeof verify;

// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let deletionFormModal: FormModal<Schema> | undefined = $state();
let deletionForm = $derived(deletionFormModal?.form());
</script>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/components/modals/FormModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
let done = $state(false);

export async function open(
value: Partial<FormType> | undefined, //eslint-disable-line @typescript-eslint/no-redundant-type-constituents
value: Partial<FormType> | undefined,
onSubmit: SubmitCallback,
): Promise<FormModalResult<Schema>>;
export async function open(onSubmit: SubmitCallback): Promise<FormModalResult<Schema>>;
export async function open(
valueOrOnSubmit: Partial<FormType> | SubmitCallback | undefined, //eslint-disable-line @typescript-eslint/no-redundant-type-constituents
valueOrOnSubmit: Partial<FormType> | SubmitCallback | undefined,
_onSubmit?: SubmitCallback,
): Promise<FormModalResult<Schema>> {
done = false;
Expand Down
1 change: 0 additions & 1 deletion frontend/src/routes/(authenticated)/admin/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
showDeletedProjects: queryParam.boolean<boolean>(false),
hideDraftProjects: queryParam.boolean<boolean>(false),
emptyProjects: queryParam.boolean<boolean>(false),
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- false positive?
confidential: queryParam.string<Confidentiality | undefined>(undefined),
projectType: queryParam.string<ProjectType | undefined>(undefined),
memberSearch: queryParam.string(undefined),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

type Schema = typeof schema;
type RefinedSchema = typeof refinedSchema;
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<RefinedSchema> | undefined = $state();

export function close(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

const schema = z.object({});

// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<typeof schema> | undefined = $state();
let newProjects: Project[] = $state([]);
let alreadyAddedProjects: number = $state(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
role: z.enum([OrgRole.User, OrgRole.Admin]).default(OrgRole.User),
canInvite: z.boolean().default(false),
});
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<typeof schema> | undefined = $state();
let form = $derived(formModal?.form());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
usernamesText: z.string().trim().min(1, $t('org_page.bulk_add_members.empty_user_field')),
});

// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<typeof schema> | undefined = $state();
let form = $derived(formModal?.form());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
role: z.enum([OrgRole.User, OrgRole.Admin]),
});
type Schema = typeof schema;
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<Schema> | undefined = $state();
let form = $derived(formModal?.form());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
});

type Schema = typeof schema;
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<Schema> | undefined = $state();
let form = $derived(formModal?.form());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
role: z.enum([ProjectRole.Editor, ProjectRole.Manager, ProjectRole.Observer]).default(ProjectRole.Editor),
canInvite: z.boolean().default(false),
});
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<typeof schema> | undefined = $state();
let form = $derived(formModal?.form());
let selectedUserId: string | undefined = $state(undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
});

type Schema = typeof schema;
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<Schema> | undefined = $state();
let form = $derived(formModal?.form());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
password: passwordFormRules($t),
});

// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<typeof schema> | undefined = $state();
let form = $derived(formModal?.form());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
role: z.enum([ProjectRole.Editor, ProjectRole.Manager, ProjectRole.Observer]),
});
type Schema = typeof schema;
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<Schema> | undefined = $state();
let form = $derived(formModal?.form());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
const schema = z.object({
isConfidential: z.boolean(),
});
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let formModal: FormModal<typeof schema> | undefined = $state();
let form = $derived(formModal?.form());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
}

let tusUpload: TusUpload | undefined = $state();
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
let uploadStatus: UploadStatus | undefined = $state();
</script>

Expand Down
5 changes: 3 additions & 2 deletions frontend/viewer/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ export default [
files: ['**/*.svelte'],
rules: {
// The Svelte plugin doesn't seem to have typing quite figured out
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
},
},
...svelte.configs.recommended,
Expand Down
1 change: 0 additions & 1 deletion frontend/viewer/src/lib/OpenInFieldWorksButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

type Props = {
entry: IEntry
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
} & ButtonProps;

const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
values: Value[];
options: ReadonlyArray<Value>;
readonly?: boolean;
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
idSelector: ConditionalKeys<Value, Primitive> | ((value: Value) => Primitive);
labelSelector: ConditionalKeys<Value, string> | ((value: Value) => string);
/* eslint-enable @typescript-eslint/no-redundant-type-constituents */
placeholder?: string;
filterPlaceholder?: string;
emptyResultsPlaceholder?: string;
Expand Down Expand Up @@ -157,7 +155,6 @@
}
}

// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
function getHighlightedValue(): Value | undefined {
const selectedItem = commandRef?.querySelector('[data-command-item][data-selected]');
const index = selectedItem?.getAttribute('data-value-index');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
value?: Value;
options: ReadonlyArray<Value>;
readonly?: boolean;
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
idSelector: ConditionalKeys<Value, Primitive> | ((value: Value) => Primitive);
labelSelector: ConditionalKeys<Value, string> | ((value: Value) => string);
/* eslint-enable @typescript-eslint/no-redundant-type-constituents */
placeholder?: string;
filterPlaceholder?: string;
emptyResultsPlaceholder?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import {cn} from '$lib/utils';
import type {IconClass} from '$lib/icon-class';

// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
type Props = IconProps & {
ping?: boolean;
icon: IconClass;
Expand Down
Loading