Skip to content

Commit c332150

Browse files
authored
Merge pull request #41 from SpaceyaTech:setup-linting-and-testing
Configure ESLint, enhance routing and error handling, and refactor tests
2 parents 15e2324 + 1d807a5 commit c332150

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1404
-248
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ tsconfig.node.tsbuildinfo
2727
/playwright-report/
2828
/blob-report/
2929
/playwright/.cache/
30+
tsconfig.app.tsbuildinfo
File renamed without changes.

eslint.config.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,39 @@ import globals from 'globals'
33
import reactHooks from 'eslint-plugin-react-hooks'
44
import reactRefresh from 'eslint-plugin-react-refresh'
55
import tseslint from 'typescript-eslint'
6+
import pluginQuery from '@tanstack/eslint-plugin-query'
67

78
export default tseslint.config(
8-
{ ignores: ['dist'] },
9+
...pluginQuery.configs["flat/recommended"],
10+
{ ignores: ["dist"] },
911
{
1012
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
13+
files: ["**/*.{ts,tsx}"],
1214
languageOptions: {
1315
ecmaVersion: 2020,
1416
globals: globals.browser,
1517
},
1618
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
19+
"react-hooks": reactHooks,
20+
"react-refresh": reactRefresh,
1921
},
2022
rules: {
2123
...reactHooks.configs.recommended.rules,
22-
'react-refresh/only-export-components': [
23-
'warn',
24+
"react-refresh/only-export-components": [
25+
"warn",
2426
{ allowConstantExport: true },
2527
],
28+
'no-empty-pattern': 'off',
29+
'no-empty-object-type': 'off',
30+
'allowEmptyCatch': 'off',
31+
'allowInterface': 'off',
32+
'no-unused-vars': 'off',
33+
"@typescript-eslint/no-empty-object-type": "off",
34+
"@typescript-eslint/no-unused-vars": "off",
35+
'@typescript-eslint/no-explicit-any': 'off',
36+
'@typescript-eslint/no-unused-expressions': 'off'
37+
2638
},
39+
2740
},
28-
)
41+
);

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc -b && vite build",
98
"lint": "eslint . --fix",
109
"format": "prettier --write --ignore-unknown src",
1110
"page": "tsx src/scripts/scafold-pages/script.ts",
12-
"playwright":"playwright test --ui",
11+
"vitest": "vitest --ui",
12+
"playwright": "playwright test --ui",
13+
"test": "npm run vitest && npm run playwright",
14+
"build": "tsc -b && vite build",
1315
"preview": "vite preview"
1416
},
1517
"dependencies": {
@@ -66,13 +68,16 @@
6668
"devDependencies": {
6769
"@eslint/js": "^9.13.0",
6870
"@playwright/test": "^1.49.0",
71+
"@tanstack/eslint-plugin-query": "^5.61.6",
6972
"@tanstack/react-query-devtools": "^5.59.19",
7073
"@tanstack/router-devtools": "^1.79.0",
7174
"@tanstack/router-plugin": "^1.79.0",
7275
"@types/node": "^22.10.1",
7376
"@types/react": "^18.3.11",
7477
"@types/react-dom": "^18.3.1",
7578
"@vitejs/plugin-react": "^4.3.3",
79+
"@vitest/coverage-v8": "2.1.6",
80+
"@vitest/ui": "2.1.6",
7681
"autoprefixer": "^10.4.20",
7782
"daisyui": "^4.12.14",
7883
"dotenv": "^16.4.5",
@@ -90,6 +95,7 @@
9095
"typescript": "~5.6.2",
9196
"typescript-eslint": "^8.10.0",
9297
"vite": "^5.4.9",
93-
"vite-tsconfig-paths": "^5.1.0"
98+
"vite-tsconfig-paths": "^5.1.0",
99+
"vitest": "^2.1.6"
94100
}
95101
}

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dotenv.config({ path: path.resolve(__dirname, ".env") });
1313
* See https://playwright.dev/docs/test-configuration.
1414
*/
1515
export default defineConfig({
16-
testDir: "./tests",
16+
testDir: "./e2e-tests",
1717
/* Run tests in files in parallel */
1818
fullyParallel: true,
1919
/* Fail the build on CI if you accidentally left test.only in the source code. */

0 commit comments

Comments
 (0)