style: fix linting issues met Prettier
This commit is contained in:
parent
ef5c51b463
commit
11600b8be4
11 changed files with 578 additions and 541 deletions
|
@ -5,8 +5,10 @@
|
|||
*/
|
||||
export const assignmentTitleRules = [
|
||||
(value: string): string | boolean => {
|
||||
if (value?.length >= 1) {return true;} // Title must not be empty
|
||||
return 'Title cannot be empty.';
|
||||
if (value?.length >= 1) {
|
||||
return true;
|
||||
} // Title must not be empty
|
||||
return "Title cannot be empty.";
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -18,9 +20,9 @@ export const assignmentTitleRules = [
|
|||
export const learningPathRules = [
|
||||
(value: { hruid: string; title: string }): string | boolean => {
|
||||
if (value && value.hruid) {
|
||||
return true; // Valid if hruid is present
|
||||
return true; // Valid if hruid is present
|
||||
}
|
||||
return 'You must select a learning path.';
|
||||
return "You must select a learning path.";
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -31,8 +33,10 @@ export const learningPathRules = [
|
|||
*/
|
||||
export const classRules = [
|
||||
(value: string): string | boolean => {
|
||||
if (value) {return true;}
|
||||
return 'You must select at least one class.';
|
||||
if (value) {
|
||||
return true;
|
||||
}
|
||||
return "You must select at least one class.";
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -43,14 +47,20 @@ export const classRules = [
|
|||
*/
|
||||
export const deadlineRules = [
|
||||
(value: string): string | boolean => {
|
||||
if (!value) {return "You must set a deadline.";}
|
||||
if (!value) {
|
||||
return "You must set a deadline.";
|
||||
}
|
||||
|
||||
const selectedDateTime = new Date(value);
|
||||
const now = new Date();
|
||||
|
||||
if (isNaN(selectedDateTime.getTime())) {return "Invalid date or time.";}
|
||||
if (isNaN(selectedDateTime.getTime())) {
|
||||
return "Invalid date or time.";
|
||||
}
|
||||
|
||||
if (selectedDateTime <= now) {return "The deadline must be in the future.";}
|
||||
if (selectedDateTime <= now) {
|
||||
return "The deadline must be in the future.";
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
@ -58,7 +68,9 @@ export const deadlineRules = [
|
|||
|
||||
export const descriptionRules = [
|
||||
(value: string): string | boolean => {
|
||||
if (!value || value.trim() === "") {return "Description cannot be empty.";}
|
||||
if (!value || value.trim() === "") {
|
||||
return "Description cannot be empty.";
|
||||
}
|
||||
return true;
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue