@alint-js/config

中文文档
0.7.3发布于 2026/09/29MITTypeScriptES Module近 30 天下载 9.4万

Configuration loading and setup utilities for alint

原始使用文档
文档目录5 节
  1. What it does
  2. How to use
  3. Plugin lockfile
  4. When to use
  5. When not to use

@alint-js/config

Config loading and setup-file utilities for alint.

What it does

This package owns the file-system side of configuration:

  • loads alint.config.ts
  • resolves global and project setup TOML paths
  • parses and stringifies setup TOML
  • merges setup layers
  • writes provider setup files
  • reads Stop Gate integration settings and writes their non-default TOML overrides
  • installs remote plugin packages or local plugin directories and writes .alint/plugins/lock.json
  • exports built-in ignore pattern groups for lower-level tooling

It is used by @alint-js/cli and is useful for tools that need to inspect or prepare an alint project without running the linter.

Ordinary alint.config.* files should import ignore presets through the @alint-js/cli facade so projects only need the CLI package.

How to use

import {
  getGlobalSetupConfigPath,
  installStaticPlugins,
  loadAlintConfig,
  loadSetupConfig,
  writeSetupConfig,
} from '@alint-js/config'

const setupPath = getGlobalSetupConfigPath()
const cwd = process.cwd()
const setup = await loadSetupConfig(setupPath)

await installStaticPlugins({ cwd })

const config = await loadAlintConfig(cwd)

await writeSetupConfig(setupPath, setup)

Stop Gate configuration uses the project config's integrations.stopGate field and remains inactive unless that field explicitly contains enabled = true. setStopGateConfig only extends the existing TOML write path; it does not add new writable formats or output-path selection.

Static configs can use TOML, YAML, JSON, JSONC, or JSON5. They are data-only alternatives to executable JavaScript and TypeScript flat configs, and identify plugin sources with strings.

For example, TOML supports exact remote packages, config-relative directories, and native absolute paths:

[[config.group]]

[config.group.plugins]
plugin_1 = "@scope/[email protected]" # package
plugin_2 = "./plugins/relative-plugin-examplex" # relative directory
plugin_3 = "/opt/alint/plugins/absolute-plugin" # absolute directory

Relative paths use the config file's directory as their base. Windows native paths should use TOML literal strings so backslashes remain literal:

[[config.group]]

[config.group.plugins]
native = 'C:\alint\plugins\native-plugin'

Use installStaticPlugins after adding or changing plugin sources.

  • Package: downloads the exact package version into .alint/plugins/store, verifies its integrity, and locks the installed snapshot.
  • Local: installs the directory in place, validates its package root export, and locks its physical directory identity. It does not build the plugin or install its dependencies.

Run installation again after changing a source string, moving a local directory, or changing its symlink target. Changes inside the same local directory are loaded by the next process without reinstalling.

Plugin lockfile

.alint/plugins/lock.json stores package snapshots with integrity metadata and local directory source identities. Local plugin code executes as trusted Node.js; containment checks are not a sandbox.

When to use

  • You are building CLI commands, editors, or automation around alint config.
  • You need to read or write provider setup TOML.
  • You need to load alint.config.* outside the official CLI.
  • You need to install remote packages or local plugin directories before loading static config.
  • You need the same ignore defaults as the official CLI in lower-level tooling.

When not to use

  • Use @alint-js/cli when you only need the alint command or an ordinary alint.config.* file.
  • Use @alint-js/core when you need the rule DSL, source runtime, model resolution, or run engine.

版本与发布记录

@alint-js/config 共发布 51 个版本,首次发布于 2026/07/02;过去 12 个月发布了 51 个版本。

版本发布日期距今
0.7.3latest2026/09/291 个月前
0.7.22026/09/281 个月前
0.7.12026/08/292 个月前
0.7.02026/08/292 个月前
0.6.02026/08/192 个月前
0.5.02026/08/162 个月前

关于 @alint-js/config 的常见问题

@alint-js/config 是什么?

Configuration loading and setup utilities for alint

如何安装 @alint-js/config?

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

@alint-js/config 支持 TypeScript 吗?

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

@alint-js/config 支持 ESM 还是 CommonJS?

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

@alint-js/config 可以商用吗?

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

@alint-js/config 的下载量有多少?

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

@alint-js/config 还在维护吗?

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