@bluzzi/eslint-config

中文文档
2.4.2发布于 2026/11/03MITTypeScriptES Module近 30 天下载 3449

ESLint configuration preset for linting and formatting all your files

原始使用文档
文档目录8 节
  1. Installation
  2. Packages
  3. Configuration file
  4. Scripts
  5. VS Code support
  6. Customization
  7. Thanks
  8. License

@bluzzi/eslint-config

A ready-to-use ESLint config preset that's highly opinionated and strict on best practices, allowing you to both lint and format your JavaScript and TypeScript files.

  • 📖 formatting (Prettier alternative) with only basic configurations (semi, quotes, indent)
  • ⚒️ very strict rules for JS and TS, which encourages best practices
  • 🌏 designed to work with TS, JSX and React
  • ✅ automatically enables specific rules based on your dependencies
  • 🧲 uses the recommended shared configs (ESLint, TSLint, Stylistic...)

If you're looking for a less opinionated configuration with more customization possibilities, I recommend you the Antfu preset.

Installation

Installing the config preset in your project.

Packages

npm install -D eslint @bluzzi/eslint-config
yarn add --dev eslint @bluzzi/eslint-config
pnpm install -D eslint @bluzzi/eslint-config

Configuration file

Create the eslint.config.mjs file at the root of the project and add the minimum configuration:

import { eslintConfig } from "@bluzzi/eslint-config";

export default eslintConfig();

Scripts

In your package.json file, you can optionally add the following scripts to easily run ESLint in your project:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

VS Code support

Installation and configuration of the VS Code plugin to take advantage of an automatic correction when saving a file, as well as a display of problems.

Install VS Code ESLint extension and add the following settings to your .vscode/settings.json:

{
  // Disable the default formatter, use eslint instead:
  "prettier.enable": false,
  "editor.formatOnSave": false,

  // Auto fix:
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },

  // Silent the stylistic rules in you IDE, but still auto fix them:
  "eslint.rules.customizations": [
    { "rule": "style/*", "severity": "off", "fixable": true },
    { "rule": "format/*", "severity": "off", "fixable": true },
    { "rule": "*-indent", "severity": "off", "fixable": true },
    { "rule": "*-spacing", "severity": "off", "fixable": true },
    { "rule": "*-spaces", "severity": "off", "fixable": true },
    { "rule": "*-order", "severity": "off", "fixable": true },
    { "rule": "*-dangle", "severity": "off", "fixable": true },
    { "rule": "*-newline", "severity": "off", "fixable": true },
    { "rule": "*quotes", "severity": "off", "fixable": true },
    { "rule": "*semi", "severity": "off", "fixable": true }
  ],

  // Enable eslint for all supported languages:
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ]
}

Customization

You can adjust some formatting options for your code, but we recommend sticking to Stylistic's default rules for consistency within the JS community:

export default eslintConfig({
  stylistic: {
    indent: 2,
    quotes: "single",
    semi: false,
  },
});

You can make full use of the power of ESLint's flat configs to extend the configuration as much as you like:

export default eslintConfig(
  {
    // The configuration options offered by our package
  },

  // From the second arguments they are ESLint Flat Configs
  // you can have multiple configs:
  {
    files: ["**/*.ts"],
    rules: {},
  },
  {
    rules: {},
  },
);

Thanks

License

This package is MIT licensed.

版本与发布记录

@bluzzi/eslint-config 共发布 57 个版本,首次发布于 2022/11/18;过去 12 个月发布了 9 个版本。

版本发布日期距今
2.4.2latest2026/11/034 天前
2.4.12026/10/318 天前
2.4.02026/10/308 天前
2.3.02026/10/2910 天前
2.2.42026/07/024 个月前
2.2.32026/03/247 个月前

关于 @bluzzi/eslint-config 的常见问题

@bluzzi/eslint-config 是什么?

ESLint configuration preset for linting and formatting all your files

如何安装 @bluzzi/eslint-config?

在项目目录运行 npm install @bluzzi/eslint-config,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:eslint(>=9.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bluzzi/eslint-config 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bluzzi/eslint-config 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bluzzi/eslint-config 可以商用吗?

@bluzzi/eslint-config 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bluzzi/eslint-config 的下载量有多少?

根据 npm 官方下载统计,@bluzzi/eslint-config 在 2026/10/09 – 2026/11/07 这 30 天内被下载 3,449 次,日均约 115 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bluzzi/eslint-config 还在维护吗?

最新版本 2.4.2 发布于 2026/11/03(4 天前);至今共发布 57 个版本,其中过去 12 个月发布了 9 个;首次发布于 2022/11/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。