diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 4f0ec07..27e1d9a 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,11 +1,15 @@ /* eslint-env node */ module.exports = { - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', "prettier"], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - root: true, - ignorePatterns: ["babel.config.js", "jest.config.js", "node_modules/"], - rules: { - "@typescript-eslint/explicit-function-return-type": "error" - } -}; \ No newline at end of file + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "prettier", + ], + parser: "@typescript-eslint/parser", + plugins: ["@typescript-eslint"], + root: true, + ignorePatterns: ["babel.config.js", "jest.config.js", "node_modules/"], + rules: { + "@typescript-eslint/explicit-function-return-type": "error", + }, +}; diff --git a/app.json b/app.json index c776eb6..5d3b60a 100644 --- a/app.json +++ b/app.json @@ -11,9 +11,7 @@ "resizeMode": "contain", "backgroundColor": "#ffffff" }, - "assetBundlePatterns": [ - "**/*" - ], + "assetBundlePatterns": ["**/*"], "ios": { "supportsTablet": true }, diff --git a/babel.config.js b/babel.config.js index 2900afe..73ebf58 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,6 +1,6 @@ -module.exports = function(api) { +module.exports = function (api) { api.cache(true); return { - presets: ['babel-preset-expo'], + presets: ["babel-preset-expo"], }; }; diff --git a/src/components/NewPostContainer.tsx b/src/components/NewPostContainer.tsx index 3257858..5545464 100644 --- a/src/components/NewPostContainer.tsx +++ b/src/components/NewPostContainer.tsx @@ -23,9 +23,9 @@ export function NewPostContainer(): JSX.Element { onPress={() => { if (currentInput.length > 0) { const p: NewPost = { - content: currentInput, - token: "token" - } + content: currentInput, + token: "token", + }; createPost(p); setCurrentInput(""); } else { diff --git a/src/components/PostView.tsx b/src/components/PostView.tsx index 06f0ba5..f3b4672 100644 --- a/src/components/PostView.tsx +++ b/src/components/PostView.tsx @@ -10,10 +10,6 @@ import { style } from "../util/style"; * @returns {JSX.Element} The JSX for the Post */ export function PostView({ post }: { post: Post }): JSX.Element { - // WARNING THIS IS NOT ACCEPTABLE WARNING REMOVE WARNING - // eslint-disable-next-line @typescript-eslint/no-unused-vars - // const [thisPost, setThisPost] = React.useState(post); - return ( {post.id + " " + post.content} diff --git a/src/components/PostsContainer.tsx b/src/components/PostsContainer.tsx index c8f3c4e..3afa494 100644 --- a/src/components/PostsContainer.tsx +++ b/src/components/PostsContainer.tsx @@ -29,7 +29,7 @@ export function PostsContainer(): JSX.Element { setPage(0); setPostData(await getPostsInterval(0, 10)); } - setPostData([]) + setPostData([]); fetchPosts(); } @@ -57,7 +57,9 @@ export function PostsContainer(): JSX.Element { } + renderItem={({ item }) => ( + + )} keyExtractor={(item: Post) => item.id + item.createdAt} getItemCount={getItemCount} getItem={getItem} diff --git a/src/util/api.ts b/src/util/api.ts index bd3c62e..5a1aef6 100644 --- a/src/util/api.ts +++ b/src/util/api.ts @@ -56,7 +56,10 @@ export async function getPosts(): Promise { return data; } -export async function getPostsInterval(offset: number, limit: number): Promise { +export async function getPostsInterval( + offset: number, + limit: number, +): Promise { const res = await fetch(URL + `/api/posts?offset=${offset}&limit=${limit}`); const data = await res.json(); return data; @@ -104,7 +107,7 @@ export async function createPost(post: NewPost): Promise { export async function submitRegistration( username: string, password: string, - captcha: string + captcha: string, ): Promise { const response = await fetch(URL + "/api/register", { method: "POST", @@ -125,7 +128,7 @@ export async function submitRegistration( */ export async function submitLogin( username: string, - password: string + password: string, ): Promise { if (username == "" || password == "") return; diff --git a/tsconfig.json b/tsconfig.json index e22f4e1..b9567f6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,4 +3,4 @@ "compilerOptions": { "strict": true } -} \ No newline at end of file +}