diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..5ea9f001 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +VITE_API_URL="http://localhost:8083" \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..0c234674 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,50 @@ +module.exports = { + extends: [ + 'react-app', + 'react-app/jest' + ], + parserOptions: { + project: './tsconfig.json', + tsconfigRootDir: __dirname, + warnOnUnsupportedTypeScriptVersion: false // Suppress TypeScript version warnings + }, + rules: { + // TypeScript rules - make them warnings instead of errors + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-unused-vars': ['warn', { 'vars': 'all', 'args': 'after-used', 'ignoreRestSiblings': true }], + '@typescript-eslint/no-use-before-define': 'warn', + '@typescript-eslint/no-useless-constructor': 'warn', + + // React Hook rules - make them warnings + 'react-hooks/exhaustive-deps': 'warn', + + // General JS rules + 'eqeqeq': ['warn', 'always'], + 'no-empty-pattern': 'warn', + 'no-useless-escape': 'warn', + + // Testing Library rules - make critical ones errors, others warnings + 'testing-library/no-wait-for-multiple-assertions': 'warn', + 'testing-library/no-node-access': 'warn', // Made this a warning instead of error + + // Turn off some overly strict rules + 'no-console': 'off', + '@typescript-eslint/ban-ts-comment': 'off' + }, + overrides: [ + { + files: ['**/__tests__/**/*', '**/*.{test,spec}.*'], + rules: { + // Relax rules for test files + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'testing-library/no-node-access': 'off' // Allow direct node access in tests if needed + } + } + ], + ignorePatterns: [ + 'vite.config.ts', + ], +}; \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..eb73103a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI + +on: + push: + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test -- --coverage --watchAll=false + + - name: Upload coverage reports + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + + build: + needs: test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '18.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build + path: build/ \ No newline at end of file diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 00000000..89d8d682 --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,58 @@ +name: Code Quality + +on: + push: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '18.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run ESLint + run: | + if npm list eslint &>/dev/null; then + # Run ESLint and allow more warnings for legacy codebase + npx eslint src --ext .ts,.tsx,.js,.jsx --max-warnings 300 + else + echo "ESLint not configured, skipping" + fi + + - name: Type check + run: npx tsc --noEmit + + security: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '18.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run npm audit + run: npm audit --production --audit-level=critical + + - name: Run Snyk to check for vulnerabilities + if: env.SNYK_TOKEN != '' + uses: snyk/actions/node@master + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + with: + args: --severity-threshold=critical \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4d29575d..d7c08872 100644 --- a/.gitignore +++ b/.gitignore @@ -13,10 +13,12 @@ # misc .DS_Store +.env .env.local .env.development.local .env.test.local .env.production.local +**.orig npm-debug.log* yarn-debug.log* diff --git a/index.html b/index.html new file mode 100644 index 00000000..0380bd09 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + +
+ + + +