Skip to content

Commit 0a8a5ad

Browse files
authored
refactor: rewrite entire app with vite as bundler (#11)
* refactor: rewrite entire app with vite as bundler BREAKING CHANGE: React 18 * docs: update README file for latest usage
1 parent a6cd26c commit 0a8a5ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+18074
-24187
lines changed

.eslintrc

Lines changed: 0 additions & 34 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2020: true,
5+
},
6+
extends: [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"plugin:jsx-a11y/recommended",
10+
"plugin:react/recommended",
11+
"plugin:react-hooks/recommended",
12+
"plugin:storybook/recommended",
13+
"plugin:prettier/recommended",
14+
],
15+
parser: "@typescript-eslint/parser",
16+
parserOptions: {
17+
ecmaVersion: "latest",
18+
sourceType: "module",
19+
},
20+
plugins: [
21+
"@typescript-eslint",
22+
"prettier",
23+
"react-refresh",
24+
"simple-import-sort",
25+
],
26+
settings: {
27+
react: {
28+
version: "18",
29+
},
30+
},
31+
rules: {
32+
"react-refresh/only-export-components": "warn",
33+
"simple-import-sort/imports": "error",
34+
"simple-import-sort/exports": "error",
35+
"react-hooks/rules-of-hooks": "error",
36+
"react-hooks/exhaustive-deps": "warn",
37+
"react/react-in-jsx-scope": "off",
38+
},
39+
ignorePatterns: ["dist", "build"],
40+
};

.gitignore

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
19

2-
# See https://help.github.com/ignore-files/ for more about ignoring files.
3-
4-
# dependencies
10+
storybook-static
511
node_modules
6-
7-
# builds
8-
build
912
dist
10-
.rpt2_cache
13+
dist-ssr
14+
*.local
1115

12-
# misc
16+
# Editor directories and files
17+
.idea
1318
.DS_Store
14-
.env
15-
.env.local
16-
.env.development.local
17-
.env.test.local
18-
.env.production.local
19-
20-
npm-debug.log*
21-
yarn-debug.log*
22-
yarn-error.log*
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit "$1"

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run lint:fix && npx lint-staged

.husky/prepare-commit-msg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
if [ "$2" != "message" ];then
5+
exec < /dev/tty && node_modules/.bin/cz --hook "$1" "$2" "$3" || true
6+
fi

.prettierrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
22
"singleQuote": true,
3-
"jsxSingleQuote": true,
4-
"semi": false,
53
"tabWidth": 2,
6-
"bracketSpacing": true,
7-
"jsxBracketSameLine": false,
8-
"arrowParens": "always",
9-
"trailingComma": "none"
4+
"useTabs": false
105
}

.storybook/main.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { StorybookConfig } from '@storybook/react-vite';
2+
import react from '@vitejs/plugin-react-swc';
3+
const config: StorybookConfig = {
4+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
5+
addons: [
6+
'@storybook/addon-links',
7+
'@storybook/addon-essentials',
8+
'@storybook/addon-interactions',
9+
],
10+
framework: {
11+
name: '@storybook/react-vite',
12+
options: {},
13+
},
14+
docs: {
15+
autodocs: 'tag',
16+
},
17+
// async viteFinal(config) {
18+
// config.plugins = [react()]
19+
// return config;
20+
// }
21+
};
22+
export default config;

.storybook/preview.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { Preview } from '@storybook/react';
2+
3+
const preview: Preview = {
4+
parameters: {
5+
actions: { argTypesRegex: '^on[A-Z].*' },
6+
controls: {
7+
matchers: {
8+
color: /(background|color)$/i,
9+
date: /Date$/,
10+
},
11+
},
12+
},
13+
};
14+
15+
export default preview;

.stylelintrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": ["stylelint-config-standard"],
3+
"ignoreFiles": [
4+
"build/**/*",
5+
"coverage/**/*",
6+
"dist/**/*",
7+
"storybook/**/*",
8+
"storybook-static/**/*"
9+
]
10+
}

0 commit comments

Comments
 (0)