Skip to content

Commit c788e76

Browse files
committed
chore: fix the linting after rebase
1 parent 14cb2a5 commit c788e76

19 files changed

Lines changed: 688 additions & 562 deletions

.babelrc

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
2-
"presets": [
3-
["@babel/env", {
4-
"modules": false,
5-
"useBuiltIns": "usage",
6-
"corejs": "3"
7-
}],
8-
"@babel/react",
9-
"@babel/typescript"
10-
]
2+
"presets": [
3+
[
4+
"@babel/env",
5+
{
6+
"modules": false,
7+
"useBuiltIns": "usage",
8+
"corejs": "3"
9+
}
10+
],
11+
"@babel/react",
12+
"@babel/typescript"
13+
]
1114
}

.prettierrc.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module.exports = {
2-
printWidth: 120,
3-
tabWidth: 2,
4-
useTabs: false,
5-
semi: true,
6-
singleQuote: false,
7-
quoteProps: "as-needed",
8-
trailingComma: "es5",
9-
bracketSpacing: false,
10-
arrowParens: "always",
11-
};
2+
printWidth: 120,
3+
tabWidth: 2,
4+
useTabs: false,
5+
semi: true,
6+
singleQuote: false,
7+
quoteProps: "as-needed",
8+
trailingComma: "es5",
9+
bracketSpacing: false,
10+
arrowParens: "always",
11+
};

biome.jsonc

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"vcs": {
4+
"defaultBranch": "master"
5+
},
6+
"extends": ["@chainsafe/biomejs-config", "@chainsafe/biomejs-config/recommended", "@chainsafe/biomejs-config/esm"],
7+
"files": {
8+
"include": ["src/**/*.tsx"]
9+
},
10+
"linter": {
11+
"rules": {
12+
"suspicious": {
13+
"noConsoleLog": "off"
14+
},
15+
"style": {
16+
// Our team does not like this syntax
17+
// https://github.com/ChainSafe/ssz/pull/475#discussion_r1995814916
18+
"useNumberNamespace": "off",
19+
// TODO: There are two many usages, will fix in separate PR
20+
"noParameterAssign": "off",
21+
// We use to export types and object without differentiating
22+
"useExportType": "off",
23+
// We use to import types and object without differentiating
24+
"useImportType": "off",
25+
// We have a lot of enum members in camelCase, so we have to update
26+
// the base naming convention to allow camelCase in addition to PascalCase
27+
"useNamingConvention": {
28+
"level": "error",
29+
"options": {
30+
"requireAscii": true,
31+
"strictCase": false,
32+
"conventions": [
33+
{
34+
"selector": {
35+
"kind": "enumMember"
36+
},
37+
"formats": ["camelCase", "PascalCase"]
38+
}
39+
]
40+
}
41+
}
42+
}
43+
}
44+
},
45+
"overrides": [
46+
{
47+
"include": ["src/**/*.tsx"],
48+
"linter": {
49+
"rules": {
50+
// Disable all accessibility rules for React files
51+
"a11y": {
52+
"useValidAnchor": "off",
53+
"noLabelWithoutControl": "off",
54+
"useButtonType": "off",
55+
"useKeyWithClickEvents": "off",
56+
"useAnchorContent": "off",
57+
"useAltText": "off"
58+
}
59+
}
60+
},
61+
// Add JSX support for React files
62+
"javascript": {
63+
"globals": ["JSX"]
64+
}
65+
}
66+
]
67+
}

package.json

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
{
2-
"private": true,
3-
"name": "simpleserialize.com",
4-
"version": "0.3.2",
5-
"repository": "https://github.com/chainsafe/simpleserialize.com",
6-
"author": "Chainsafe Systems",
7-
"license": "MIT",
8-
"scripts": {
9-
"clean": "rm -rf ./dist",
10-
"check-types": "tsc",
11-
"dev": "cross-env NODE_ENV=development webpack serve --color --progress",
12-
"build": "cross-env NODE_ENV=production webpack --color --progress",
13-
"start": "serve dist",
14-
"lint": "biome check",
15-
"lint:fix": "biome check --write"
16-
},
17-
"dependencies": {
18-
"@babel/runtime": "^7.14.6",
19-
"@babel/types": "^7.14.5",
20-
"@chainsafe/ssz": "1.2.1",
21-
"@lodestar/types": "^1.29.0",
22-
"bn.js": "^5.2.0",
23-
"bulma": "^0.9.3",
24-
"core-js": "^3.15.2",
25-
"eyzy-tree": "^0.2.2",
26-
"file-saver": "^2.0.5",
27-
"js-yaml": "^4.1.0",
28-
"react": "^17.0.2",
29-
"react-alert": "^7.0.1",
30-
"react-alert-template-basic": "^1.0.0",
31-
"react-dom": "^17.0.2",
32-
"react-loading-overlay": "^1.0.1",
33-
"react-spinners": "^0.8.3",
34-
"threads": "^1.6.5"
35-
},
36-
"devDependencies": {
37-
"@babel/cli": "^7.14.6",
38-
"@babel/core": "^7.14.6",
39-
"@babel/preset-env": "^7.14.7",
40-
"@babel/preset-react": "^7.14.5",
41-
"@babel/preset-typescript": "^7.14.5",
42-
"@babel/register": "^7.15.3",
43-
"@biomejs/biome": "^1.9.4",
44-
"@chainsafe/biomejs-config": "^0.1.0",
45-
"@types/bn.js": "^5.1.0",
46-
"@types/deep-equal": "^1.0.1",
47-
"@types/file-saver": "^2.0.2",
2+
"private": true,
3+
"name": "simpleserialize.com",
4+
"version": "0.3.2",
5+
"repository": "https://github.com/chainsafe/simpleserialize.com",
6+
"author": "Chainsafe Systems",
7+
"license": "MIT",
8+
"scripts": {
9+
"clean": "rm -rf ./dist",
10+
"check-types": "tsc",
11+
"dev": "cross-env NODE_ENV=development webpack serve --color --progress",
12+
"build": "cross-env NODE_ENV=production webpack --color --progress",
13+
"start": "serve dist",
14+
"lint": "biome check",
15+
"lint:fix": "biome check --write"
16+
},
17+
"dependencies": {
18+
"@babel/runtime": "^7.14.6",
19+
"@babel/types": "^7.14.5",
20+
"@chainsafe/ssz": "1.2.1",
21+
"@lodestar/types": "^1.29.0",
22+
"bn.js": "^5.2.0",
23+
"bulma": "^0.9.3",
24+
"core-js": "^3.15.2",
25+
"eyzy-tree": "^0.2.2",
26+
"file-saver": "^2.0.5",
27+
"js-yaml": "^4.1.0",
28+
"react": "^17.0.2",
29+
"react-alert": "^7.0.1",
30+
"react-alert-template-basic": "^1.0.0",
31+
"react-dom": "^17.0.2",
32+
"react-loading-overlay": "^1.0.1",
33+
"react-spinners": "^0.8.3",
34+
"threads": "^1.6.5"
35+
},
36+
"devDependencies": {
37+
"@babel/cli": "^7.14.6",
38+
"@babel/core": "^7.14.6",
39+
"@babel/preset-env": "^7.14.7",
40+
"@babel/preset-react": "^7.14.5",
41+
"@babel/preset-typescript": "^7.14.5",
42+
"@babel/register": "^7.15.3",
43+
"@biomejs/biome": "^1.9.4",
44+
"@chainsafe/biomejs-config": "^0.1.0",
45+
"@types/bn.js": "^5.1.0",
46+
"@types/deep-equal": "^1.0.1",
47+
"@types/file-saver": "^2.0.2",
4848
"@types/node": "^22.10.2",
49-
"@types/react": "^17.0.35",
50-
"@types/react-alert": "^5.2.1",
51-
"@types/react-dom": "^17.0.25",
52-
"@types/react-loading-overlay": "^1.0.0",
53-
"babel-loader": "^8.2.2",
54-
"buffer": "^6.0.3",
55-
"cross-env": "^7.0.3",
56-
"css-loader": "^5.2.6",
57-
"html-webpack-plugin": "^5.3.2",
58-
"mini-css-extract-plugin": "^2.1.0",
59-
"process": "^0.11.10",
60-
"sass": "^1.72.0",
61-
"sass-loader": "^14.1.1",
62-
"serve": "^12.0.0",
63-
"style-loader": "^3.0.0",
64-
"ts-loader": "^9.5.1",
65-
"ts-node": "^10.9.2",
66-
"typescript": "~5.8.3",
67-
"threads-webpack-plugin": "^1.0.8",
68-
"webpack": "^5.75.0",
69-
"webpack-cli": "^5.0.1",
70-
"webpack-dev-server": "^5.2.0",
71-
"workerize-loader": "^1.3.0"
72-
}
49+
"@types/react": "^17.0.35",
50+
"@types/react-alert": "^5.2.1",
51+
"@types/react-dom": "^17.0.25",
52+
"@types/react-loading-overlay": "^1.0.0",
53+
"babel-loader": "^8.2.2",
54+
"buffer": "^6.0.3",
55+
"cross-env": "^7.0.3",
56+
"css-loader": "^5.2.6",
57+
"html-webpack-plugin": "^5.3.2",
58+
"mini-css-extract-plugin": "^2.1.0",
59+
"process": "^0.11.10",
60+
"sass": "^1.72.0",
61+
"sass-loader": "^14.1.1",
62+
"serve": "^12.0.0",
63+
"style-loader": "^3.0.0",
64+
"ts-loader": "^9.5.1",
65+
"ts-node": "^10.9.2",
66+
"typescript": "~5.8.3",
67+
"threads-webpack-plugin": "^1.0.8",
68+
"webpack": "^5.75.0",
69+
"webpack-cli": "^5.0.1",
70+
"webpack-dev-server": "^5.2.0",
71+
"workerize-loader": "^1.3.0"
72+
}
7373
}

src/components/Input.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import {Type, toHexString} from "@chainsafe/ssz";
1+
import {type Type, toHexString} from "@chainsafe/ssz";
22
import * as React from "react";
3-
import {ChangeEvent} from "react";
4-
import {AlertManager, withAlert} from "react-alert";
5-
import {ModuleThread, Thread, Worker, spawn} from "threads";
3+
import type {ChangeEvent} from "react";
4+
import {type AlertManager, withAlert} from "react-alert";
5+
import {type ModuleThread, Thread, type Worker, spawn} from "threads";
66

77
import {inputTypes} from "../util/input_types";
8-
import {ForkName, forks, typeNames} from "../util/types";
9-
import {SszWorker} from "./worker";
8+
import {type ForkName, forks, typeNames} from "../util/types";
9+
import type {SszWorker} from "./worker";
1010

1111
const initialType = "BeaconBlock";
1212

src/components/Output.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from "react";
33
import ErrorBox from "./display/ErrorBox";
44
import NamedOutput from "./display/NamedOutput";
55

6-
import {Type} from "@chainsafe/ssz";
6+
import type {Type} from "@chainsafe/ssz";
77
import {deserializeOutputTypes, serializeOutputTypes} from "../util/output_types";
88

99
type Props<T> = {

src/components/Serialize.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import {Type} from "@chainsafe/ssz";
1+
import type {Type} from "@chainsafe/ssz";
22
import * as React from "react";
33
import LoadingOverlay from "react-loading-overlay";
44
import BounceLoader from "react-spinners/BounceLoader";
5-
import {ModuleThread, Thread, Worker, spawn} from "threads";
6-
import {ForkName} from "../util/types";
5+
import {type ModuleThread, Thread, Worker, spawn} from "threads";
6+
import type {ForkName} from "../util/types";
77
import Input from "./Input";
88
import Output from "./Output";
9-
import {SszWorker} from "./worker";
9+
import type {SszWorker} from "./worker";
1010

1111
type Props = {
1212
serializeModeOn: boolean;

src/components/TreeView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @ts-nocheck
44

55
import {
6-
Type,
6+
type Type,
77
isBitListType,
88
isBitVectorType,
99
isBooleanType,
@@ -18,8 +18,8 @@ import BN from "bn.js";
1818
// @ts-ignore
1919
import EyzyTree from "eyzy-tree";
2020
import * as React from "react";
21-
import {Node as SSZNode, getChildNodes, getRootNode, isBottomType} from "../util/partials";
22-
import {ForkName, forks} from "../util/types";
21+
import {type Node as SSZNode, getChildNodes, getRootNode, isBottomType} from "../util/partials";
22+
import {type ForkName, forks} from "../util/types";
2323

2424
function getTypeName<T>(type: Type<T>, _types: Record<string, Type<T>>, name: string): string | undefined {
2525
if (isBooleanType(type)) return "bool";

src/components/worker/helpers.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import {Type} from "@chainsafe/ssz";
2-
import {forks} from "../../util/types";
1+
import type { Type } from "@chainsafe/ssz";
2+
import { forks } from "../../util/types";
33

44
// type primitiveType = boolean | number | bigint | Uint8Array | Array<boolean> | object | undefined;
55

66
export function createRandomValue(type: Type<unknown>): unknown {
7-
return type.defaultValue();
7+
return type.defaultValue();
88
}
99

10-
export function getSSZType(sszTypeName: string, forkName: string): Type<unknown> {
11-
return forks[forkName][sszTypeName];
10+
export function getSSZType(
11+
sszTypeName: string,
12+
forkName: string,
13+
): Type<unknown> {
14+
return forks[forkName][sszTypeName];
1215
}

src/components/worker/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import {expose} from "threads/worker";
2-
import {createRandomValue, getSSZType} from "./helpers";
1+
import { expose } from "threads/worker";
2+
import { createRandomValue, getSSZType } from "./helpers";
33

44
const worker = {
5-
createRandomValue(sszTypeName: string, forkName: string) {
6-
const type = getSSZType(sszTypeName, forkName);
7-
const value = createRandomValue(type);
8-
return value;
9-
},
10-
serialize(sszTypeName: string, forkName: string, input: unknown) {
11-
const type = getSSZType(sszTypeName, forkName);
12-
const serialized = type.serialize(input);
13-
const root = type.hashTreeRoot(input);
14-
return {serialized, root};
15-
},
5+
createRandomValue(sszTypeName: string, forkName: string) {
6+
const type = getSSZType(sszTypeName, forkName);
7+
const value = createRandomValue(type);
8+
return value;
9+
},
10+
serialize(sszTypeName: string, forkName: string, input: unknown) {
11+
const type = getSSZType(sszTypeName, forkName);
12+
const serialized = type.serialize(input);
13+
const root = type.hashTreeRoot(input);
14+
return { serialized, root };
15+
},
1616
};
1717

1818
export type SszWorker = typeof worker;

0 commit comments

Comments
 (0)