Formatting entire project
This commit is contained in:
parent
74a5b3930b
commit
a97e9779d1
8 changed files with 30 additions and 27 deletions
|
@ -1,11 +1,15 @@
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', "prettier"],
|
extends: [
|
||||||
parser: '@typescript-eslint/parser',
|
"eslint:recommended",
|
||||||
plugins: ['@typescript-eslint'],
|
"plugin:@typescript-eslint/recommended",
|
||||||
root: true,
|
"prettier",
|
||||||
ignorePatterns: ["babel.config.js", "jest.config.js", "node_modules/"],
|
],
|
||||||
rules: {
|
parser: "@typescript-eslint/parser",
|
||||||
"@typescript-eslint/explicit-function-return-type": "error"
|
plugins: ["@typescript-eslint"],
|
||||||
}
|
root: true,
|
||||||
};
|
ignorePatterns: ["babel.config.js", "jest.config.js", "node_modules/"],
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/explicit-function-return-type": "error",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
4
app.json
4
app.json
|
@ -11,9 +11,7 @@
|
||||||
"resizeMode": "contain",
|
"resizeMode": "contain",
|
||||||
"backgroundColor": "#ffffff"
|
"backgroundColor": "#ffffff"
|
||||||
},
|
},
|
||||||
"assetBundlePatterns": [
|
"assetBundlePatterns": ["**/*"],
|
||||||
"**/*"
|
|
||||||
],
|
|
||||||
"ios": {
|
"ios": {
|
||||||
"supportsTablet": true
|
"supportsTablet": true
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module.exports = function(api) {
|
module.exports = function (api) {
|
||||||
api.cache(true);
|
api.cache(true);
|
||||||
return {
|
return {
|
||||||
presets: ['babel-preset-expo'],
|
presets: ["babel-preset-expo"],
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,9 +23,9 @@ export function NewPostContainer(): JSX.Element {
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (currentInput.length > 0) {
|
if (currentInput.length > 0) {
|
||||||
const p: NewPost = {
|
const p: NewPost = {
|
||||||
content: currentInput,
|
content: currentInput,
|
||||||
token: "token"
|
token: "token",
|
||||||
}
|
};
|
||||||
createPost(p);
|
createPost(p);
|
||||||
setCurrentInput("");
|
setCurrentInput("");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,10 +10,6 @@ import { style } from "../util/style";
|
||||||
* @returns {JSX.Element} The JSX for the Post
|
* @returns {JSX.Element} The JSX for the Post
|
||||||
*/
|
*/
|
||||||
export function PostView({ post }: { post: Post }): JSX.Element {
|
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>(post);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={style.postView}>
|
<View style={style.postView}>
|
||||||
<Text style={style.postFont}>{post.id + " " + post.content}</Text>
|
<Text style={style.postFont}>{post.id + " " + post.content}</Text>
|
||||||
|
|
|
@ -29,7 +29,7 @@ export function PostsContainer(): JSX.Element {
|
||||||
setPage(0);
|
setPage(0);
|
||||||
setPostData(await getPostsInterval(0, 10));
|
setPostData(await getPostsInterval(0, 10));
|
||||||
}
|
}
|
||||||
setPostData([])
|
setPostData([]);
|
||||||
fetchPosts();
|
fetchPosts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,9 @@ export function PostsContainer(): JSX.Element {
|
||||||
<VirtualizedList
|
<VirtualizedList
|
||||||
data={postData}
|
data={postData}
|
||||||
initialNumToRender={4}
|
initialNumToRender={4}
|
||||||
renderItem={({ item }) => <PostView key={item.id + item.createdAt} post={item} />}
|
renderItem={({ item }) => (
|
||||||
|
<PostView key={item.id + item.createdAt} post={item} />
|
||||||
|
)}
|
||||||
keyExtractor={(item: Post) => item.id + item.createdAt}
|
keyExtractor={(item: Post) => item.id + item.createdAt}
|
||||||
getItemCount={getItemCount}
|
getItemCount={getItemCount}
|
||||||
getItem={getItem}
|
getItem={getItem}
|
||||||
|
|
|
@ -56,7 +56,10 @@ export async function getPosts(): Promise<Post[]> {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPostsInterval(offset: number, limit: number): Promise<Post[]> {
|
export async function getPostsInterval(
|
||||||
|
offset: number,
|
||||||
|
limit: number,
|
||||||
|
): Promise<Post[]> {
|
||||||
const res = await fetch(URL + `/api/posts?offset=${offset}&limit=${limit}`);
|
const res = await fetch(URL + `/api/posts?offset=${offset}&limit=${limit}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
return data;
|
return data;
|
||||||
|
@ -104,7 +107,7 @@ export async function createPost(post: NewPost): Promise<void> {
|
||||||
export async function submitRegistration(
|
export async function submitRegistration(
|
||||||
username: string,
|
username: string,
|
||||||
password: string,
|
password: string,
|
||||||
captcha: string
|
captcha: string,
|
||||||
): Promise<AuthResponse | undefined> {
|
): Promise<AuthResponse | undefined> {
|
||||||
const response = await fetch(URL + "/api/register", {
|
const response = await fetch(URL + "/api/register", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -125,7 +128,7 @@ export async function submitRegistration(
|
||||||
*/
|
*/
|
||||||
export async function submitLogin(
|
export async function submitLogin(
|
||||||
username: string,
|
username: string,
|
||||||
password: string
|
password: string,
|
||||||
): Promise<AuthResponse | undefined> {
|
): Promise<AuthResponse | undefined> {
|
||||||
if (username == "" || password == "") return;
|
if (username == "" || password == "") return;
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"strict": true
|
"strict": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue