Skip to content

Commit f964a03

Browse files
committed
chore: update-prettier-eslint
1 parent 32fbbfb commit f964a03

File tree

6 files changed

+338
-169
lines changed

6 files changed

+338
-169
lines changed

kleros-app/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"clean": "rm -rf dist",
1111
"start": "parcel src/index.html",
1212
"build": "yarn clear & yarn clean & yarn parcel build",
13-
"check-style": "eslint 'src/**/*.{ts,tsx}' -fix",
13+
"check-style": "eslint 'src/**/*.{ts,tsx}'",
1414
"check-types": "tsc --noEmit"
1515
},
1616
"repository": {
@@ -41,8 +41,11 @@
4141
"@kleros/kleros-v2-prettier-config": "workspace:^",
4242
"@types/react": "^18.3.12",
4343
"@types/react-dom": "^18.3.1",
44+
"@typescript-eslint/eslint-plugin": "^8.15.0",
45+
"@typescript-eslint/parser": "^8.15.0",
4446
"eslint": "^9.14.0",
4547
"eslint-config-prettier": "^9.1.0",
48+
"eslint-plugin-import": "^2.31.0",
4649
"globals": "^15.12.0",
4750
"parcel": "^2.12.0",
4851
"typescript": "^5.6.3"

prettier-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"dependencies": {
77
"eslint": "^8.57.1",
8-
"prettier": "^2.8.8",
8+
"prettier": "^3.3.3",
99
"prettier-plugin-solidity": "^1.3.1"
1010
},
1111
"scripts": {

web/.eslintrc.json

-156
This file was deleted.

web/eslint.config.mjs

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2+
import react from "eslint-plugin-react";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import security from "eslint-plugin-security";
5+
import _import from "eslint-plugin-import";
6+
import globals from "globals";
7+
import tsParser from "@typescript-eslint/parser";
8+
import path from "node:path";
9+
import { fileURLToPath } from "node:url";
10+
import js from "@eslint/js";
11+
import { FlatCompat } from "@eslint/eslintrc";
12+
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = path.dirname(__filename);
15+
const compat = new FlatCompat({
16+
baseDirectory: __dirname,
17+
recommendedConfig: js.configs.recommended,
18+
allConfig: js.configs.all,
19+
});
20+
21+
export default [
22+
{
23+
ignores: ["src/assets"],
24+
},
25+
...fixupConfigRules(
26+
compat.extends(
27+
"eslint:recommended",
28+
"plugin:react/recommended",
29+
"plugin:react-hooks/recommended",
30+
"plugin:import/recommended",
31+
"plugin:import/react",
32+
"plugin:@typescript-eslint/recommended",
33+
"plugin:prettier/recommended",
34+
"prettier"
35+
)
36+
),
37+
{
38+
plugins: {
39+
react: fixupPluginRules(react),
40+
"react-hooks": fixupPluginRules(reactHooks),
41+
security: fixupPluginRules(security),
42+
import: fixupPluginRules(_import),
43+
},
44+
45+
languageOptions: {
46+
globals: {
47+
...globals.browser,
48+
...globals.node,
49+
Atomics: "readonly",
50+
SharedArrayBuffer: "readonly",
51+
},
52+
53+
parser: tsParser,
54+
ecmaVersion: 2020,
55+
sourceType: "module",
56+
57+
parserOptions: {
58+
ecmaFeatures: {
59+
jsx: true,
60+
},
61+
},
62+
},
63+
64+
settings: {
65+
react: {
66+
version: "^16.12.0",
67+
},
68+
69+
"import/resolver": {
70+
typescript: {
71+
project: "./tsconfig.json",
72+
},
73+
},
74+
},
75+
76+
rules: {
77+
"max-len": [
78+
"warn",
79+
{
80+
code: 120,
81+
},
82+
],
83+
84+
"react/prop-types": 0,
85+
"no-unused-vars": "off",
86+
87+
"@typescript-eslint/no-unused-vars": [
88+
"error",
89+
{
90+
varsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
91+
argsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)",
92+
},
93+
],
94+
95+
"no-console": [
96+
"error",
97+
{
98+
allow: ["warn", "error", "info", "debug"],
99+
},
100+
],
101+
102+
"@typescript-eslint/no-non-null-assertion": "off",
103+
"@typescript-eslint/no-explicit-any": "off",
104+
"security/detect-object-injection": "off",
105+
"security/detect-non-literal-fs-filename": "off",
106+
107+
"import/extensions": [
108+
"error",
109+
"ignorePackages",
110+
{
111+
js: "never",
112+
jsx: "never",
113+
ts: "never",
114+
tsx: "never",
115+
},
116+
],
117+
118+
"import/no-unresolved": "off",
119+
120+
"import/order": [
121+
"warn",
122+
{
123+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
124+
125+
pathGroups: [
126+
{
127+
pattern: "{react,styled-components}",
128+
group: "external",
129+
position: "before",
130+
},
131+
{
132+
pattern: "@kleros/**",
133+
group: "external",
134+
position: "after",
135+
},
136+
{
137+
pattern: "{svgs/**,assets/**}",
138+
group: "internal",
139+
position: "after",
140+
},
141+
{
142+
pattern: "{hooks/**,utils/**,consts/**,types/**,context/**,connectors/**,}",
143+
group: "internal",
144+
position: "after",
145+
},
146+
{
147+
pattern: "{queries/**,}",
148+
group: "internal",
149+
position: "after",
150+
},
151+
{
152+
pattern: "{src/**,}",
153+
group: "internal",
154+
position: "after",
155+
},
156+
{
157+
pattern: "{styles/**,}",
158+
group: "internal",
159+
position: "after",
160+
},
161+
{
162+
pattern: "{layout/**,pages/**,components/**,}",
163+
group: "internal",
164+
position: "after",
165+
},
166+
],
167+
168+
pathGroupsExcludedImportTypes: ["builtin"],
169+
"newlines-between": "always",
170+
171+
alphabetize: {
172+
order: "asc",
173+
caseInsensitive: true,
174+
},
175+
},
176+
],
177+
},
178+
},
179+
];

web/package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"prettier": "@kleros/kleros-v2-prettier-config",
4949
"devDependencies": {
50+
"@eslint/compat": "^1.2.3",
51+
"@eslint/eslintrc": "^3.2.0",
52+
"@eslint/js": "^9.15.0",
5053
"@graphql-codegen/cli": "^4.0.1",
5154
"@graphql-codegen/client-preset": "^4.2.0",
5255
"@kleros/kleros-v2-eslint-config": "workspace:^",
@@ -56,15 +59,17 @@
5659
"@types/react": "18.2.0",
5760
"@types/react-dom": "^18.2.18",
5861
"@types/styled-components": "^5.1.34",
59-
"@typescript-eslint/eslint-plugin": "^8.8.1",
60-
"@typescript-eslint/parser": "^8.8.1",
62+
"@typescript-eslint/eslint-plugin": "^8.15.0",
63+
"@typescript-eslint/parser": "^8.15.0",
6164
"@typescript-eslint/utils": "^8.8.1",
6265
"@wagmi/cli": "^2.1.16",
63-
"eslint": "^8.57.1",
66+
"eslint": "^9.15.0",
6467
"eslint-config-prettier": "^9.1.0",
6568
"eslint-import-resolver-typescript": "^3.6.3",
69+
"eslint-plugin-import": "^2.31.0",
6670
"eslint-plugin-react": "^7.37.1",
6771
"eslint-plugin-react-hooks": "^4.6.2",
72+
"globals": "^15.12.0",
6873
"lru-cache": "^7.18.3",
6974
"typescript": "^5.3.3",
7075
"vite": "^5.4.2",

0 commit comments

Comments
 (0)