Skip to content

Commit ff99b73

Browse files
authored
Merge pull request #14 from memoriaXII/feat/pre-commit-lint-stage
feat/pre-commit-lint-stage
2 parents d295758 + 9aba5fa commit ff99b73

File tree

4 files changed

+60
-61
lines changed

4 files changed

+60
-61
lines changed

.lintstagedrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/web/src/pages/WagmiProvider.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1+
/* eslint-disable react/react-in-jsx-scope */
12
import { ethers, providers } from 'ethers';
23
import {
34
configureChains,
45
createClient,
56
WagmiConfig,
67
defaultChains as WAGMI_SUPPORTED_CHAINS
78
} from 'wagmi';
8-
import { CoinbaseWalletConnector } from 'wagmi/connectors/coinbaseWallet';
9-
import { InjectedConnector } from 'wagmi/connectors/injected';
10-
import { MetaMaskConnector } from 'wagmi/connectors/metaMask';
11-
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect';
129
import { publicProvider } from 'wagmi/providers/public';
1310

14-
import { PLATFORM } from 'config/setting';
1511
import { getDefaultWallets } from '@rainbow-me/rainbowkit';
1612

1713
type TProps = {
@@ -42,12 +38,10 @@ export const DEFAULT_CHAIN_RPC_LINK: { [key: number]: string } = {
4238
[SupportedChainId.GOERLI]: 'https://rpc.ankr.com/eth_goerli',
4339
[SupportedChainId.POLYGON]: 'https://polygon-rpc.com',
4440
[SupportedChainId.POLYGON_MUMBAI]: 'https://rpc-endpoints.superfluid.dev/mumbai',
45-
[SupportedChainId.BSC]: 'https://bsc-dataseed.binance.org/',
46-
[SupportedChainId.BSC_TESTNET]:
47-
'https://speedy-nodes-nyc.moralis.io/dc678d041ec4263c972bc90f/bsc/testnet'
41+
[SupportedChainId.BSC]: 'https://bsc-dataseed.binance.org/'
4842
};
4943

50-
const WagmiProvider: React.FC<TProps> = ({ children }) => {
44+
const WagmiProvider: React.FC<TProps> = ({ children }: any) => {
5145
const supportedChains = [...WAGMI_SUPPORTED_CHAINS];
5246

5347
const { chains, provider } = configureChains(supportedChains, [publicProvider()]);
@@ -56,7 +50,6 @@ const WagmiProvider: React.FC<TProps> = ({ children }) => {
5650
appName: 'My RainbowKit App',
5751
chains
5852
});
59-
6053
const client = createClient({
6154
autoConnect: true,
6255
connectors,
@@ -72,6 +65,7 @@ const WagmiProvider: React.FC<TProps> = ({ children }) => {
7265
].includes(chainId)
7366
) {
7467
if (window.ethereum && window.ethereum.isMetaMask) {
68+
// @ts-ignore
7569
return new ethers.providers.Web3Provider(window.ethereum, chainId);
7670
}
7771

packages/config/eslint-next.js

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,65 @@
11
module.exports = {
22
env: {
33
browser: true,
4-
es2021: true
4+
node: true
55
},
6+
extends: [
7+
'next',
8+
'airbnb',
9+
'airbnb-typescript',
10+
'plugin:import/recommended',
11+
'plugin:import/typescript',
12+
'prettier'
13+
],
14+
plugins: ['@typescript-eslint', 'import'],
615
settings: {
7-
react: {
8-
version: 'detect'
16+
next: {
17+
rootDir: ['apps/*/', 'packages/*/']
18+
},
19+
'import/parsers': {
20+
'@typescript-eslint/parser': ['.ts', '.tsx']
921
},
1022
'import/resolver': {
11-
node: {
12-
extensions: ['.js', '.ts', '.tsx']
23+
typescript: {
24+
alwaysTryTypes: true,
25+
project: ['apps/*/tsconfig.json']
1326
}
14-
},
15-
'import/extensions': ['.js', '.ts', '.tsx']
16-
},
17-
extends: [
18-
'plugin:react/recommended',
19-
'plugin:react-hooks/recommended',
20-
'airbnb-typescript',
21-
'plugin:prettier/recommended'
22-
],
23-
parser: '@typescript-eslint/parser',
24-
parserOptions: {
25-
ecmaVersion: 2018,
26-
sourceType: 'module',
27-
project: './tsconfig.json',
28-
tsconfigRootDir: __dirname,
29-
ecmaFeatures: {
30-
jsx: true
3127
}
3228
},
33-
plugins: ['import', 'react', '@typescript-eslint', 'prettier'],
34-
ignorePatterns: ['src/**/*.svg', '**/node_modules/**'],
3529
rules: {
36-
'consistent-return': 0,
37-
'function-paren-newline': 0,
38-
'object-curly-newline': 0,
39-
'react/prop-types': 0,
40-
'react/jsx-filename-extension': 0,
41-
'react/react-in-jsx-scope': 0,
42-
'react/jsx-one-expression-per-line': 0,
43-
'react/jsx-props-no-spreading': 0,
44-
'react/jsx-closing-bracket-location': 0,
45-
'react/no-unescaped-entities': 0,
46-
'import/prefer-default-export': 0,
47-
'implicit-arrow-linebreak': 0,
48-
'jest/no-mocks-import': 0,
49-
'prettier/prettier': 'error',
50-
'no-unused-vars': ['error', { vars: 'all', args: 'none', ignoreRestSiblings: true }],
51-
'@typescript-eslint/comma-dangle': 0,
52-
'@typescript-eslint/no-use-before-define': 0,
53-
'@typescript-eslint/indent': 0
54-
}
30+
// react
31+
'react/function-component-definition': [
32+
2,
33+
{
34+
namedComponents: 'arrow-function'
35+
}
36+
],
37+
38+
// next
39+
'@next/next/no-html-link-for-pages': 'off'
40+
},
41+
overrides: [
42+
{
43+
// 3) Now we enable eslint-plugin-testing-library rules or preset only for matching files!
44+
env: {
45+
jest: true
46+
},
47+
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
48+
extends: ['plugin:testing-library/react', 'plugin:jest/recommended'],
49+
rules: {
50+
'import/no-extraneous-dependencies': ['off', { devDependencies: ['**/?(*.)+(spec|test).[jt]s?(x)'] }]
51+
}
52+
}
53+
],
54+
ignorePatterns: [
55+
'**/*.js',
56+
'**/*.json',
57+
'node_modules',
58+
'public',
59+
'styles',
60+
'.next',
61+
'coverage',
62+
'dist',
63+
'.turbo'
64+
]
5565
};

packages/config/jest-next.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module.exports = {
66
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
77
transform: {
88
'^.+\\.tsx?$': 'esbuild-jest',
9-
'^.+\\.jsx?$': 'esbuild-jest',
9+
'^.+\\.jsx?$': 'esbuild-jest'
1010
},
1111
coveragePathIgnorePatterns: [],
12-
coverageThreshold: null,
13-
}
12+
coverageThreshold: null
13+
};

0 commit comments

Comments
 (0)