Skip to content

Commit

Permalink
Additional linting for objects on single line (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively authored Oct 21, 2022
1 parent 774c6c0 commit 1f65488
Show file tree
Hide file tree
Showing 140 changed files with 626 additions and 659 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
. "$(dirname -- "$0")/_/husky.sh"

cd ./blend && yarn lint && cd ../earn && yarn lint && cd ../prime && yarn lint && cd ../shared && yarn lint && cd ..
yarn prettier
npx lint-staged
19 changes: 13 additions & 6 deletions blend/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"extends": [
"react-app",
"react-app/jest",
"plugin:react-hooks/recommended"
],
"extends": ["react-app", "react-app/jest", "plugin:react-hooks/recommended"],
"overrides": [
{
"files": ["*/src/**/*.ts", "*/src/**/*.tsx"]
Expand All @@ -16,6 +12,17 @@
"no-var": "warn",
"max-len": ["warn", { "code": 120 }],
"no-eval": "error",
"object-property-newline": ["warn", { "allowAllPropertiesOnSameLine": true }],
"object-curly-newline": [
"error",
{
"ObjectExpression": { "multiline": true, "minProperties": 4, "consistent": false },
"ObjectPattern": { "multiline": true },
"ImportDeclaration": { "multiline": true },
"ExportDeclaration": { "multiline": true }
}
],
"object-curly-spacing": ["error", "always"],
"eqeqeq": ["warn", "smart"],
"no-return-await": "warn",
"comma-dangle": ["warn", {
Expand Down Expand Up @@ -46,4 +53,4 @@
}
]
}
}
}
16 changes: 4 additions & 12 deletions blend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,17 @@ import { RedirectPartialPath } from './util/RedirectPartialPath';
import ScrollToTop from './util/ScrollToTop';

export const theGraphUniswapV2Client = new ApolloClient({
link: new HttpLink({
uri: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2',
}),
link: new HttpLink({ uri: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2' }),
cache: new InMemoryCache(),
});

export const theGraphUniswapV3Client = new ApolloClient({
link: new HttpLink({
uri: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3',
}),
link: new HttpLink({ uri: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3' }),
cache: new InMemoryCache(),
});

export const theGraphEthereumBlocksClient = new ApolloClient({
link: new HttpLink({
uri: 'https://api.thegraph.com/subgraphs/name/blocklytics/ethereum-blocks',
}),
link: new HttpLink({ uri: 'https://api.thegraph.com/subgraphs/name/blocklytics/ethereum-blocks' }),
cache: new InMemoryCache(),
});

Expand All @@ -58,9 +52,7 @@ function App() {
let mounted = true;

const queryBlocks = async () => {
const response = await theGraphEthereumBlocksClient.query({
query: BLOCK_QUERY,
});
const response = await theGraphEthereumBlocksClient.query({ query: BLOCK_QUERY });
if (mounted) {
setBlockNumber(response.data.blocks[0].number);
}
Expand Down
24 changes: 6 additions & 18 deletions blend/src/assets/abis/AloeBlend.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,14 @@
{
"inputs": [],
"name": "TOKEN0",
"outputs": [
{ "internalType": "contract IERC20", "name": "", "type": "address" }
],
"outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "TOKEN1",
"outputs": [
{ "internalType": "contract IERC20", "name": "", "type": "address" }
],
"outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
Expand Down Expand Up @@ -377,9 +373,7 @@
{
"inputs": [],
"name": "getRebalanceUrgency",
"outputs": [
{ "internalType": "uint32", "name": "urgency", "type": "uint32" }
],
"outputs": [{ "internalType": "uint32", "name": "urgency", "type": "uint32" }],
"stateMutability": "view",
"type": "function"
},
Expand Down Expand Up @@ -451,9 +445,7 @@
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "rewardToken", "type": "address" }
],
"inputs": [{ "internalType": "address", "name": "rewardToken", "type": "address" }],
"name": "rebalance",
"outputs": [],
"stateMutability": "nonpayable",
Expand All @@ -462,9 +454,7 @@
{
"inputs": [],
"name": "silo0",
"outputs": [
{ "internalType": "contract ISilo", "name": "", "type": "address" }
],
"outputs": [{ "internalType": "contract ISilo", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
Expand All @@ -478,9 +468,7 @@
{
"inputs": [],
"name": "silo1",
"outputs": [
{ "internalType": "contract ISilo", "name": "", "type": "address" }
],
"outputs": [{ "internalType": "contract ISilo", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
Expand Down
24 changes: 6 additions & 18 deletions blend/src/assets/abis/Silo.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
[
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" }
],
"inputs": [{ "internalType": "address", "name": "account", "type": "address" }],
"name": "balanceOf",
"outputs": [
{ "internalType": "uint256", "name": "balance", "type": "uint256" }
],
"outputs": [{ "internalType": "uint256", "name": "balance", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }],
"name": "deposit",
"outputs": [],
"stateMutability": "nonpayable",
Expand All @@ -34,20 +28,14 @@
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "token", "type": "address" }
],
"inputs": [{ "internalType": "address", "name": "token", "type": "address" }],
"name": "shouldAllowRemovalOf",
"outputs": [
{ "internalType": "bool", "name": "shouldAllow", "type": "bool" }
],
"outputs": [{ "internalType": "bool", "name": "shouldAllow", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
Expand Down
8 changes: 2 additions & 6 deletions blend/src/assets/abis/UniswapV3Pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,7 @@
"type": "function"
},
{
"inputs": [
{ "internalType": "uint160", "name": "sqrtPriceX96", "type": "uint160" }
],
"inputs": [{ "internalType": "uint160", "name": "sqrtPriceX96", "type": "uint160" }],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
Expand Down Expand Up @@ -496,9 +494,7 @@
"type": "function"
},
{
"inputs": [
{ "internalType": "uint32[]", "name": "secondsAgos", "type": "uint32[]" }
],
"inputs": [{ "internalType": "uint32[]", "name": "secondsAgos", "type": "uint32[]" }],
"name": "observe",
"outputs": [
{
Expand Down
2 changes: 1 addition & 1 deletion blend/src/assets/abis/Weth9.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,4 @@
"name": "Withdrawal",
"type": "event"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ const Container = styled.div`

// TODO: move this to a separate file
function makeRequest(reqUrl: string) {
return axios.get(reqUrl, {
timeout: 10000,
});
return axios.get(reqUrl, { timeout: 10000 });
}

export type BlendAllocationGraphProps = {
Expand Down
4 changes: 1 addition & 3 deletions blend/src/components/browse/BrowseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ export default function BrowseCard(props: BrowseCardProps) {
token1.address,
blendPoolMarkers.feeTier
);
const uniswapVolumeData = await theGraphUniswapV3Client.query({
query: uniswapVolumeQuery,
});
const uniswapVolumeData = await theGraphUniswapV3Client.query({ query: uniswapVolumeQuery });

if (mounted) {
setUniswapVolume(
Expand Down
7 changes: 6 additions & 1 deletion blend/src/components/graph/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ export default function Graph(props: GraphProps) {
<AreaChart
width={964}
data={data}
margin={{ top: 0, left: 0, bottom: 0, right: 0 }}
margin={{
top: 0,
left: 0,
bottom: 0,
right: 0,
}}
// @ts-ignore
baseValue={'dataMin'}
>
Expand Down
4 changes: 1 addition & 3 deletions blend/src/components/graph/PortfolioGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ function NetReturnsDot(props: any) {
}

function makeRequest(reqUrl: string) {
return axios.get(reqUrl, {
timeout: 10000,
});
return axios.get(reqUrl, { timeout: 10000 });
}

function calculateNextDate(currentDate: Date, activeButton: number): Date {
Expand Down
6 changes: 1 addition & 5 deletions blend/src/components/poolstats/PoolStatsWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@ export default function PoolStatsWidget(props: PoolStatsWidgetProps) {
Last Rebalance
</Text>
<Display size='S' weight='semibold' color={POOL_STAT_VALUE_TEXT_COLOR}>
{poolStats
? formatDistance(poolStats.recenterTimestamp * 1000, Date.now(), {
addSuffix: true,
})
: '--'}
{poolStats ? formatDistance(poolStats.recenterTimestamp * 1000, Date.now(), { addSuffix: true }) : '--'}
</Display>
</PoolStat>
</PoolStatsWidgetGrid>
Expand Down
4 changes: 1 addition & 3 deletions blend/src/connector/BlendDepositActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export async function mintWeth(
const wethContract = new Contract(WETH_9_MAINNET_ADDRESS, WethAbi, signer);

try {
const transactionResponse = await wethContract.deposit({
value: ethers.BigNumber.from(amount.toFixed(0)),
});
const transactionResponse = await wethContract.deposit({ value: ethers.BigNumber.from(amount.toFixed(0)) });
const receipt = await transactionResponse.wait(BLOCKS_TO_WAIT);
completionCallback(receipt);
} catch (e) {
Expand Down
8 changes: 2 additions & 6 deletions blend/src/connector/WagmiProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@ const client = createClient({
new MetaMaskConnector({ chains }),
new CoinbaseWalletConnector({
chains,
options: {
appName: 'Aloe',
},
options: { appName: 'Aloe' },
}),
new WalletConnectConnector({
chains,
options: {
qrcode: true,
},
options: { qrcode: true },
}),
new InjectedConnector({
chains,
Expand Down
5 changes: 1 addition & 4 deletions blend/src/data/SiloData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,5 @@ const SiloDataMap = new Map<string, SiloData>([
export function GetSiloData(address: string): SiloData {
if (SiloDataMap.has(address)) {
return SiloDataMap.get(address)!;
} else
return {
address,
};
} else return { address };
}
5 changes: 1 addition & 4 deletions blend/src/data/TokenData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,5 @@ export function getTokens(): TokenData[] {
export function GetTokenData(address: string): TokenData {
if (TokenDataMap.has(address)) {
return TokenDataMap.get(address)!;
} else
return {
address,
};
} else return { address };
}
14 changes: 2 additions & 12 deletions blend/src/data/context/BlendPoolContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export interface IBlendPoolContext {
poolStats: BlendPoolStats | null;
}

const defaultState: IBlendPoolContext = {
poolStats: null,
};
const defaultState: IBlendPoolContext = { poolStats: null };

export const BlendPoolContext = createContext<IBlendPoolContext>(defaultState);

Expand All @@ -22,13 +20,5 @@ export type BlendPoolContextProviderProps = {
export function BlendPoolProvider(props: BlendPoolContextProviderProps) {
const blendStats = useBlendStats(props.poolData);

return (
<BlendPoolContext.Provider
value={{
poolStats: blendStats,
}}
>
{props.children}
</BlendPoolContext.Provider>
);
return <BlendPoolContext.Provider value={{ poolStats: blendStats }}>{props.children}</BlendPoolContext.Provider>;
}
4 changes: 1 addition & 3 deletions blend/src/pages/BlendPoolPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ export default function BlendPoolPage(props: BlendPoolPageProps) {
let mounted = true;
const fetchData = async (token0Address: string, token1Address: string, feeTier: FeeTier) => {
const uniswapVolumeQuery = getUniswapVolumeQuery(blockNumber, token0Address, token1Address, feeTier);
const uniswapVolumeData = await theGraphUniswapV3Client.query({
query: uniswapVolumeQuery,
});
const uniswapVolumeData = await theGraphUniswapV3Client.query({ query: uniswapVolumeQuery });

if (mounted) {
setUniswapVolume(
Expand Down
4 changes: 1 addition & 3 deletions blend/src/pages/PortfolioPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ export default function PortfolioPage() {
)) as AxiosResponse<EtherscanBalanceResponse, any>,
uniswapData: (await theGraphUniswapV2Client.query({
query: UniswapPairValueQuery,
variables: {
pairAddress: pairAddress,
},
variables: { pairAddress: pairAddress },
})) as ApolloQueryResult<UniswapV2PositionResponse>,
};
});
Expand Down
4 changes: 1 addition & 3 deletions blend/src/util/Colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ function rgb_to_hsv(rgb: number[]): number[] {
* @returns The dominant color of the image
*/
export async function getProminentColor(path: string): Promise<string> {
const colorsRGB: number[][] = (await prominent(path, {
amount: 3,
})) as number[][];
const colorsRGB: number[][] = (await prominent(path, { amount: 3 })) as number[][];
const colors = colorsRGB.map((colorRGB) => {
return {
rgb: colorRGB,
Expand Down
Loading

0 comments on commit 1f65488

Please # to comment.