diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml
index 34a33c5e..91431098 100644
--- a/.github/workflows/rainix.yaml
+++ b/.github/workflows/rainix.yaml
@@ -34,3 +34,14 @@ jobs:
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix develop -c npm run format-check
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: recursive
+ fetch-depth: 0
+
+ - uses: DeterminateSystems/nix-installer-action@main
+ - uses: DeterminateSystems/magic-nix-cache-action@main
+ - run: nix develop -c npm run lint-check
diff --git a/app/_components/SubmissionModal.tsx b/app/_components/SubmissionModal.tsx
index f7db4e6d..92c02229 100644
--- a/app/_components/SubmissionModal.tsx
+++ b/app/_components/SubmissionModal.tsx
@@ -129,7 +129,7 @@ export const SubmissionModal = ({
setError(
<>
- You don't have enough {deposit.tokenInfo.symbol} to cover this deposit.
+ You don't have enough {deposit.tokenInfo.symbol} to cover this deposit.
Your balance: {formatUnits(BigInt(balance), deposit.tokenInfo.decimals)}
@@ -426,8 +426,8 @@ export const SubmissionModal = ({
Your strategy is live!
- It will continue to trade until removed. If you're interested in creating your own
- strategies from scratch, try
Raindex.
+ It will continue to trade until removed. If you're interested in creating your
+ own strategies from scratch, try
Raindex.
`
export const getTransactionAnalyticsData = async (transactionId: string) => {
const networks = getNetworkSubgraphs();
// Find which subgraph has the transaction data by checking each subgraph
- for (let [network, subgraphUrl] of Object.entries(networks)) {
+ for (const [network, subgraphUrl] of Object.entries(networks)) {
try {
const response = await fetch(subgraphUrl, {
method: 'POST',
diff --git a/app/_services/buttonsData.ts b/app/_services/buttonsData.ts
index 1d6e91ba..db874014 100644
--- a/app/_services/buttonsData.ts
+++ b/app/_services/buttonsData.ts
@@ -66,21 +66,28 @@ export const getFieldPresetsButtons = (field: Field): any[] => {
];
};
-export const getDepositPresetsButtons = (deposit: Deposit, token: TokenInfo): any[] => {
+export const getDepositPresetsButtons = (
+ deposit: Deposit | undefined | null,
+ token: TokenInfo
+): any[] => {
+ if (!deposit) {
+ return [];
+ }
+
return [
{
buttonTarget: 'buttonValue',
buttonValue: 'back',
buttonText: '←'
},
- ...(deposit?.presets
- ? deposit.presets?.map((preset: number) => ({
+ ...(deposit.presets
+ ? deposit.presets.map((preset: number) => ({
buttonTarget: 'buttonValue',
buttonValue: `${preset}`,
buttonText: `${preset} ${token.symbol}`
}))
: []),
- ...(deposit?.min !== undefined
+ ...(deposit.min !== undefined
? [
{
buttonTarget: 'textInputLabel',
diff --git a/app/_services/getTokenInfo.tsx b/app/_services/getTokenInfo.tsx
index 907ee64e..59db9923 100644
--- a/app/_services/getTokenInfo.tsx
+++ b/app/_services/getTokenInfo.tsx
@@ -11,7 +11,7 @@ export interface TokenInfo {
}
export const getTokenInfos = async (yaml: YamlData): Promise => {
- let tokenInfos = [];
+ const tokenInfos = [];
for (const [tokenName, token] of Object.entries(yaml.tokens)) {
if (!isHex(token.address))
diff --git a/eslint.config.js b/eslint.config.js
index 2c7e686e..b8cd54fe 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -1,7 +1,7 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
-import pluginReact from 'eslint-plugin-react';
+import reactPlugin from 'eslint-plugin-react';
export default [
{
@@ -14,19 +14,10 @@ export default [
'!.env.example',
'pnpm-lock.yaml',
'package-lock.json',
- 'yarn.lock'
+ 'yarn.lock',
+ '.next'
]
},
- {
- rules: {
- 'no-console': process.env.NODE_ENV === 'production' || process.env.CI ? 'error' : 'off',
- 'no-trailing-spaces': 'error',
- eqeqeq: 'off',
- 'no-unused-vars': 'error',
- 'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
- 'react/react-in-jsx-scope': 'off'
- }
- },
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
{
@@ -43,7 +34,32 @@ export default [
}
}
},
+
pluginJs.configs.recommended,
...tseslint.configs.recommended,
- pluginReact.configs.flat.recommended
+ reactPlugin.configs.flat.recommended,
+ reactPlugin.configs.flat['jsx-runtime'],
+ {
+ rules: {
+ 'no-console':
+ process.env.NODE_ENV === 'production' || process.env.CI
+ ? ['error', { allow: ['warn', 'error'] }]
+ : 'off',
+ 'no-trailing-spaces': 'error',
+ eqeqeq: 'off',
+ 'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
+ 'react/react-in-jsx-scope': 'off',
+ 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
+ 'react/prop-types': 'off',
+ 'react/no-unknown-property': ['error', { ignore: ['tw'] }],
+ // Disabled for PRs to be merged
+ 'react/jsx-key': 'off',
+ '@typescript-eslint/no-unused-vars': 'off',
+ '@typescript-eslint/no-explicit-any': 'off',
+ '@typescript-eslint/no-empty-object-type': 'off',
+ 'no-case-declarations': 'off'
+ // 'react/no-unescaped-entities': 'off'
+ // 'no-unsafe-optional-chaining': 'off',
+ }
+ }
];
diff --git a/package.json b/package.json
index e5fc6437..9cbdbd52 100644
--- a/package.json
+++ b/package.json
@@ -64,9 +64,10 @@
"dev": "node ./scripts/dev-script.js",
"start": "next start",
"build": "next build",
- "lint": "eslint .",
+ "lint-check": "eslint .",
"lint:fix": "eslint . --fix",
"format-check": "prettier --list-different .",
- "format": "prettier --write . --config ./.prettierrc.json"
+ "format": "prettier --write . --config ./.prettierrc.json",
+ "lint-format-check": "npm run lint-check && npm run format-check"
}
}