Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ packages/website/public/api/

# TS
*.tsbuildinfo

# Turbo
.turbo
1 change: 1 addition & 0 deletions packages/website/__mocks__/svg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'svg-mock'
96 changes: 96 additions & 0 deletions packages/website/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import typescriptParser from '@typescript-eslint/parser'
import typescriptPlugin from '@typescript-eslint/eslint-plugin'
import reactPlugin from 'eslint-plugin-react'
import importPlugin from 'eslint-plugin-import'
import nextPlugin from '@next/eslint-plugin-next'
import prettierConfig from 'eslint-config-prettier'
import path from 'path'
import { fileURLToPath } from 'url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const compat = new FlatCompat({
baseDirectory: __dirname,
})

export default [
js.configs.recommended,
...compat.extends('plugin:@typescript-eslint/recommended'),
prettierConfig,
{
files: ['**/*.{js,mjs,cjs,ts,tsx}'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: {
React: 'readonly',
JSX: 'readonly',
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
console: 'readonly',
process: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
module: 'readonly',
require: 'readonly',
jest: 'readonly',
describe: 'readonly',
it: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeAll: 'readonly',
beforeEach: 'readonly',
afterAll: 'readonly',
afterEach: 'readonly',
},
},
plugins: {
'@typescript-eslint': typescriptPlugin,
react: reactPlugin,
import: importPlugin,
'@next/next': nextPlugin,
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: true,
node: true,
alias: {
map: [['src', './src']],
},
},
},
rules: {
'react/react-in-jsx-scope': 'off',
'@next/next/no-img-element': 'off',
'react/no-unknown-property': [
'error',
{
ignore: ['jsx', 'global'],
},
],
'import/order': [
'error',
{
groups: [
['builtin', 'external'],
['internal', 'parent', 'sibling', 'index'],
],
'newlines-between': 'always',
},
],
},
},
]
4 changes: 3 additions & 1 deletion packages/website/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ async function jestConfig() {
"**/*.(spec).(tsx)"
],
"moduleNameMapper": {
"src/(.*)$": "<rootDir>/src/$1"
"src/(.*)$": "<rootDir>/src/$1",
"\\.svg$": "<rootDir>/__mocks__/svg.js"
},
"testEnvironment": "jsdom",
"setupFilesAfterEnv": ["<rootDir>/jest.setup.js"],
"reporters": [
"default",
"github-actions"
Expand Down
1 change: 1 addition & 0 deletions packages/website/jest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@testing-library/jest-dom" />
82 changes: 82 additions & 0 deletions packages/website/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import '@testing-library/jest-dom'
import React from 'react'

// Mock next/dynamic to load components synchronously in tests
jest.mock('next/dynamic', () => ({
__esModule: true,
default: (...args) => {
const dynamicModule = jest.requireActual('next/dynamic')
const dynamicActualComp = dynamicModule.default
const RequiredComponent = dynamicActualComp(args[0])
RequiredComponent.preload ? RequiredComponent.preload() : RequiredComponent.render.preload()
return RequiredComponent
},
}))

// Mock matchMedia for components that use it
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(),
removeListener: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
})

// Silence known React/JSDOM warnings in tests that don't affect functionality
const originalError = console.error
beforeAll(() => {
console.error = (...args) => {
// Suppress SVG element warnings - these are JSDOM limitations, not actual errors
// The SVG elements work fine in real browsers
if (
typeof args[0] === 'string' &&
(args[0].includes('The tag <') && args[0].includes('is unrecognized in this browser'))
) {
return
}
originalError.call(console, ...args)
}
})

afterAll(() => {
console.error = originalError
})

// Mock SVG namespace attributes for JSDOM
// JSDOM doesn't fully support SVG namespaced attributes like xlink:href
const originalCreateElement = document.createElement.bind(document)
const originalCreateElementNS = document.createElementNS.bind(document)

document.createElement = function (tagName, options) {
const element = originalCreateElement(tagName, options)
if (tagName.toLowerCase() === 'svg') {
element.setAttribute = function (name, value) {
if (name === 'xlinkHref') {
this.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', value)
} else {
Element.prototype.setAttribute.call(this, name, value)
}
}
}
return element
}

document.createElementNS = function (namespaceURI, qualifiedName) {
const element = originalCreateElementNS(namespaceURI, qualifiedName)
if (namespaceURI === 'http://www.w3.org/2000/svg') {
element.setAttribute = function (name, value) {
if (name === 'xlinkHref') {
this.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', value)
} else {
Element.prototype.setAttribute.call(this, name, value)
}
}
}
return element
}
3 changes: 2 additions & 1 deletion packages/website/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
9 changes: 2 additions & 7 deletions packages/website/next.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
const withPWA = require('next-pwa')({
disable: process.env.NODE_ENV === 'development',
dest: './public',
})

module.exports = withPWA({
module.exports = {
reactStrictMode: true,
output: 'export',
})
}
107 changes: 14 additions & 93 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"version": "1.0.0",
"engines": {
"node": "22"
"node": "24"
},
"scripts": {
"build": "node scripts/generate-api.js && next build && next-sitemap",
Expand All @@ -14,15 +14,20 @@
"test": "FORCE_COLOR=1 jest --coverage"
},
"devDependencies": {
"@eslint/eslintrc": "3.3.3",
"@eslint/js": "9.39.2",
"@next/eslint-plugin-next": "16.1.6",
"@testing-library/jest-dom": "6.9.1",
"@testing-library/react": "16.3.2",
"@testing-library/user-event": "14.6.1",
"@types/fetch-mock": "^7.3.8",
"@types/jest": "^29.5.14",
"@types/react": "^18.3.12",
"@types/react-test-renderer": "^18.3.0",
"@types/react": "^19.2.11",
"@typescript-eslint/eslint-plugin": "^8.52.0",
"@typescript-eslint/parser": "^8.53.0",
"@typescript-eslint/parser": "^8.54.0",
"clipboard": "^2.0.11",
"eslint": "^8.57.0",
"eslint-config-next": "^15.5.4",
"eslint": "^9.39.2",
"eslint-config-next": "^16.1.6",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^4.4.4",
Expand All @@ -35,17 +40,15 @@
"jest-environment-jsdom": "^30.2.0",
"jest-fetch-mock": "^3.0.3",
"lint-staged": "^16.2.7",
"next": "^14.2.35",
"next-pwa": "^5.6.0",
"next": "^16.1.6",
"next-sitemap": "^4.2.3",
"next-themes": "^0.4.6",
"node-mocks-http": "^1.17.2",
"prettier": "3.6.2",
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"react-hot-toast": "^2.5.2",
"react-test-renderer": "^18.3.1",
"typescript": "^5.9.3"
},
"author": {
Expand All @@ -72,87 +75,5 @@
"semi": false,
"singleQuote": true,
"arrowParens": "always"
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
"env": {
"jest": true,
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"prettier",
"plugin:@next/next/recommended",
"plugin:import/typescript"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module",
"requireConfigFile": false,
"babelOptions": {
"presets": [
"next/babel"
]
}
},
"plugins": [
"react",
"@typescript-eslint",
"import"
],
"rules": {
"react/react-in-jsx-scope": "off",
"@next/next/no-img-element": "off",
"react/no-unknown-property": [
"error",
{
"ignore": [
"jsx",
"global"
]
}
],
"import/order": [
"error",
{
"groups": [
[
"builtin",
"external"
],
[
"internal",
"parent",
"sibling",
"index"
]
],
"newlines-between": "always"
}
]
},
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"alias": {
"map": [
[
"src",
"./src"
]
]
},
"typescript": true,
"node": true
}
}
}
}
Loading