Skip to content

Commit 67db0ab

Browse files
aastefanovroot
authored andcommitted
eslint: update config, add prettier
1 parent 87795b2 commit 67db0ab

5 files changed

Lines changed: 210 additions & 160 deletions

File tree

eslint.config.js

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,28 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import react from 'eslint-plugin-react'
4-
import reactHooks from 'eslint-plugin-react-hooks'
5-
import reactRefresh from 'eslint-plugin-react-refresh'
6-
import tseslint from "@typescript-eslint/eslint-plugin"
7-
import tsparser from "@typescript-eslint/parser"
1+
import eslint from "@eslint/js";
2+
import { defineConfig, globalIgnores } from "eslint/config";
3+
import tseslint from "typescript-eslint";
4+
import react from "eslint-plugin-react";
5+
import reactHooks from "eslint-plugin-react-hooks";
6+
import reactRefresh from "eslint-plugin-react-refresh";
7+
import globals from "globals";
8+
// import prettierConfigRecommended from "eslint-plugin-prettier/recommended";
89

9-
export default [
10+
export default defineConfig([
11+
// prettierConfigRecommended,
12+
reactHooks.configs.flat.recommended,
13+
eslint.configs.recommended,
14+
tseslint.configs.recommended,
15+
globalIgnores(["dist/"]),
16+
react.configs.flat.recommended,
17+
react.configs.flat["jsx-runtime"],
18+
reactRefresh.configs.vite,
19+
{ languageOptions: { globals: globals.node } },
20+
{ settings: { react: { version: "detect" } } },
1021
{
11-
ignores: ['dist'],
12-
files: ['**/*.{js,jsx,ts,tsx}'],
13-
languageOptions: {
14-
parser: tsparser,
15-
ecmaVersion: 2020,
16-
globals: globals.browser,
17-
parserOptions: {
18-
ecmaVersion: 'latest',
19-
ecmaFeatures: {jsx: true},
20-
sourceType: 'module',
21-
},
22-
},
23-
settings: {react: {version: 'detect'}},
24-
plugins: {
25-
react,
26-
'react-hooks': reactHooks,
27-
'react-refresh': reactRefresh,
28-
'@typescript-eslint': tseslint,
29-
},
30-
// extends: [
31-
// "eslint:recommended",
32-
// "next/core-web-vitals",
33-
// "plugin:react/recommended",
34-
// "standard-with-typescript",
35-
// "plugin:@typescript-eslint/recommended",
36-
// ],
3722
rules: {
38-
...js.configs.recommended.rules,
39-
...react.configs.recommended.rules,
40-
...react.configs['jsx-runtime'].rules,
41-
...reactHooks.configs.recommended.rules,
42-
...tseslint.configs.recommended.rules,
43-
'@typescript-eslint/no-unused-vars': 'error',
44-
'@typescript-eslint/no-explicit-any': 'off',
45-
'no-unused-vars': 'off',
46-
'react/jsx-no-target-blank': 'off',
47-
'react-refresh/only-export-components': [
48-
'warn',
49-
{allowConstantExport: true},
50-
],
23+
"@typescript-eslint/no-unused-vars": "error",
24+
"@typescript-eslint/no-explicit-any": "off",
25+
"no-unused-vars": "off",
5126
},
5227
},
53-
]
28+
]);

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"bootstrap": "^5.3.3",
1717
"bootswatch": "^5.3.3",
1818
"date-fns": "^4.1.0",
19+
"echarts": "^6.0.0",
20+
"echarts-for-react": "^3.0.5",
1921
"i18next": "^25.7.3",
2022
"i18next-http-backend": "^3.0.2",
2123
"js-pkce": "^2.0.0",
@@ -30,26 +32,26 @@
3032
"react-router-dom": "^7.11.0",
3133
"sass": "^1.97.0",
3234
"swr": "^2.3.8",
33-
"vite-plugin-compression": "^0.5.1",
34-
"echarts": "^6.0.0",
35-
"echarts-for-react": "^3.0.5"
35+
"vite-plugin-compression": "^0.5.1"
3636
},
3737
"devDependencies": {
38-
"typescript":">=4.0.0",
3938
"@eslint/js": "^9.39.2",
4039
"@tsconfig/vite-react": "^7.0.2",
4140
"@types/js-yaml": "^4.0.9",
4241
"@types/react": "^19.2.7",
4342
"@types/react-dom": "^19.2.3",
4443
"@types/web": "^0.0.303",
45-
"@typescript-eslint/eslint-plugin": "^8.50.0",
46-
"@typescript-eslint/parser": "^8.50.0",
4744
"@vitejs/plugin-react": "^5.1.2",
4845
"eslint": "^9.39.2",
46+
"eslint-config-prettier": "^10.1.8",
47+
"eslint-plugin-prettier": "^5.5.5",
4948
"eslint-plugin-react": "^7.37.5",
5049
"eslint-plugin-react-hooks": "^7.0.1",
5150
"eslint-plugin-react-refresh": "^0.4.26",
5251
"globals": "^16.5.0",
52+
"prettier": "^3.8.1",
53+
"typescript": "^5.9.3",
54+
"typescript-eslint": "^8.54.0",
5355
"typescript-plugin-css-modules": "^5.2.0",
5456
"vite": "^7.3.0"
5557
}

prettier.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { type Config } from "prettier";
2+
3+
const config: Config = {
4+
tabWidth: 4,
5+
};
6+
7+
export default config;

src/hooks/useAuthStorage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function parseTokenResponse(response: FaunaResponse): SpaceAccessToken {
2525
if ((response as FaunaTokenError).error)
2626
throw new Error((response as FaunaTokenError).error_description);
2727

28-
let token = response as FaunaTokenResponse;
28+
const token = response as FaunaTokenResponse;
2929
if (!hasAll(response, ...requiredTokenProps) || token.token_type !== 'Bearer' || token.scope !== scopes
3030
)
3131
throw new Error('Incomplete response, missing fields');

0 commit comments

Comments
 (0)