Skip to content

Commit

Permalink
Add prettierrc & fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
foyarash committed Oct 19, 2023
1 parent 0b3f0c7 commit de43cca
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
root: true,
extends: ['universe/native', 'universe/web'],
ignorePatterns: ['build'],
extends: ["universe/native", "universe/web"],
ignorePatterns: ["build"],
};
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": false,
"arrowParens": "always",
"semi": true,
"trailingComma": "all"
}
2 changes: 1 addition & 1 deletion src/RNWallet.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StyleProp, ViewStyle } from 'react-native';
import { StyleProp, ViewStyle } from "react-native";

/**
* @platform ios
Expand Down
10 changes: 5 additions & 5 deletions src/RNWalletModule.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { requireNativeModule } from 'expo-modules-core';
import { Platform } from 'react-native';
import { requireNativeModule } from "expo-modules-core";
import { Platform } from "react-native";

import { ButtonType, RNWalletConstants } from './RNWallet.types';
import { ButtonType, RNWalletConstants } from "./RNWallet.types";

// It loads the native module object from the JSI or falls back to
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
const RNWalletModule = requireNativeModule('RNWallet');
const RNWalletModule = requireNativeModule("RNWallet");

export const Constants: RNWalletConstants = {
buttonLayout: {
baseWidth: RNWalletModule.buttonLayout?.baseWidth,
baseHeight: RNWalletModule.buttonLayout?.baseHeight,

baseWidthFromType(type) {
if (Platform.OS === 'android') {
if (Platform.OS === "android") {
if (type === ButtonType.PRIMARY) {
return RNWalletModule.buttonLayout?.baseWidthPrimary;
}
Expand Down
14 changes: 7 additions & 7 deletions src/RNWalletView.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { requireNativeViewManager } from 'expo-modules-core';
import * as React from 'react';
import { Platform, StyleSheet } from 'react-native';
import { requireNativeViewManager } from "expo-modules-core";
import * as React from "react";
import { Platform, StyleSheet } from "react-native";

import { ButtonType, RNWalletViewProps } from './RNWallet.types';
import { Constants } from './RNWalletModule';
import { ButtonType, RNWalletViewProps } from "./RNWallet.types";
import { Constants } from "./RNWalletModule";

const NativeView: React.ComponentType<
Omit<RNWalletViewProps, 'onPress'> & { onButtonPress?: () => void }
> = requireNativeViewManager('RNWallet');
Omit<RNWalletViewProps, "onPress"> & { onButtonPress?: () => void }
> = requireNativeViewManager("RNWallet");

export default function RNWalletView({
onPress,
Expand Down
16 changes: 8 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Platform } from 'react-native';
import { Platform } from "react-native";

import RNWalletModule, { Constants } from './RNWalletModule';
import RNWalletView from './RNWalletView';
import RNWalletModule, { Constants } from "./RNWalletModule";
import RNWalletView from "./RNWalletView";

export function canAddPasses() {
return RNWalletModule.canAddPasses();
Expand All @@ -22,8 +22,8 @@ export function addPass(urlOrToken: string): Promise<boolean> {
* @platform ios
*/
export function hasPass(url: string): Promise<boolean> {
if (Platform.OS !== 'ios') {
console.warn('RNWallet.hasPass is only available on iOS');
if (Platform.OS !== "ios") {
console.warn("RNWallet.hasPass is only available on iOS");
return Promise.resolve(false);
}

Expand All @@ -39,13 +39,13 @@ export function hasPass(url: string): Promise<boolean> {
* @platform ios
*/
export function removePass(url: string): Promise<void> {
if (Platform.OS !== 'ios') {
console.warn('RNWallet.removePass is only available on iOS');
if (Platform.OS !== "ios") {
console.warn("RNWallet.removePass is only available on iOS");
return Promise.resolve();
}

return RNWalletModule.removePass(url);
}

export { RNWalletView, Constants };
export * from './RNWallet.types';
export * from "./RNWallet.types";

0 comments on commit de43cca

Please sign in to comment.