Skip to content

Commit

Permalink
eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mshivam019 committed May 11, 2024
1 parent 3774150 commit 799eaa0
Show file tree
Hide file tree
Showing 64 changed files with 20,299 additions and 2,200 deletions.
128 changes: 68 additions & 60 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,69 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"airbnb",
"plugin:import/errors",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"next/core-web-vitals",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
"react/jsx-filename-extension": [
"error",
{ "extensions": [".jsx", ".tsx"] }
],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"import-prefer-default-export": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"react/no-array-index-key": "off",
"react-hooks/rules-of-hooks": "off",
"no-return-assign": "off",
"no-underscore-dangle": "off",
"no-use-before-define": "off",
"no-nested-ternary": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-static-element-interactions": "off",
"react/no-unstable-nested-components": "off",
"no-unused-expressions": "off"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}

"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"airbnb",
"plugin:import/errors",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"next/core-web-vitals",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
"react/jsx-filename-extension": [
"error",
{ "extensions": [".jsx", ".tsx"] }
],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"react/no-unstable-nested-components": [
"error",
{
"allowAsProps": true
}
],
"no-console": "off",
"no-use-before-define": "off",
"react-hooks/exhaustive-deps": "off",
"react/function-component-definition": "off",
"no-shadow": "off",
"react/jsx-props-no-spreading": "off",
"react/destructuring-assignment": "off",
"react/require-default-props": "off",
"react/no-array-index-key": "off",
"global-require": "off",
"jsx-a11y/alt-text": "off",
"no-unused-vars": "off",
"no-param-reassign": "off",
"no-nested-ternary": "off",
"no-undef": "off",
"import/no-unresolved": "off"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}
10 changes: 4 additions & 6 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from "react";
import { Redirect, withLayoutContext } from "expo-router";
import { useAuth } from "../../provider/AuthProvider";
import { AntDesign, EvilIcons, Ionicons } from "@expo/vector-icons";
import {
createMaterialTopTabNavigator,
Expand All @@ -9,6 +8,7 @@ import {
} from "@react-navigation/material-top-tabs";
import { ParamListBase, TabNavigationState } from "@react-navigation/native";
import { ActivityIndicator, Keyboard, View } from "react-native";
import { useAuth } from "../../provider/AuthProvider";
import { CustomBottomSheetModal } from "../../components";

const { Navigator } = createMaterialTopTabNavigator();
Expand Down Expand Up @@ -57,8 +57,7 @@ export default function TabLayout() {
animationEnabled: false,
lazy: true,
lazyPreloadDistance: 0,
lazyPlaceholder: () => {
return (
lazyPlaceholder: () => (
<View
style={{
flex: 1,
Expand All @@ -72,8 +71,7 @@ export default function TabLayout() {
color="black"
/>
</View>
);
},
),
tabBarInactiveTintColor: "gray",
tabBarActiveTintColor: "black",
tabBarShowIcon: true,
Expand Down Expand Up @@ -172,5 +170,5 @@ export default function TabLayout() {
</MaterialTopTabs>
</>
);
else return <Redirect href="/login" />;
return <Redirect href="/login" />;
}
8 changes: 3 additions & 5 deletions app/(tabs)/account/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { Pressable, View } from "react-native";
import { Octicons } from "@expo/vector-icons";
import { useAuth } from "../../../provider/AuthProvider";


function StackLayout() {
const { handlePresentModalPress } = useAuth();
const { handlePresentModalPress = () => {} } = useAuth();
return (
<Stack
screenOptions={{
Expand All @@ -20,11 +19,10 @@ function StackLayout() {
</Pressable>
<Pressable
onPress={() => {
handlePresentModalPress &&
handlePresentModalPress();
handlePresentModalPress();
}}
>
<Octicons name="gear" size={24} />
<Octicons name="gear" size={24} />
</Pressable>
</View>
),
Expand Down
9 changes: 5 additions & 4 deletions app/(tabs)/account/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useCallback, useState } from "react";
import { StyleSheet, View, Text, Pressable } from "react-native";
import { Image } from "expo-image";
import { useUserStore } from "../../../store";
import { supabase } from "../../../lib/supabase";
import { useFocusEffect, router } from "expo-router";
import { useAuth } from "../../../provider/AuthProvider";
import { LinearGradient } from "expo-linear-gradient";
import { Feather } from "@expo/vector-icons";
import { FlatList } from "react-native-gesture-handler";
import { useAuth } from "../../../provider/AuthProvider";
import { supabase } from "../../../lib/supabase";
import { useUserStore } from "../../../store";

export default function Profile() {
const { userDetails, user } = useUserStore();
Expand All @@ -21,7 +21,7 @@ export default function Profile() {
const { signOut } = useAuth();

const getData = async () => {
//count entries where userid is equal to the current user
// count entries where userid is equal to the current user
const { data, error } = await supabase
.from("stars")
.select("id", { count: "exact" })
Expand Down Expand Up @@ -76,6 +76,7 @@ export default function Profile() {
borderWidth: 2,
marginTop: -90,
}}
alt="Profile Picture"
/>

<Text
Expand Down
11 changes: 5 additions & 6 deletions app/(tabs)/create/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Pressable, View } from "react-native";
import { Octicons } from "@expo/vector-icons";
import { useAuth } from "../../../provider/AuthProvider";

const StackLayout = () => {
const { handlePresentModalPress } = useAuth();
function StackLayout() {
const { handlePresentModalPress = () => {} } = useAuth();
return (
<Stack
screenOptions={{
Expand Down Expand Up @@ -34,8 +34,7 @@ const StackLayout = () => {
</Pressable>
<Pressable
onPress={() => {
handlePresentModalPress &&
handlePresentModalPress();
handlePresentModalPress();
}}
>
<Octicons name="gear" size={24} />
Expand All @@ -54,10 +53,10 @@ const StackLayout = () => {
name="editor"
options={{
title: "Write",
}}
}}
/>
</Stack>
);
};
}

export default StackLayout;
12 changes: 5 additions & 7 deletions app/(tabs)/create/editor.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from "react";
import { ScrollView, StyleSheet } from "react-native";
import { Preview, RichTextEditor } from "../../../components";
import { useLocalSearchParams } from "expo-router";
import { useWritingsStore } from "../../../store";
import uuid from "react-native-uuid";
import { Preview, RichTextEditor } from "../../../components";
import { useWritingsStore } from "../../../store";

const Editor = () => {
function Editor() {
const { id } = useLocalSearchParams<{id:string}>();
const { articles, drafts } = useWritingsStore();
const existingArticle =
Expand All @@ -31,9 +31,7 @@ const Editor = () => {
<Preview
setShowEditor={setShowEditor}
article={
existingArticle
? existingArticle
: {
existingArticle || {
id: uuid.v4().toString(),
title: "",
content: article,
Expand All @@ -50,7 +48,7 @@ const Editor = () => {
)}
</ScrollView>
);
};
}

const styles = StyleSheet.create({
container: {
Expand Down
9 changes: 4 additions & 5 deletions app/(tabs)/explore/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Pressable, View } from "react-native";
import { Octicons } from "@expo/vector-icons";
import { useAuth } from "../../../provider/AuthProvider";

const StackLayout = () => {
const { handlePresentModalPress } = useAuth();
function StackLayout() {
const { handlePresentModalPress = () =>{} } = useAuth();
return (
<Stack
screenOptions={{
Expand Down Expand Up @@ -34,8 +34,7 @@ const StackLayout = () => {
</Pressable>
<Pressable
onPress={() => {
handlePresentModalPress &&
handlePresentModalPress();
handlePresentModalPress();
}}
>
<Octicons name="gear" size={24} />
Expand All @@ -47,6 +46,6 @@ const StackLayout = () => {
<Stack.Screen name="index" options={{ title: "Explore" }} />
</Stack>
);
};
}

export default StackLayout;
9 changes: 4 additions & 5 deletions app/(tabs)/favourites/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Pressable, View } from "react-native";
import { Octicons } from "@expo/vector-icons";
import { useAuth } from "../../../provider/AuthProvider";

const StackLayout = () => {
const { handlePresentModalPress } = useAuth();
function StackLayout() {
const { handlePresentModalPress = () =>{} } = useAuth();
return (
<Stack
screenOptions={{
Expand Down Expand Up @@ -34,8 +34,7 @@ const StackLayout = () => {
</Pressable>
<Pressable
onPress={() => {
handlePresentModalPress &&
handlePresentModalPress();
handlePresentModalPress();
}}
>
<Octicons name="gear" size={24} />
Expand All @@ -47,6 +46,6 @@ const StackLayout = () => {
<Stack.Screen name="index" options={{ title: "Favourites" }} />
</Stack>
);
};
}

export default StackLayout;
9 changes: 4 additions & 5 deletions app/(tabs)/favourites/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react'
import { FavouritesList } from '../../../components'
import { WidgetList } from "../../../components";

const Favourites = () => {
return <FavouritesList />
function Favourites() {
return <WidgetList />;
}

export default Favourites
export default Favourites;
Loading

0 comments on commit 799eaa0

Please sign in to comment.