Skip to content

Commit d90dea8

Browse files
committed
update deps
1 parent 2fa0629 commit d90dea8

File tree

8 files changed

+467
-406
lines changed

8 files changed

+467
-406
lines changed

eslint-plugin-ts-compat.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import tsEslintPlugin from "@typescript-eslint/eslint-plugin";
2+
3+
const baseRule = tsEslintPlugin.rules["consistent-generic-constructors"];
4+
5+
const consistentGenericConstructors = {
6+
meta: baseRule.meta,
7+
create(context) {
8+
const proxyContext = Object.create(context);
9+
proxyContext.parserOptions = {
10+
isolatedDeclarations: false,
11+
...(context.parserOptions ?? {}),
12+
};
13+
return baseRule.create(proxyContext);
14+
},
15+
};
16+
17+
export default {
18+
rules: {
19+
"consistent-generic-constructors": consistentGenericConstructors,
20+
},
21+
};

eslint.config.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import path from "node:path";
2+
import { fileURLToPath } from "node:url";
3+
import js from "@eslint/js";
4+
import importPlugin from "eslint-plugin-import";
5+
import prettierPlugin from "eslint-plugin-prettier";
6+
import unusedImports from "eslint-plugin-unused-imports";
7+
import globals from "globals";
8+
import tseslint from "typescript-eslint";
9+
import tsCompat from "./eslint-plugin-ts-compat.js";
10+
11+
const projectRoot = path.dirname(fileURLToPath(import.meta.url));
12+
13+
export default [
14+
{
15+
ignores: ["coverage/", "dist/", "testdata/"],
16+
},
17+
js.configs.recommended,
18+
...tseslint.configs.recommended.map(config => ({
19+
...config,
20+
files: ["**/*.ts", "**/*.tsx"],
21+
languageOptions: {
22+
...config.languageOptions,
23+
parser: tseslint.parser,
24+
parserOptions: {
25+
project: "./tsconfig.eslint.json",
26+
tsconfigRootDir: projectRoot,
27+
},
28+
},
29+
})),
30+
...tseslint.configs.stylistic.map(config => ({
31+
...config,
32+
files: ["**/*.ts", "**/*.tsx"],
33+
languageOptions: {
34+
...config.languageOptions,
35+
parser: tseslint.parser,
36+
parserOptions: {
37+
project: "./tsconfig.eslint.json",
38+
tsconfigRootDir: projectRoot,
39+
},
40+
},
41+
})),
42+
{
43+
files: ["**/*.ts", "**/*.tsx"],
44+
languageOptions: {
45+
parser: tseslint.parser,
46+
parserOptions: {
47+
project: "./tsconfig.eslint.json",
48+
tsconfigRootDir: projectRoot,
49+
},
50+
globals: {
51+
...globals.browser,
52+
},
53+
},
54+
plugins: {
55+
import: importPlugin,
56+
prettier: prettierPlugin,
57+
"unused-imports": unusedImports,
58+
"ts-compat": tsCompat,
59+
},
60+
settings: {
61+
"import/parsers": {
62+
"@typescript-eslint/parser": [".ts", ".tsx"],
63+
},
64+
},
65+
rules: {
66+
"@typescript-eslint/consistent-generic-constructors": "off",
67+
"ts-compat/consistent-generic-constructors": "error",
68+
"prettier/prettier": "error",
69+
"@typescript-eslint/no-unused-vars": [
70+
"error",
71+
{
72+
args: "all",
73+
argsIgnorePattern: "^_",
74+
caughtErrors: "all",
75+
caughtErrorsIgnorePattern: "^_",
76+
destructuredArrayIgnorePattern: "^_",
77+
varsIgnorePattern: "^_",
78+
ignoreRestSiblings: true,
79+
},
80+
],
81+
"import/no-extraneous-dependencies": [
82+
"error",
83+
{
84+
devDependencies: [
85+
"**/vite.config.ts",
86+
"**/jest.setup.ts",
87+
"**/*.test.ts",
88+
"**/*.test.tsx",
89+
],
90+
},
91+
],
92+
"import/order": [
93+
"error",
94+
{
95+
alphabetize: {
96+
order: "asc",
97+
caseInsensitive: false,
98+
},
99+
"newlines-between": "always",
100+
groups: ["external", "builtin", "internal", ["parent", "sibling", "index"]],
101+
},
102+
],
103+
},
104+
},
105+
];

justfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ stop-dev:
4848
register-user localpart password *admin:
4949
docker-compose -f docker-compose-dev.yml exec mas mas-cli manage register-user --yes {{ if admin =="1" {"--admin"} else {"--no-admin"} }} -p {{ password }} {{ localpart }}
5050

51-
# run yarn {fix,format,test} commands
51+
# run fixers, formatters, linters, and tests in a strict order
5252
test:
53-
@-yarn run fix
54-
@-yarn run format
55-
@-yarn run test
53+
@yarn -s run fix --quiet
54+
@yarn -s run format --log-level warn
55+
@yarn -s run lint --quiet
56+
@yarn -s run test --silent
5657

5758
# run the app in a production mode
5859
run-prod: build

package.json

Lines changed: 10 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,26 @@
3030
"url": "https://liberapay.com/etkecc"
3131
},
3232
"devDependencies": {
33-
"@eslint/js": "^9.39.2",
33+
"@eslint/js": "^10.0.1",
3434
"@testing-library/dom": "^10.4.1",
3535
"@testing-library/jest-dom": "^6.9.1",
3636
"@testing-library/react": "^16.3.2",
3737
"@testing-library/user-event": "^14.6.1",
3838
"@types/jest": "^30.0.0",
3939
"@types/lodash": "^4.17.23",
40-
"@types/node": "^25.2.0",
40+
"@types/node": "^25.2.1",
4141
"@types/papaparse": "^5.5.2",
42-
"@types/react": "^19.2.10",
43-
"@typescript-eslint/eslint-plugin": "^8.54.0",
44-
"@typescript-eslint/parser": "^8.54.0",
45-
"@vitejs/plugin-react": "^5.1.2",
46-
"eslint": "^9.39.2",
42+
"@types/react": "^19.2.13",
43+
"@typescript-eslint/eslint-plugin": "^8.57.0",
44+
"@typescript-eslint/parser": "^8.57.0",
45+
"@vitejs/plugin-react": "^5.1.3",
46+
"eslint": "^10.0.0",
4747
"eslint-config-prettier": "^10.1.8",
4848
"eslint-plugin-import": "^2.32.0",
4949
"eslint-plugin-jsx-a11y": "^6.10.2",
5050
"eslint-plugin-prettier": "^5.5.5",
5151
"eslint-plugin-unused-imports": "^4.3.0",
52+
"globals": "^17.3.0",
5253
"jest": "^30.2.0",
5354
"jest-environment-jsdom": "^30.2.0",
5455
"jest-fetch-mock": "^3.0.3",
@@ -57,7 +58,7 @@
5758
"ts-jest": "^29.4.6",
5859
"ts-node": "^10.9.2",
5960
"typescript": "^5.9.3",
60-
"typescript-eslint": "^8.54.0",
61+
"typescript-eslint": "^8.57.0",
6162
"vite": "^7.3.1",
6263
"vite-plugin-version-mark": "^0.2.2"
6364
},
@@ -96,80 +97,12 @@
9697
"scripts": {
9798
"start": "vite serve",
9899
"build": "vite build",
99-
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ignore-path .gitignore --ignore-pattern testdata/ --ext .ts,.tsx .",
100+
"lint": "eslint .",
100101
"format": "prettier --write \"src/**/*\"",
101102
"fix": "yarn lint --fix",
102103
"test": "yarn jest",
103104
"test:watch": "yarn jest --watch"
104105
},
105-
"eslintConfig": {
106-
"env": {
107-
"browser": true
108-
},
109-
"plugins": [
110-
"import",
111-
"prettier",
112-
"unused-imports",
113-
"@typescript-eslint"
114-
],
115-
"extends": [
116-
"eslint:recommended",
117-
"plugin:@typescript-eslint/recommended",
118-
"plugin:@typescript-eslint/stylistic",
119-
"plugin:import/typescript"
120-
],
121-
"parser": "@typescript-eslint/parser",
122-
"parserOptions": {
123-
"project": "./tsconfig.eslint.json"
124-
},
125-
"root": true,
126-
"rules": {
127-
"prettier/prettier": "error",
128-
"@typescript-eslint/no-unused-vars": [
129-
"error",
130-
{
131-
"args": "all",
132-
"argsIgnorePattern": "^_",
133-
"caughtErrors": "all",
134-
"caughtErrorsIgnorePattern": "^_",
135-
"destructuredArrayIgnorePattern": "^_",
136-
"varsIgnorePattern": "^_",
137-
"ignoreRestSiblings": true
138-
}
139-
],
140-
"import/no-extraneous-dependencies": [
141-
"error",
142-
{
143-
"devDependencies": [
144-
"**/vite.config.ts",
145-
"**/jest.setup.ts",
146-
"**/*.test.ts",
147-
"**/*.test.tsx"
148-
]
149-
}
150-
],
151-
"import/order": [
152-
"error",
153-
{
154-
"alphabetize": {
155-
"order": "asc",
156-
"caseInsensitive": false
157-
},
158-
"newlines-between": "always",
159-
"groups": [
160-
"external",
161-
"builtin",
162-
"internal",
163-
[
164-
"parent",
165-
"sibling",
166-
"index"
167-
]
168-
]
169-
}
170-
]
171-
}
172-
},
173106
"prettier": {
174107
"printWidth": 120,
175108
"tabWidth": 2,

src/components/etke.cc/ServerStatusPage.tsx

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -140,43 +140,49 @@ const ServerStatusPage = () => {
140140
</EtkeAttribution>
141141

142142
<Stack spacing={2} direction={{ xs: "column", md: "row" }}>
143-
{Object.keys(groupedResults).map((category, _idx) => (
144-
<Box key={`category_${category}`} sx={{ flex: 1 }}>
145-
<Typography variant="h5" mb={1}>
146-
{translate(`etkecc.status.category.${category}`)}
147-
</Typography>
148-
<Paper elevation={2} sx={{ p: 3 }}>
149-
<Stack spacing={1} divider={<Divider />}>
150-
{groupedResults[category].map((result, idx) => (
151-
<Box key={`${category}_${idx}`}>
152-
<Stack spacing={2}>
153-
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
154-
<StatusChip isOkay={result.ok} size="small" errorLabel={errorLabel} />
155-
{result.label.url ? (
156-
<Link href={result.label.url} target="_blank" rel="noopener noreferrer">
143+
{Object.keys(groupedResults).map((category, _idx) => {
144+
let categoryName = translate(`etkecc.status.category.${category}`);
145+
if (categoryName.startsWith("etkecc.status.category.")) {
146+
categoryName = category;
147+
}
148+
return (
149+
<Box key={`category_${category}`} sx={{ flex: 1 }}>
150+
<Typography variant="h5" mb={1}>
151+
{categoryName}
152+
</Typography>
153+
<Paper elevation={2} sx={{ p: 3 }}>
154+
<Stack spacing={1} divider={<Divider />}>
155+
{groupedResults[category].map((result, idx) => (
156+
<Box key={`${category}_${idx}`}>
157+
<Stack spacing={2}>
158+
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
159+
<StatusChip isOkay={result.ok} size="small" errorLabel={errorLabel} />
160+
{result.label.url ? (
161+
<Link href={result.label.url} target="_blank" rel="noopener noreferrer">
162+
<ServerComponentText text={result.label.text} />
163+
</Link>
164+
) : (
157165
<ServerComponentText text={result.label.text} />
158-
</Link>
159-
) : (
160-
<ServerComponentText text={result.label.text} />
166+
)}
167+
</Box>
168+
{result.reason && (
169+
<Typography color="text.secondary" dangerouslySetInnerHTML={{ __html: result.reason }} />
161170
)}
162-
</Box>
163-
{result.reason && (
164-
<Typography color="text.secondary" dangerouslySetInnerHTML={{ __html: result.reason }} />
165-
)}
166-
{!result.ok && result.help && (
167-
<EtkeAttribution>
168-
<Link href={result.help} target="_blank" rel="noopener noreferrer" sx={{ mt: 1 }}>
169-
{translate("etkecc.status.help")}
170-
</Link>
171-
</EtkeAttribution>
172-
)}
173-
</Stack>
174-
</Box>
175-
))}
176-
</Stack>
177-
</Paper>
178-
</Box>
179-
))}
171+
{!result.ok && result.help && (
172+
<EtkeAttribution>
173+
<Link href={result.help} target="_blank" rel="noopener noreferrer" sx={{ mt: 1 }}>
174+
{translate("etkecc.status.help")}
175+
</Link>
176+
</EtkeAttribution>
177+
)}
178+
</Stack>
179+
</Box>
180+
))}
181+
</Stack>
182+
</Paper>
183+
</Box>
184+
);
185+
})}
180186
</Stack>
181187
</Stack>
182188
</>

src/synapse/dataProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,8 @@ const baseDataProvider: SynapseDataProvider = {
857857

858858
const endpoint_url = `${homeserver}${ref.endpoint}?${new URLSearchParams(filterUndefined(query)).toString()}`;
859859
const CACHE_KEY = ref.endpoint;
860-
let jsonData = [];
861-
let total = 0;
860+
let jsonData: any[];
861+
let total: number;
862862

863863
if (CACHED_MANY_REF[CACHE_KEY]) {
864864
jsonData = CACHED_MANY_REF[CACHE_KEY]["data"].slice(from, from + perPage);

src/utils/fetchMedia.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const fetchAuthenticatedMedia = async (mxcUrl: string, type: MediaType):
2121
return new Response(null, { status: 400, statusText: "Invalid mxcUrl" });
2222
}
2323

24-
let url = "";
24+
let url: string;
2525
if (type === "thumbnail") {
2626
// ref: https://spec.matrix.org/latest/client-server-api/#thumbnails
2727
url = `${homeserver}/_matrix/client/v1/media/thumbnail/${serverName}/${mediaId}?width=320&height=240&method=scale`;

0 commit comments

Comments
 (0)