@ggbondz/eslint-flat-config
v1.0.1
Published
ESLint config
Downloads
5
Readme
@zren/eslint-flat-config npm
为JavaScript、TypeScript、Vue 2或Vue 3预设的固执己见的ESLint配置, 和Prettier。
Features
-使用Prettier格式化。
-设计用于与TypeScript、Vue 2和3配合使用。
-支持JSON(5)、YAML、Markdown...
-对导入进行排序,package.json
,tsconfig.json
...
-ESLint Flat config
-忽略常见文件,如“dist”、“node_modules”、“coverage”和“.gitignore”中的文件。
-合理的默认值、最佳实践、只有一行配置
-合理严格,但代码质量更好。
Install
npm i -D @zren/eslint-flat-config
需要 Node.js >= 18.18, and ESLint >= 9.5.0.
Usage
import { config } from ' @zren/eslint-flat-config'
export default config(
[
/* your custom config */
],
// Features: it'll detect installed dependency and enable necessary features automatically
{
prettier: true,
markdown: true,
vue: true, // auto detection
unocss: false, // auto detection
},
)
Presets
// eslint.config.js
import {
presetJavaScript, // Ignore common files and include javascript support
presetJsonc, // Includes basic json(c) file support and sorting json keys
presetLangsExtensions, // Includes markdown, yaml + `presetJsonc` support
presetBasic, // Includes `presetJavaScript` and typescript support
// Includes
// - `presetBasic` (JS+TS) support
// - `presetLangsExtensions` (markdown, yaml, jsonc) support
// - Vue support
// - UnoCSS support (`uno.config.ts` is required)
// - Prettier support
presetAll,
} from ' @zren/eslint-flat-config'
export default presetAll
查看 preset.ts 更多配置.