Skip to content

Commit

Permalink
fix: fix code styling and prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
yjose committed Nov 9, 2022
1 parent 3a8641e commit 5df3ec8
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 57 deletions.
4 changes: 4 additions & 0 deletions template/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
singleQuote: true,
endOfLine: 'auto',
};
4 changes: 2 additions & 2 deletions template/__mocks__/@gorhom/bottom-sheet.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { FlatList, Modal, ScrollView, View } from "react-native";
import React from 'react';
import { FlatList, Modal, ScrollView, View } from 'react-native';

const BottomSheetModalContext = React.createContext(null);

Expand Down
12 changes: 6 additions & 6 deletions template/__mocks__/react-native-gesture-handler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FlatList, ScrollView, TouchableOpacity, View } from "react-native";
import { FlatList, ScrollView, TouchableOpacity, View } from 'react-native';

module.exports = {
ScrollView,
Expand All @@ -16,10 +16,10 @@ module.exports = {
DOWN: 8,
},
State: {
BEGAN: "BEGAN",
FAILED: "FAILED",
ACTIVE: "ACTIVE",
END: "END",
UNDETERMINED: "UNDETERMINED",
BEGAN: 'BEGAN',
FAILED: 'FAILED',
ACTIVE: 'ACTIVE',
END: 'END',
UNDETERMINED: 'UNDETERMINED',
},
};
2 changes: 1 addition & 1 deletion template/__mocks__/react-native-reanimated.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require("react-native-reanimated/mock");
module.exports = require('react-native-reanimated/mock');
32 changes: 16 additions & 16 deletions template/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
module.exports = {
testEnvironment: "jsdom",
preset: "jest-expo",
testEnvironment: 'jsdom',
preset: 'jest-expo',
globals: {
"ts-jest": {
'ts-jest': {
tsconfig: {
jsx: "react",
jsx: 'react',
},
},
},
transform: {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",
"^.+\\.tsx?$": "ts-jest",
'^.+\\.js$': '<rootDir>/node_modules/react-native/jest/preprocessor.js',
'^.+\\.tsx?$': 'ts-jest',
},
testMatch: ["**/?(*.)+(spec|test).ts?(x)"],
testMatch: ['**/?(*.)+(spec|test).ts?(x)'],
collectCoverageFrom: [
"**/*.{ts,tsx}",
"!**/coverage/**",
"!**/node_modules/**",
"!**/babel.config.js",
"!**/jest.setup.js",
'**/*.{ts,tsx}',
'!**/coverage/**',
'!**/node_modules/**',
'!**/babel.config.js',
'!**/jest.setup.js',
],
moduleFileExtensions: ["js", "ts", "tsx"],
moduleFileExtensions: ['js', 'ts', 'tsx'],
transformIgnorePatterns: [
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)",
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)',
],
coverageReporters: ["json-summary", "text", "lcov"],
coverageReporters: ['json-summary', 'text', 'lcov'],
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
'^@/(.*)$': '<rootDir>/src/$1',
},
};
6 changes: 3 additions & 3 deletions template/src/screens/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from 'react';
import { useForm } from 'react-hook-form';
import * as z from 'zod';

import { useAuth } from "@/core";
import { Button, ControlledInput, View } from "@/ui";
import { useAuth } from '@/core';
import { Button, ControlledInput, View } from '@/ui';

const schema = z.object({
email: z.string().email(),
Expand All @@ -22,7 +22,7 @@ export const Login = () => {

const onSubmit = (data: FormType) => {
console.log(data);
signIn({ access: "access-token", refresh: "refresh-token" });
signIn({ access: 'access-token', refresh: 'refresh-token' });
};
return (
<View className="flex-1 justify-center p-4">
Expand Down
14 changes: 7 additions & 7 deletions template/src/screens/login/login.test.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//App.spec.tsx
import { cleanup, render, screen } from "@testing-library/react-native";
import React from "react";
import { cleanup, render, screen } from '@testing-library/react-native';
import React from 'react';

import { Login } from "./index";
import { Login } from './index';

afterEach(cleanup);

test("LoginComponents", () => {
test('LoginComponents', () => {
render(<Login />);
const { getByTestId } = screen;

const emailInput = getByTestId("emailInput");
const passwordInput = getByTestId("passwordInput");
const LoginButton = getByTestId("LoginButton");
const emailInput = getByTestId('emailInput');
const passwordInput = getByTestId('passwordInput');
const LoginButton = getByTestId('LoginButton');

expect(emailInput).toBeDefined();
expect(passwordInput).toBeDefined();
Expand Down
22 changes: 11 additions & 11 deletions template/src/ui/core/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import type { TextInput, TextInputProps } from 'react-native';
import { StyleSheet } from 'react-native';
import { TextInput as NTextInput } from 'react-native';

import { isRTL } from "@/core";
import { isRTL } from '@/core';

import colors from "../../theme/colors";
import { Text } from "../text";
import { View } from "../view";
import colors from '../../theme/colors';
import { Text } from '../text';
import { View } from '../view';

const STextInput = styled(NTextInput);

Expand All @@ -26,17 +26,17 @@ export const Input = React.forwardRef<TextInput, NInputProps>((props, ref) => {
const onFocus = React.useCallback(() => setIsFocussed(true), []);

const borderColor = error
? "border-danger-600"
? 'border-danger-600'
: isFocussed
? "border-neutral-600"
: "border-neutral-400";
? 'border-neutral-600'
: 'border-neutral-400';

const bgColor = error ? "bg-danger-50" : "bg-neutral-200";
const textDirection = isRTL ? "text-right" : "text-left";
const bgColor = error ? 'bg-danger-50' : 'bg-neutral-200';
const textDirection = isRTL ? 'text-right' : 'text-left';
return (
<View className="mb-4">
{label && (
<Text variant="md" className={error ? "text-danger-600" : "text-black"}>
<Text variant="md" className={error ? 'text-danger-600' : 'text-black'}>
{label}
</Text>
)}
Expand All @@ -49,7 +49,7 @@ export const Input = React.forwardRef<TextInput, NInputProps>((props, ref) => {
onFocus={onFocus}
{...inputProps}
style={StyleSheet.flatten([
{ writingDirection: isRTL ? "rtl" : "ltr" },
{ writingDirection: isRTL ? 'rtl' : 'ltr' },
])}
/>
{error && <Text variant="error">{error}</Text>}
Expand Down
12 changes: 1 addition & 11 deletions template/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9182,16 +9182,11 @@ [email protected], prop-types@^15.7.2, prop-types@^15.8.1:
object-assign "^4.1.1"
react-is "^16.13.1"

property-expr@^2.0.4:
version "2.0.5"
resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-2.0.5.tgz#278bdb15308ae16af3e3b9640024524f4dc02cb4"
integrity sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==

psl@^1.1.33:
version "1.9.0"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7"
integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==

pump@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
Expand Down Expand Up @@ -10802,11 +10797,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"
integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==

toposort@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330"
integrity sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==

tough-cookie@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.2.tgz#e53e84b85f24e0b65dd526f46628db6c85f6b874"
Expand Down

0 comments on commit 5df3ec8

Please sign in to comment.