Skip to content

Commit 8360ec8

Browse files
committed
chore: setup prettier/path-alias
1 parent f1422bd commit 8360ec8

14 files changed

+76
-193
lines changed

.eslintrc.cjs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ module.exports = {
55
'eslint:recommended',
66
'plugin:@typescript-eslint/recommended',
77
'plugin:react-hooks/recommended',
8+
'prettier',
89
],
910
ignorePatterns: ['dist', '.eslintrc.cjs'],
1011
parser: '@typescript-eslint/parser',
1112
plugins: ['react-refresh'],
1213
rules: {
14+
'@typescript-eslint/no-explicit-any': 'off',
15+
'react-refresh/only-export-components': 'off',
16+
'react-hooks/exhaustive-deps': 'off',
1317
'react-refresh/only-export-components': [
1418
'warn',
1519
{ allowConstantExport: true },
1620
],
1721
},
18-
}
22+
};

.prettierrc

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
22
"tabWidth": 2,
3-
"singleQuote": true
3+
"printWidth": 80,
4+
"singleQuote": true,
5+
"endOfLine": "lf",
6+
"trailingComma": "es5",
7+
"semi": true,
8+
"proseWrap": "preserve",
9+
"quoteProps": "consistent",
10+
"bracketSpacing": true
411
}

README.md

+1-30
Original file line numberDiff line numberDiff line change
@@ -1,30 +1 @@
1-
# React + TypeScript + Vite
2-
3-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4-
5-
Currently, two official plugins are available:
6-
7-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9-
10-
## Expanding the ESLint configuration
11-
12-
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13-
14-
- Configure the top-level `parserOptions` property like this:
15-
16-
```js
17-
export default {
18-
// other rules...
19-
parserOptions: {
20-
ecmaVersion: 'latest',
21-
sourceType: 'module',
22-
project: ['./tsconfig.json', './tsconfig.node.json', './tsconfig.app.json'],
23-
tsconfigRootDir: __dirname,
24-
},
25-
}
26-
```
27-
28-
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
29-
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
30-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
1+
# harena - web

package-lock.json

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"name": "harena-client",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "0.0.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc -b && vite build",
99
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10-
"preview": "vite preview"
10+
"preview": "vite preview",
11+
"format": "prettier --write .",
12+
"format:check": "prettier --check ."
1113
},
1214
"dependencies": {
1315
"@hookform/resolvers": "^3.9.0",
@@ -21,6 +23,7 @@
2123
"zustand": "^4.5.4"
2224
},
2325
"devDependencies": {
26+
"@types/node": "^20.14.11",
2427
"@types/react": "^18.3.3",
2528
"@types/react-dom": "^18.3.0",
2629
"@typescript-eslint/eslint-plugin": "^7.15.0",

src/App.css

-42
This file was deleted.

src/App.tsx

-35
This file was deleted.

src/app.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const App = () => {
2+
return <div>Hello</div>;
3+
};
4+
5+
export default App;

src/index.css

+1-68
Original file line numberDiff line numberDiff line change
@@ -1,68 +1 @@
1-
:root {
2-
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3-
line-height: 1.5;
4-
font-weight: 400;
5-
6-
color-scheme: light dark;
7-
color: rgba(255, 255, 255, 0.87);
8-
background-color: #242424;
9-
10-
font-synthesis: none;
11-
text-rendering: optimizeLegibility;
12-
-webkit-font-smoothing: antialiased;
13-
-moz-osx-font-smoothing: grayscale;
14-
}
15-
16-
a {
17-
font-weight: 500;
18-
color: #646cff;
19-
text-decoration: inherit;
20-
}
21-
a:hover {
22-
color: #535bf2;
23-
}
24-
25-
body {
26-
margin: 0;
27-
display: flex;
28-
place-items: center;
29-
min-width: 320px;
30-
min-height: 100vh;
31-
}
32-
33-
h1 {
34-
font-size: 3.2em;
35-
line-height: 1.1;
36-
}
37-
38-
button {
39-
border-radius: 8px;
40-
border: 1px solid transparent;
41-
padding: 0.6em 1.2em;
42-
font-size: 1em;
43-
font-weight: 500;
44-
font-family: inherit;
45-
background-color: #1a1a1a;
46-
cursor: pointer;
47-
transition: border-color 0.25s;
48-
}
49-
button:hover {
50-
border-color: #646cff;
51-
}
52-
button:focus,
53-
button:focus-visible {
54-
outline: 4px auto -webkit-focus-ring-color;
55-
}
56-
57-
@media (prefers-color-scheme: light) {
58-
:root {
59-
color: #213547;
60-
background-color: #ffffff;
61-
}
62-
a:hover {
63-
color: #747bff;
64-
}
65-
button {
66-
background-color: #f9f9f9;
67-
}
68-
}
1+
/* CSS */

src/main.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from 'react'
2-
import ReactDOM from 'react-dom/client'
3-
import App from './App.tsx'
4-
import './index.css'
1+
import React from 'react';
2+
import ReactDOM from 'react-dom/client';
3+
import App from './app.tsx';
4+
import './index.css';
55

66
ReactDOM.createRoot(document.getElementById('root')!).render(
77
<React.StrictMode>
88
<App />
9-
</React.StrictMode>,
10-
)
9+
</React.StrictMode>
10+
);

tsconfig.app.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"lib": ["ES2020", "DOM", "DOM.Iterable"],
88
"module": "ESNext",
99
"skipLibCheck": true,
10-
10+
"paths": {
11+
"@/*": ["./src/*"]
12+
},
1113
/* Bundler mode */
1214
"moduleResolution": "bundler",
1315
"allowImportingTsExtensions": true,
@@ -16,7 +18,6 @@
1618
"moduleDetection": "force",
1719
"noEmit": true,
1820
"jsx": "react-jsx",
19-
2021
/* Linting */
2122
"strict": true,
2223
"noUnusedLocals": true,

tsconfig.json

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2+
"compilerOptions": {
3+
"paths": {
4+
"@/*": ["./src/*"]
5+
}
6+
},
27
"files": [],
38
"references": [
49
{

tsconfig.node.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"moduleResolution": "bundler",
88
"allowSyntheticDefaultImports": true,
99
"strict": true,
10-
"noEmit": true
10+
"noEmit": true,
11+
"paths": {
12+
"@/*": ["./src/*"]
13+
}
1114
},
1215
"include": ["vite.config.ts"]
1316
}

vite.config.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
import { defineConfig } from 'vite'
2-
import react from '@vitejs/plugin-react-swc'
1+
import path from 'path';
2+
import { defineConfig, loadEnv } from 'vite';
3+
import react from '@vitejs/plugin-react-swc';
34

45
// https://vitejs.dev/config/
5-
export default defineConfig({
6-
plugins: [react()],
7-
})
6+
export default defineConfig(({ mode }) => {
7+
const env = loadEnv(mode, process.cwd(), '');
8+
return {
9+
plugins: [react()],
10+
define: {
11+
'process.env': env,
12+
},
13+
resolve: {
14+
alias: {
15+
'@': path.resolve(__dirname, './src'),
16+
},
17+
},
18+
};
19+
});

0 commit comments

Comments
 (0)