Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add eslint in root of monorepo #431

Merged
merged 3 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
eslint fix
  • Loading branch information
wentokay committed Jul 28, 2022
commit b7c51eabc323ad897c156b0a654355457f624d98
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import { Typography } from "@mui/material";
import { PublicKey } from "@solana/web3.js";
import { useCustomTheme, styles } from "@coral-xyz/themes";
import { useNftMetadata } from "@coral-xyz/recoil";
import { PrimaryButton, SecondaryButton } from "../../common";
import { PrimaryButton, SecondaryButton, TextField } from "../../common";
import {
useDrawerContext,
WithDrawer,
WithMiniDrawer,
CloseButton,
} from "../../Layout/Drawer";
import { NavStackEphemeral, NavStackScreen } from "../../Layout/NavStack";
import { TextField } from "../../common";
import { SendConfirmationCard } from "../Balances/TokensWidget/Send";

const useStyles = styles((theme) => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/background/src/keyring/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as bs58 from "bs58";
import { Commitment } from "@solana/web3.js";
import type { Commitment } from "@solana/web3.js";
import type { KeyringStoreState } from "@coral-xyz/recoil";
import { KeyringStoreStateEnum } from "@coral-xyz/recoil";
import type { EventEmitter, DerivationPath } from "@coral-xyz/common";
Expand Down
9 changes: 4 additions & 5 deletions packages/common/src/solana/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import BN from "bn.js";
import type { TransactionInstruction, Commitment } from "@solana/web3.js";
import {
import type {
TransactionInstruction,
Commitment,
Connection,
PublicKey,
SystemProgram,
Transaction,
} from "@solana/web3.js";
import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js";
import { Token } from "@solana/spl-token";
import type { TokenInfo } from "@solana/spl-token-registry";
import * as anchor from "@project-serum/anchor";
Expand Down
8 changes: 4 additions & 4 deletions packages/ledger-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function solanaLedgerSignBytes(
derivationPath: Buffer,
msgBytes: Buffer // Transaction "message".
) {
var numPaths = Buffer.alloc(1);
const numPaths = Buffer.alloc(1);
// @ts-ignore
numPaths.writeUInt8(1);
const payload = Buffer.concat([numPaths, derivationPath, msgBytes]);
Expand All @@ -79,7 +79,7 @@ export async function getPublicKey(
account: number,
path: DerivationPath
) {
let dPath = solanaDerivationPath(account, path);
const dPath = solanaDerivationPath(account, path);
const pubkeyBytes = await solanaLedgerPubkey(transport, dPath);
return new PublicKey(bs58.encode(pubkeyBytes));
}
Expand Down Expand Up @@ -112,8 +112,8 @@ async function solanaSend(
p1: number,
payload: Buffer
) {
var p2 = 0;
var payload_offset = 0;
let p2 = 0;
let payload_offset = 0;

if (payload.length > MAX_PAYLOAD) {
while (payload.length - payload_offset > MAX_PAYLOAD) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger-injection/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ class LedgerInjection {
}
}

let LEDGER = new LedgerInjection();
const LEDGER = new LedgerInjection();

main();
4 changes: 2 additions & 2 deletions packages/react-xnft/src/reconciler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const RECONCILER = ReactReconciler({
logger.debug("createTextInstance", text);
const instance = {
id: h.nextId(),
kind: "raw" as "raw", // ts wtf?
kind: "raw" as const,
text,
props: undefined,
style: undefined,
Expand Down Expand Up @@ -1242,7 +1242,7 @@ function getOnChangeHandler(viewId: number): (event: any) => void {
}

export class ReconcilerBridgeManager {
private static _renderId: number = 0;
private static _renderId = 0;

//
// Send a message from the plugin-ui to the host over the reconciler bridge.
Expand Down
2 changes: 1 addition & 1 deletion packages/react-xnft/src/sdk/Stack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function NavStackInner({
(c: any) => c.props.name === activeRoute.name
);

let { title: titleDefault } = options({
const { title: titleDefault } = options({
route: activeRoute,
});
if (!title) {
Expand Down
4 changes: 2 additions & 2 deletions packages/recoil/src/atoms/token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const solanaNftCollections = selector({
// Bucket all the nfts by collection name.
//
const collections: Map<string, any> = new Map();
for (let [key, value] of metadata.entries()) {
for (const [key, value] of metadata.entries()) {
if (value.tokenMetaUriData.collection) {
const name = value.tokenMetaUriData.collection.name;
if (!collections.has(name)) {
Expand All @@ -212,7 +212,7 @@ export const solanaNftCollections = selector({
// Finally, sort each bucket for consistent UI presentation.
//
const sortedCollections: any = [];
for (let [name, items] of collections.entries()) {
for (const [name, items] of collections.entries()) {
items.sort((a, b) =>
a.publicKey > b.publicKey ? 1 : a.publicKey === b.publicKey ? 0 : -1
);
Expand Down
2 changes: 1 addition & 1 deletion packages/recoil/src/context/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function SwapProvider(props: any) {

const executeSwap = async () => {
if (!transactions) return null;
for (let transactionStep of [
for (const transactionStep of [
"setupTransaction",
"swapTransaction",
"cleanupTransaction",
Expand Down
1 change: 1 addition & 0 deletions packages/recoil/src/hooks/useLocalStorage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState } from "react";

export function useLocalStorage(key: string, initialValue: any) {
// State to store our value

// Pass initial state function to useState so logic is only executed once
const [storedValue, setStoredValue] = useState(() => {
if (typeof window === "undefined") {
Expand Down
4 changes: 2 additions & 2 deletions packages/recoil/src/hooks/useNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function useNavigation(): NavigationContext {
const pathname = location.pathname;
const isRoot = TAB_SET.has(pathname.slice(1));
const params = new URLSearchParams(location.search);
let title = isRoot
const title = isRoot
? ""
: useDecodedSearchParams<ExtensionSearchParams>(params).title || "";

Expand Down Expand Up @@ -123,7 +123,7 @@ function makeParams(ob = {}) {
.join("&");
}

export module SearchParamsFor {
export namespace SearchParamsFor {
export interface Plugin {
props: { pluginUrl: string };
}
Expand Down