2.1 安装 eslint
@lousanpang/eslint-config
cd apps/web/[projectName]
pnpm add eslint -D
pnpm add @lousanpang/eslint-config -D --workspace
2.2 创建 eslint.config.mjs
配置文件
// eslint.config.mjs
import antfu from '@lousanpang/eslint-config'
export default antfu
// package.json
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"devDependencies": {
"@lousanpang/eslint-config": "workspace:*",
"eslint": "^9.9.1"
}
}
3.1 安装 typescript
@lousanpang/typescript-config
cd apps/web/[projectName]
pnpm add typescript -D
pnpm add @lousanpang/typescript-config -D --workspace
// tsconfig.json
{
"extends": "@lousanpang/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src"
],
"exclude": [
"node_modules",
"dist"
]
}
import Counter from '@lousanpang/ui/counter'
<Counter />
cd apps/web/[projectName]
pnpm add @lousanpang/utils -D --workspace
6.2 使用 @lousanpang/utils
工具库
import { add } from '@lousanpang/utils/add'
add(1, 2)