Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.
Draft
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
10 changes: 5 additions & 5 deletions # Code Citations.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Code Citations

## License: BSD_3_Clause

https://github.com/code-chimp/code-chimp.github.io/tree/26aa29252351913609d77885ebc3232db57b5df1/content/posts/porting-cra-to-vite-2/index.md

```
Expand All @@ -15,8 +16,8 @@ https://github.com/code-chimp/code-chimp.github.io/tree/26aa29252351913609d77885
"jsx"
```


## License: MIT

https://github.com/rolling-scopes-school/tasks/tree/1a9efc9951a6017e3f414d075b1ade53fb6559d1/react/modules/module01/configs.md

```
Expand All @@ -30,8 +31,8 @@ https://github.com/rolling-scopes-school/tasks/tree/1a9efc9951a6017e3f414d075b1a
"strict
```


## License: unknown

https://github.com/Florencea/my-macos-build/tree/3c8299cf901ad04e88b6adf3ec65f486e7e21f86/react.md

```
Expand All @@ -46,8 +47,8 @@ esModuleInterop": true,
"noEmit":
```


## License: unknown

https://github.com/suyizhang/learn/tree/b4ad88d8a785e89d850a9a259474099b9eb6faf6/vite/vite-webpack-react/README.md

```
Expand All @@ -62,8 +63,8 @@ skipLibCheck": true,
"isolatedModules":
```


## License: MIT

https://github.com/ombulabs/pokeberry/tree/1448e19bb3d804f8a6b734a8f06f25b3f905b3e2/_templates/component/new/tsconfig.ejs.t

```
Expand All @@ -76,4 +77,3 @@ DOM", "DOM.Iterable", "ESNext"],
"forceConsistentCasingInFileNames": true,
"module": "
```

53 changes: 27 additions & 26 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,42 @@ module.exports = {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {
project: './tsconfig.json',
alwaysTryTypes: true,
},
alias: {
map: [['@', './src']],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
},
},
extends: [
'airbnb',
'airbnb/hooks',
'plugin:@typescript-eslint/recommended',
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:jsx-a11y/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
],
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'jsx-a11y', 'import'],
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'jsx-a11y'],
rules: {
// project-specific overrides
'import/extensions': [
'error',
'ignorePackages',
{ ts: 'never', tsx: 'never', js: 'never', jsx: 'never' },
],
'import/prefer-default-export': 'off',
// TypeScript specific rules
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],

// React specific rules
'react/jsx-filename-extension': ['warn', { extensions: ['.tsx', '.jsx'] }],
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'react/prop-types': 'off', // TypeScript handles this

// General rules
'no-console': ['warn', { allow: ['warn', 'error'] }],
'prefer-const': 'error',
},
ignorePatterns: ['dist/', 'node_modules/', 'coverage/', 'public/', 'vite.config.ts', 'tests/e2e/**/*.ts'], // add parser-excluded files
ignorePatterns: [
'dist/',
'node_modules/',
'coverage/',
'public/',
'vite.config.ts',
'tests/e2e/**/*.ts',
'**/*.test.*',
'**/*.spec.*',
'jest.config.*',
'jest.setup.ts',
'setupTests.ts',
'scripts/**/*',
], // add parser-excluded files
};
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/
.vscode/
node_modules/
coverage/
audit-reports/
audit-report.html
test-results/
33 changes: 18 additions & 15 deletions App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@




import React, { useEffect } from 'react';
import { render, screen, act, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import App from './App'; // Adjust path as necessary
import ErrorBoundary from './components/ErrorBoundary'; // Import ErrorBoundary
import { describe, test, expect, beforeEach, afterEach, jest } from '@jest/globals';


// Mock child components that might have complex logic or side effects
jest.mock('./components/LandingPage', () => ({ onEnterForge, onTryDemo }: { onEnterForge: () => void, onTryDemo: () => void }) => <div data-testid="landing-page"><button onClick={onEnterForge}>Enter</button><button onClick={onTryDemo}>Demo</button></div>);
jest.mock(
'./components/LandingPage',
() =>
({ onEnterForge, onTryDemo }: { onEnterForge: () => void; onTryDemo: () => void }) => (
<div data-testid="landing-page">
<button onClick={onEnterForge}>Enter</button>
<button onClick={onTryDemo}>Demo</button>
</div>
)
);
jest.mock('./components/Workbench', () => () => <div data-testid="workbench">Workbench</div>);
// Add mocks for other components like IdeaList, IdeaEditor, SettingsModal, ContactPanel, NotificationArea if they cause issues or for isolation

Expand All @@ -32,10 +36,10 @@ describe('App Component', () => {
render(<App />);
// The view should still be 'landing' initially
expect(screen.getByTestId('landing-page')).toBeInTheDocument();

// Simulate user clicking "Enter the Forge"
await act(async () => {
fireEvent.click(screen.getByRole('button', {name: /Enter/i}));
fireEvent.click(screen.getByRole('button', { name: /Enter/i }));
});

// Now the view should change to 'projectManager' which renders Workbench
Expand All @@ -45,22 +49,20 @@ describe('App Component', () => {

test('shows settings and contact buttons after entering the app', async () => {
render(<App />);

await act(async () => {
fireEvent.click(screen.getByRole('button', {name: /Enter/i}));
fireEvent.click(screen.getByRole('button', { name: /Enter/i }));
});

expect(screen.getByLabelText('Open Settings')).toBeInTheDocument();
expect(screen.getByLabelText('Open Contact Panel')).toBeInTheDocument();
});


describe('ErrorBoundary Integration', () => {
// Mock console.error to prevent Jest from outputting caught errors during tests
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let consoleErrorSpy: jest.SpiedFunction<typeof console.error>;


beforeEach(() => {
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
});
Expand All @@ -71,7 +73,8 @@ describe('App Component', () => {

test('ErrorBoundary catches errors and displays fallback UI', () => {
const ThrowErrorComponent = () => {
useEffect(() => { // Throw error after initial render in an effect
useEffect(() => {
// Throw error after initial render in an effect
throw new Error('Test error from child');
}, []);
return null;
Expand All @@ -95,4 +98,4 @@ describe('App Component', () => {
// expect(consoleErrorSpy.mock.calls[0][0].message).toBe('Test error from child');
});
});
});
});
Loading