workleap-web-configs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesewl-web-configs
wl-web-configs
Workleap's shared configuration library for web tooling. Provides pre-configured packages for ESLint, TypeScript, Rsbuild, Rslib, Stylelint, and Browserslist.
Workleap的Web工具共享配置库。提供预配置的ESLint、TypeScript、Rsbuild、Rslib、Stylelint和Browserslist包。
Philosophy
设计理念
- No lock-in: Default configurations can always be extended or overridden
- By project type: Configurations are composed internally and offered per project type for simplicity
- ESM/ESNext by default: Targets modern JavaScript environments
- Distributed via NPM: Easy to adopt new features by bumping package versions
- 无锁定:默认配置始终可扩展或覆盖
- 按项目类型划分:配置在内部组合,按项目类型提供以简化使用
- 默认ESM/ESNext:面向现代JavaScript环境
- 通过NPM分发:只需升级包版本即可轻松采用新功能
Supported Tools (Active)
支持的工具(活跃维护)
| Tool | Package | Purpose |
|---|---|---|
| Browserslist | | Browser targets for apps |
| ESLint | | Code linting |
| Stylelint | | CSS linting |
| TypeScript | | Type checking (linting only) |
| Rsbuild | | Web application bundling |
| Rslib | | Library bundling |
In maintenance mode (do not recommend): PostCSS, SWC, webpack, tsup
| 工具 | 包 | 用途 |
|---|---|---|
| Browserslist | | 应用的浏览器目标配置 |
| ESLint | | 代码检查 |
| Stylelint | | CSS检查 |
| TypeScript | | 类型检查(仅检查) |
| Rsbuild | | Web应用打包 |
| Rslib | | 库打包 |
维护模式(不推荐使用):PostCSS、SWC、webpack、tsup
Quick Reference
快速参考
Which Configuration to Use?
如何选择配置?
| Project Type | ESLint | TypeScript | Bundler |
|---|---|---|---|
| Web app with React | | | |
| React library | | | |
| TypeScript library (no React) | | | |
| Monorepo workspace root | | | N/A |
| 项目类型 | ESLint | TypeScript | 打包工具 |
|---|---|---|---|
| 带React的Web应用 | | | |
| React库 | | | |
| TypeScript库(无React) | | | |
| 单体仓库工作区根目录 | | | 无 |
Browserslist (Apps Only)
Browserslist(仅适用于应用)
bash
pnpm add -D @workleap/browserslist-config browserslisttext
undefinedbash
pnpm add -D @workleap/browserslist-config browserslisttext
undefined.browserslistrc
.browserslistrc
extends @workleap/browserslist-config
Only for projects emitting application bundles. Libraries should NOT include Browserslist.
To add custom browser targets while still using the shared config:
```textextends @workleap/browserslist-config
仅适用于生成应用包的项目。库不应包含Browserslist配置。
如需在使用共享配置的同时添加自定义浏览器目标:
```text.browserslistrc
.browserslistrc
extends @workleap/browserslist-config
IE 11
last 2 OperaMobile 12.1 versions
undefinedextends @workleap/browserslist-config
IE 11
last 2 OperaMobile 12.1 versions
undefinedReference Guide
参考指南
For comprehensive setup guides, options, and examples, read the appropriate reference file:
- ESLint — references/eslint.md: Installation, functions, rule categories, customization, and VS Code integration
define*Config - TypeScript — references/typescript.md: Config files by project type, compiler option overrides, path mappings, and CLI scripts
- Rsbuild — references/rsbuild.md: Dev/build/Storybook configs, predefined options, transformers, and Turborepo setup
- Rslib — references/rslib.md: Library build/dev/Storybook configs, bundleless vs bundle, transformers, and type declarations
- Stylelint — references/stylelint.md: Installation, setup, Prettier integration, and VS Code settings
.stylelintrc.json
如需全面的设置指南、选项和示例,请阅读相应的参考文件:
- ESLint — references/eslint.md:安装、函数、规则分类、自定义及VS Code集成
define*Config - TypeScript — references/typescript.md:按项目类型划分的配置文件、编译器选项覆盖、路径映射及CLI脚本
- Rsbuild — references/rsbuild.md:开发/构建/Storybook配置、预定义选项、转换器及Turborepo设置
- Rslib — references/rslib.md:库构建/开发/Storybook配置、无打包与打包模式、转换器及类型声明
- Stylelint — references/stylelint.md:安装、设置、Prettier集成及VS Code配置
.stylelintrc.json
Critical Rules
重要规则
- Never invent APIs: Only suggest documented options and patterns
- Respect maintenance mode: Do not recommend PostCSS, SWC, webpack, or tsup configs
- ESM by default: All configs target ESM/ESNext unless migrating legacy code
- Browserslist for apps only: Libraries should not include Browserslist config
- TypeScript for linting: The shared TypeScript configs focus on linting; bundlers handle transpilation
- 切勿自创API:仅建议使用已文档化的选项和模式
- 尊重维护模式:不推荐使用PostCSS、SWC、webpack或tsup配置
- 默认ESM:所有配置均以ESM/ESNext为目标,除非迁移遗留代码
- Browserslist仅用于应用:库不应包含Browserslist配置
- TypeScript用于检查:共享TypeScript配置专注于检查;打包工具负责转译