@fluidframework/eslint-config-fluid

中文文档
14.0.0发布于 2026/08/07MITCommonJS近 30 天下载 6948

Shareable ESLint config for the Fluid Framework

原始使用文档
文档目录11 节
  1. Requirements
  2. Usage
  3. ESLint 8.21+ Users
  4. Modular Structure
  5. Configurations
  6. Recommended
  7. Strict
  8. Strict-Biome
  9. Changing the lint config
  10. Tracking lint config changes over time
  11. Scripts

@fluidframework/eslint-config-fluid

This package contains a shared ESLint config used by all the packages in the Fluid Framework repo.

Requirements

  • ESLint 9 (recommended), or
  • ESLint 8.21+ with ESLINT_USE_FLAT_CONFIG=true environment variable

This package uses ESLint's flat config format exclusively. Legacy .eslintrc format is not supported.

Usage

Import the desired configuration and spread it into your eslint.config.mts:

// eslint.config.mts
import { strict } from "@fluidframework/eslint-config-fluid";
export default [...strict];

The package root exports the standard flat and server configs. For specialized cases, explicit subpaths are also available: @fluidframework/eslint-config-fluid/flat.mts and @fluidframework/eslint-config-fluid/server.mts.

ESLint 8.21+ Users

If you're using ESLint 8.21-8.x, you must enable flat config support via environment variable:

ESLINT_USE_FLAT_CONFIG=true eslint .

Or in your npm scripts:

{
    "scripts": {
        "lint": "cross-env ESLINT_USE_FLAT_CONFIG=true eslint ."
    }
}

Note: ESLint 8.x flat config support was experimental. We recommend upgrading to ESLint 9 for the best experience.

Modular Structure

The flat config is organized into a modular structure for maintainability:

eslint-config-fluid/
├── flat.mts                    # Main entry point (~30 lines)
├── library/
│   ├── constants.mts           # Shared constants (ignores, file patterns, import restrictions)
│   ├── settings.mts            # Plugin settings (import-x, jsdoc)
│   ├── rules/
│   │   ├── base.mts            # Base rules from eslint:recommended, typescript-eslint, etc.
│   │   ├── recommended.mts     # Rules for recommended config (unicorn, type safety)
│   │   └── strict.mts          # Rules for strict config (jsdoc requirements, explicit access)
│   └── configs/
│       ├── base.mts            # Base config builder with all plugins
│       ├── overrides.mts       # Shared overrides (test files, React, JS files)
│       └── factory.mts         # Config factory functions

This structure ensures:

  • No single file exceeds ~250 lines
  • Single source of truth for constants and settings
  • Each module has a single responsibility
  • Easy to understand and maintain

Configurations

The standard named config for use in Fluid Framework libraries.

import { recommended } from "@fluidframework/eslint-config-fluid";
export default [...recommended];

This configuration is recommended for all libraries in the repository, though use of the strict config is preferred whenever reasonable.

Strict

The strictest config for use in Fluid Framework libraries. Recommended for highest code quality enforcement.

import { strict } from "@fluidframework/eslint-config-fluid";
export default [...strict];

Use of this config is encouraged for libraries with public facing APIs, and those used as external-facing examples (e.g. those mentioned on fluidframework.com).

Strict-Biome

A version of the "strict" config that disables rules covered by Biome's "recommended" lint config. Intended for projects using both ESLint and Biome.

import { strictBiome } from "@fluidframework/eslint-config-fluid";
export default [...strictBiome];

Changing the lint config

If you want to change the shared lint config (that is, this package), you need to do the following:

  1. Make the change in the config.
  2. Publish a pre-release package.
  3. Update the core packages to use the pre-release lint config.

When updating the lint config (step 1), run npm run build and commit any resulting changes.

Tracking lint config changes over time

One question that comes up often when we make changes to our lint config is, "what changed?" This applies even when we don't make any changes other than upgrading deps, because the dependency upgrade might include a new rule.

ESLint provides a way to print the config that would apply to a file (--print-config), so we use this capability to print out the applied config as a JSON file. As we make changes to the config, we can print out the config again and get a diff to review as part of a PR -- just like we do with API reports for code changes.

Scripts

ScriptDescription
buildnpm run print-config
build:readme:disabledmarkdown-magic --files "**/*.md"
cleanrimraf --glob dist "**/*.build.log"
formatnpm run prettier:fix
install-no-frozenpnpm --config.minimum-release-age=10080 i --no-frozen-lockfile
prettierprettier --check .
prettier:fixprettier --write .
print-configstsx scripts/print-configs.ts printed-configs
testecho TODO: add tests in @fluidframework/eslint-config-fluid
test:mochamocha "src/test/**/*.test.mts"

See GitHub for more details on the Fluid Framework and packages within.

版本与发布记录

@fluidframework/eslint-config-fluid 共发布 76 个版本,首次发布于 2020/09/01;过去 12 个月发布了 5 个版本。

版本发布日期距今
14.0.0latest2026/08/073 个月前
13.0.02026/06/105 个月前
12.0.02026/06/035 个月前
10.0.02026/04/166 个月前
9.0.02026/03/287 个月前
8.1.02025/11/041 年前

其他发布通道:next → 3.2.0-225617,dev → 5.4.0-289708。

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

@fluidframework/eslint-config-fluid 是什么?

Shareable ESLint config for the Fluid Framework

如何安装 @fluidframework/eslint-config-fluid?

在项目目录运行 npm install @fluidframework/eslint-config-fluid,或使用 pnpm add / yarn add / bun add。

@fluidframework/eslint-config-fluid 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fluidframework__eslint-config-fluid 是否存在。

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

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fluidframework/eslint-config-fluid 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.22.2。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fluidframework/eslint-config-fluid 可以商用吗?

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

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

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

@fluidframework/eslint-config-fluid 还在维护吗?

最新版本 14.0.0 发布于 2026/08/07(3 个月前);至今共发布 76 个版本,其中过去 12 个月发布了 5 个;首次发布于 2020/09/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。