Skip to content

Commit

Permalink
chore: add .editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
sand4rt committed Jun 14, 2024
1 parent 75f51ad commit 5c65f54
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 38 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
quote_type = single
18 changes: 9 additions & 9 deletions ct-react-vite/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
import { fixupConfigRules } from "@eslint/compat";
import playwright from "eslint-plugin-playwright-ct";
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js';
import { fixupConfigRules } from '@eslint/compat';
import playwright from 'eslint-plugin-playwright-ct';

export default [
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.all,
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
...playwright,
files: ["tests/**"],
files: ['tests/**'],
},
{
files: ["**/*.jsx"],
files: ['**/*.jsx'],
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
},
...fixupConfigRules(pluginReactConfig),
Expand Down
6 changes: 3 additions & 3 deletions ct-react-vite/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default defineConfig({
resolve: {
alias: {
'@': resolve(__dirname, './src'),
}
}
}
},
},
},
},
projects: [
{
Expand Down
30 changes: 16 additions & 14 deletions ct-react-vite/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { Routes, Route, Link } from 'react-router-dom';
import { Link, Route, Routes } from 'react-router-dom';
import logo from './assets/logo.svg';
import LoginPage from './pages/LoginPage';
import DashboardPage from './pages/DashboardPage';

export default function App() {
return <>
<header>
<img src={logo} alt="logo" width={125} height={125} />
<Link to="/">Login</Link>
<Link to="/dashboard">Dashboard</Link>
</header>
<Routes>
<Route path="/">
<Route index element={<LoginPage />} />
<Route path="dashboard" element={<DashboardPage />} />
</Route>
</Routes>
</>
return (
<>
<header>
<img src={logo} alt="logo" width={125} height={125} />
<Link to="/">Login</Link>
<Link to="/dashboard">Dashboard</Link>
</header>
<Routes>
<Route path="/">
<Route index element={<LoginPage />} />
<Route path="dashboard" element={<DashboardPage />} />
</Route>
</Routes>
</>
);
}
8 changes: 5 additions & 3 deletions ct-react-vite/src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ type ButtonProps = {
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>;

export default function Button({ onClick, title, ...attributes }: ButtonProps) {
return <button {...attributes} onClick={() => onClick?.('hello')}>
{title}
</button>
return (
<button {...attributes} onClick={() => onClick?.('hello')}>
{title}
</button>
);
}
4 changes: 2 additions & 2 deletions ct-react-vite/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { BrowserRouter } from 'react-router-dom';
import App from './App';
import './assets/index.css';

createRoot(document.getElementById("root")!).render(
createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>
</React.StrictMode>,
);
2 changes: 1 addition & 1 deletion ct-react-vite/src/pages/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function DashboardPage() {
return <main>Dashboard</main>
return <main>Dashboard</main>;
}
2 changes: 1 addition & 1 deletion ct-react-vite/src/pages/LoginPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function LoginPage() {
return <main>Login</main>
return <main>Login</main>;
}
2 changes: 1 addition & 1 deletion ct-react-vite/tests/unserializable-enum.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test } from '@playwright/experimental-ct-react';

test('enum', async ({ mount }) => {
await mount(<div>Enum</div>);
await mount(<div>Enum</div>);
});
8 changes: 4 additions & 4 deletions ct-react-vite/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()]
})
plugins: [react()],
});

0 comments on commit 5c65f54

Please sign in to comment.