Skip to content

Commit

Permalink
Merge branch '436-establish-a-global-eslint-configuration-file-at-the…
Browse files Browse the repository at this point in the history
…-root-level' into 'dev'

Resolve "Establish a global ESLint configuration file at the root level"

Closes #436

See merge request ergo/rosen-bridge/ui!361
  • Loading branch information
vorujack committed Nov 25, 2024
2 parents aab8cd5 + 8f4c751 commit ef3678b
Show file tree
Hide file tree
Showing 89 changed files with 2,665 additions and 2,301 deletions.
2 changes: 2 additions & 0 deletions .changeset/slow-trainers-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
1 change: 0 additions & 1 deletion apps/guard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@types/react-dom": "18.2.4",
"eslint": "8.42.0",
"eslint-config-next": "13.4.4",
"eslint-config-prettier": "^9.0.0",
"lint-staged": "^13.2.2",
"prettier": "^3.0.2",
"typescript": "^5.3.3"
Expand Down
1 change: 0 additions & 1 deletion apps/rosen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"@types/react-dom": "18.2.4",
"eslint": "8.42.0",
"eslint-config-next": "^14.0.0",
"eslint-config-prettier": "^9.0.0",
"lint-staged": "^13.2.2",
"prettier": "^3.0.2",
"typescript": "^5.1.6"
Expand Down
1 change: 0 additions & 1 deletion apps/watcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"@types/react-dom": "18.2.4",
"eslint": "8.42.0",
"eslint-config-next": "13.4.4",
"eslint-config-prettier": "^9.0.0",
"lint-staged": "^13.2.2",
"prettier": "^3.0.2",
"typescript": "^5.3.3"
Expand Down
81 changes: 81 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import globals from 'globals';
import pluginJs from '@eslint/js';
import typescriptParser from '@typescript-eslint/parser';
import prettier from 'eslint-config-prettier';
import reactRefresh from 'eslint-plugin-react-refresh';
import reactHooks from 'eslint-plugin-react-hooks';

export default [
{
ignores: ['**/dist/*'],
},
{
files: [
'networks/**/*.{js,jsx,ts,tsx}',
'packages/**/*.{js,jsx,ts,tsx}',
'wallets/**/*.{js,jsx,ts,tsx}',
],
rules: {
...pluginJs.configs.recommended.rules,
...typescriptEslint.configs.recommended.rules,
},
plugins: {
'@typescript-eslint': typescriptEslint,
},
languageOptions: {
parser: typescriptParser,
ecmaVersion: 'latest',
sourceType: 'module',
},
},
{
files: [
'networks/**/*.{js,jsx,ts,tsx}',
'packages/asset-calculator/**/*.{js,jsx,ts,tsx}',
],
languageOptions: {
globals: globals.node,
},
},
{
files: [
'packages/common-hooks/**/*.{js,jsx,ts,tsx}',
'packages/constants/**/*.{js,jsx,ts,tsx}',
'packages/icons/**/*.{js,jsx,ts,tsx}',
'packages/swr-helpers/**/*.{js,jsx,ts,tsx}',
'packages/swr-mock/**/*.{js,jsx,ts,tsx}',
'packages/types/**/*.{js,jsx,ts,tsx}',
'packages/utils/**/*.{js,jsx,ts,tsx}',
'wallets/**/*.{js,jsx,ts,tsx}',
],
languageOptions: {
globals: globals.browser,
},
},
{
files: [
'packages/shared-contexts/**/*.{js,jsx,ts,tsx}',
'packages/ui-kit/**/*.{js,jsx,ts,tsx}',
],
plugins: {
'react-refresh': reactRefresh,
'react-hooks': reactHooks,
},
rules: {
'react-refresh/only-export-components': 'warn',
...reactHooks.configs.recommended.rules,
},
},
/**
* TODO: revise the global ESLint configuration rules
* local:ergo/rosen-bridge/ui#442
*/
{
rules: {
'no-undef': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
},
prettier,
];
1 change: 0 additions & 1 deletion networks/bitcoin/.eslintignore

This file was deleted.

11 changes: 0 additions & 11 deletions networks/bitcoin/.eslintrc.json

This file was deleted.

5 changes: 0 additions & 5 deletions networks/bitcoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
"bitcoinjs-lib": "^6.1.6"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.26.0",
"eslint": "^8.16.0",
"eslint-config-prettier": "^9.0.0",
"prettier": "^3.0.2",
"typescript": "^5.0.0"
}
}
28 changes: 19 additions & 9 deletions networks/bitcoin/unitTests/src/generateTx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ describe('generateUnsignedTx', () => {
fromAddress,
amount,
data,
{} as any
/**
* TODO: remove the inline ESLint comment
* local:ergo/rosen-bridge/ui#441
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
{} as any,
);

const psbt = Psbt.fromBase64(result.psbt);
Expand All @@ -61,7 +66,7 @@ describe('generateUnsignedTx', () => {
expect(psbt.inputCount).toEqual(1);
const mockedInput = testData.mockedUtxos[0];
expect(psbt.txInputs[0].hash.reverse().toString('hex')).toEqual(
mockedInput.txId
mockedInput.txId,
);
expect(psbt.txInputs[0].index).toEqual(mockedInput.index);

Expand All @@ -70,7 +75,7 @@ describe('generateUnsignedTx', () => {
expect(opReturnUtxo.script.toString('hex')).toEqual(
'6a' + // OP_RETURN
(data.length / 2).toString(16).padStart(2, '0') +
data
data,
);
expect(opReturnUtxo.value).toEqual(0);
const lockUtxo = psbt.txOutputs[1];
Expand All @@ -80,7 +85,7 @@ describe('generateUnsignedTx', () => {
expect(changeUtxo.address).toEqual(fromAddress);
const expectedFee = 203n;
expect(changeUtxo.value).toEqual(
Number(mockedInput.value - amount - expectedFee)
Number(mockedInput.value - amount - expectedFee),
);
});

Expand Down Expand Up @@ -120,7 +125,7 @@ describe('generateUnsignedTx', () => {
fromAddress,
wrappedAmount,
data,
token
token,
);

const psbt = Psbt.fromBase64(result.psbt);
Expand All @@ -129,7 +134,7 @@ describe('generateUnsignedTx', () => {
expect(psbt.inputCount).toEqual(1);
const mockedInput = testData.mockedUtxos[0];
expect(psbt.txInputs[0].hash.reverse().toString('hex')).toEqual(
mockedInput.txId
mockedInput.txId,
);
expect(psbt.txInputs[0].index).toEqual(mockedInput.index);

Expand All @@ -138,7 +143,7 @@ describe('generateUnsignedTx', () => {
expect(opReturnUtxo.script.toString('hex')).toEqual(
'6a' + // OP_RETURN
(data.length / 2).toString(16).padStart(2, '0') +
data
data,
);
expect(opReturnUtxo.value).toEqual(0);
const lockUtxo = psbt.txOutputs[1];
Expand All @@ -148,7 +153,7 @@ describe('generateUnsignedTx', () => {
expect(changeUtxo.address).toEqual(fromAddress);
const expectedFee = 203n;
expect(changeUtxo.value).toEqual(
Number(mockedInput.value - unwrappedAmount - expectedFee)
Number(mockedInput.value - unwrappedAmount - expectedFee),
);
});

Expand All @@ -175,7 +180,12 @@ describe('generateUnsignedTx', () => {
fromAddress,
amount,
data,
{} as any
/**
* TODO: remove the inline ESLint comment
* local:ergo/rosen-bridge/ui#441
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
{} as any,
);
}).rejects.toThrow(Error);
});
Expand Down
1 change: 0 additions & 1 deletion networks/cardano/.eslintignore

This file was deleted.

11 changes: 0 additions & 11 deletions networks/cardano/.eslintrc.json

This file was deleted.

5 changes: 0 additions & 5 deletions networks/cardano/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
"@rosen-ui/wallet-api": "^1.0.3"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.26.0",
"eslint": "^8.16.0",
"eslint-config-prettier": "^9.0.0",
"prettier": "^3.0.2",
"typescript": "^5.0.0"
}
}
1 change: 0 additions & 1 deletion networks/ergo/.eslintignore

This file was deleted.

11 changes: 0 additions & 11 deletions networks/ergo/.eslintrc.json

This file was deleted.

5 changes: 0 additions & 5 deletions networks/ergo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
"ergo-lib-wasm-nodejs": "^0.24.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.26.0",
"eslint": "^8.16.0",
"eslint-config-prettier": "^9.0.0",
"prettier": "^3.0.2",
"typescript": "^5.0.0"
}
}
Loading

0 comments on commit ef3678b

Please sign in to comment.