style: formatting with prettier

This commit is contained in:
Mike 2024-01-08 21:10:06 -05:00
parent b357ad8ecc
commit 7eb4f96f3a
3 changed files with 28 additions and 27 deletions

View file

@ -2,7 +2,8 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
"es2021": true,
node: true
},
"extends": "eslint:recommended",
"parserOptions": {

View file

@ -25,7 +25,7 @@ function createProject(name) {
class todoHandler {
// Create default project during construction
constructor(projects=null) {
constructor(projects = null) {
if (projects) {
this.projects = projects;
} else if (!this.projects) {
@ -50,7 +50,7 @@ class todoHandler {
if (!_titleExists) {
this.projects[index].todos.push(new createTodo(title, description, dueDate, pomodoros));
this.projects[index].todos.sort((a,b) => {
this.projects[index].todos.sort((a, b) => {
return compareAsc(new Date(a.dueDate), new Date(b.dueDate));
});
@ -68,7 +68,7 @@ class todoHandler {
let projectIndex = this.projects.findIndex(x => x.name === project);
let todo = this.projects[projectIndex].todos.find(t => t.title === title)
if (todo){
if (todo) {
todo.completed = !todo.completed;
// if(description) todo.description = description;
// if(dueDate) todo.dueDate = dueDate;
@ -79,9 +79,9 @@ class todoHandler {
deleteTodo(project, title) {
let projectIndex = this.projects.findIndex(x => x.name === project);
let tempArr = this.projects[projectIndex].todos.filter(item => {
if (item.title !== title){
if (item.title !== title) {
return item;
};
}
});
this.projects[projectIndex].todos = tempArr;
}
@ -100,16 +100,16 @@ class todoHandler {
}
getProjects () {
getProjects() {
return this.projects;
}
delProject(name) {
let index = this.projects.findIndex(proj => proj.name === name);
let tempArr = this.projects.filter(item => {
if (item !== this.projects[index] || name === 'default' ){
if (item !== this.projects[index] || name === 'default') {
return item;
};
}
});
this.projects = tempArr;
}

View file

@ -8,7 +8,7 @@ import {
getTodoFromActiveProject,
addTodoComponent,
handleCompletedTodo
} from "./components/todoComponent";
} from "./components/todoComponent";
import { navbar } from "./components/navbar";
import { save, load } from "./components/storage";
import './style.css';