Single page app template by kxphotographer
- Vite
- Preact
- Typescript
- Tailwind CSS
- ESLint
- Prettier
Manual setup after initializing Preact project
Added Tailwind CSS
- To simplify style management of each components
- Add utility function to get along with conditional classes
- To eliminate parent-traversing relative import
- Make Vite respect the config with the help of
vite-tsconfig-paths
Enabled strict mode on tsconfig.json
- To opt in strict options which are currently available and will be available in the future
Set up linters
- ESLint for code structure
- i.e. hook dependencies, with the help of
eslint-plugin-react-hooks
which eslint-config-preact
includes
- To prevent bugs and improve performance of component
- Prettier for code format
- Once I wondered if I set
semi
false
to require trailing semicolons, but they cannot be omitted in some cases (i.e. IIFE after another function definition). So I finally decided to require them.
- Run them on Github Actions when pushed
Future plan
- Checking that files are following
.editorconfig
rules on CI
- Linting import statements
- Order
- Vertical whitespaces between groups
- Always require
type
keyword for type imports
- Forbid parent-traversing import
- Unit tesging by Jest
Command line memo
Initializing preact project
$ yarn create preact
yarn create v1.22.19
[1/4] š Resolving packages...
[2/4] š Fetching packages...
[3/4] š Linking dependencies...
[4/4] šØ Building fresh packages...
success Installed "[email protected]" with binaries:
- create-preact
[#####################################################################] 239/239
ā Preact - Fast 3kB alternative to React with the same modern API
ā
ā Project directory:
ā preact-template
ā
ā Project Type:
ā Single Page Application (only client-side)
ā
ā Project language:
ā TypeScript
ā
ā Use router?
ā Yes
ā
ā Use ESLint?
ā Yes
ā
ā Set up project directory
ā
ā Installed project dependencies
ā
ā Getting Started āāāāāāā®
ā ā
ā $ cd preact-template ā
ā $ yarn dev ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāÆ
ā
ā You're all set!
⨠Done in 40.15s.