Skip to content

Commit

Permalink
Add Prettier and Lints For Prettier (#130)
Browse files Browse the repository at this point in the history
* Add prettier and prettier-eslint

* Update prettier rules and upgrade Next

* Run prettier to format files

* Add pre-commit formatting hook

---------

Co-authored-by: Parker Abramson <parkerrabramson@gmail.com>
  • Loading branch information
tsar-boomba and parkerra authored Sep 6, 2024
1 parent a8905c2 commit ac58c7d
Show file tree
Hide file tree
Showing 42 changed files with 11,583 additions and 6,281 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/node_modules
**/package-lock.json
**/yarn.lock
**/.next
**/mobile
**/.github
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"bracketSpacing": true,
"printWidth": 80,
"tabWidth": 2,
"semi": true
}
7 changes: 3 additions & 4 deletions functions/src/firestore/updateLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import og from "fetch-opengraph";
const updateLinks = functions.firestore
.document("resources/links")
.onUpdate(async (change: any, context) => {

// retrieve the previous and current value
const before = change.before.data();
const after = change.after.data();
Expand All @@ -15,7 +14,7 @@ const updateLinks = functions.firestore
}
return false;
});

// only update if name has changed to prevent infinite loops
if (changed.length === 0) return null;

Expand All @@ -24,7 +23,7 @@ const updateLinks = functions.firestore
return og.fetch(link.url).catch((err: any) => {
return false;
});
})
});

const data = await Promise.all(promises);

Expand All @@ -38,7 +37,7 @@ const updateLinks = functions.firestore
title: after.links[index].title || ogData.title,
description: after.links[index].description || ogData.description,
image: ogData.image,
}
};
});

return change.after.ref.set(after);
Expand Down
10 changes: 3 additions & 7 deletions functions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
"skipLibCheck": true
},
"compileOnSave": true,
"include": [
"src"
],
"exclude": [
"node_modules"
]
}
"include": ["src"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit ac58c7d

Please sign in to comment.