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 = { module.exports = {
"env": { "env": {
"browser": true, "browser": true,
"es2021": true "es2021": true,
node: true
}, },
"extends": "eslint:recommended", "extends": "eslint:recommended",
"parserOptions": { "parserOptions": {

View file

@ -25,7 +25,7 @@ function createProject(name) {
class todoHandler { class todoHandler {
// Create default project during construction // Create default project during construction
constructor(projects=null) { constructor(projects = null) {
if (projects) { if (projects) {
this.projects = projects; this.projects = projects;
} else if (!this.projects) { } else if (!this.projects) {
@ -50,12 +50,12 @@ class todoHandler {
if (!_titleExists) { if (!_titleExists) {
this.projects[index].todos.push(new createTodo(title, description, dueDate, pomodoros)); 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)); return compareAsc(new Date(a.dueDate), new Date(b.dueDate));
}); });
// console.log(this.projects[index]); // console.log(this.projects[index]);
//(itemA, itemB) => {return itemA.dueDate - itemB.dueDate}) //(itemA, itemB) => {return itemA.dueDate - itemB.dueDate})
} else { } else {
alert('unable to create duplicate note'); alert('unable to create duplicate note');
return return
@ -68,7 +68,7 @@ class todoHandler {
let projectIndex = this.projects.findIndex(x => x.name === project); let projectIndex = this.projects.findIndex(x => x.name === project);
let todo = this.projects[projectIndex].todos.find(t => t.title === title) let todo = this.projects[projectIndex].todos.find(t => t.title === title)
if (todo){ if (todo) {
todo.completed = !todo.completed; todo.completed = !todo.completed;
// if(description) todo.description = description; // if(description) todo.description = description;
// if(dueDate) todo.dueDate = dueDate; // if(dueDate) todo.dueDate = dueDate;
@ -79,9 +79,9 @@ class todoHandler {
deleteTodo(project, title) { deleteTodo(project, title) {
let projectIndex = this.projects.findIndex(x => x.name === project); let projectIndex = this.projects.findIndex(x => x.name === project);
let tempArr = this.projects[projectIndex].todos.filter(item => { let tempArr = this.projects[projectIndex].todos.filter(item => {
if (item.title !== title){ if (item.title !== title) {
return item; return item;
}; }
}); });
this.projects[projectIndex].todos = tempArr; this.projects[projectIndex].todos = tempArr;
} }
@ -100,16 +100,16 @@ class todoHandler {
} }
getProjects () { getProjects() {
return this.projects; return this.projects;
} }
delProject(name) { delProject(name) {
let index = this.projects.findIndex(proj => proj.name === name); let index = this.projects.findIndex(proj => proj.name === name);
let tempArr = this.projects.filter(item => { let tempArr = this.projects.filter(item => {
if (item !== this.projects[index] || name === 'default' ){ if (item !== this.projects[index] || name === 'default') {
return item; return item;
}; }
}); });
this.projects = tempArr; this.projects = tempArr;
} }
@ -118,4 +118,4 @@ class todoHandler {
} }
export { todoHandler }; export { todoHandler };

View file

@ -8,7 +8,7 @@ import {
getTodoFromActiveProject, getTodoFromActiveProject,
addTodoComponent, addTodoComponent,
handleCompletedTodo handleCompletedTodo
} from "./components/todoComponent"; } from "./components/todoComponent";
import { navbar } from "./components/navbar"; import { navbar } from "./components/navbar";
import { save, load } from "./components/storage"; import { save, load } from "./components/storage";
import './style.css'; import './style.css';
@ -22,7 +22,7 @@ todos = data ? new todoManager(JSON.parse(data)) : new todoManager();
let activeProject = 'default'; let activeProject = 'default';
function setActiveProject(value) { function setActiveProject(value) {
activeProject = value; activeProject = value;
} }
function getActiveProject() { function getActiveProject() {