@anolilab/lint-staged-config

中文文档
14.0.0发布于 2026/10/22MITTypeScriptES Module构建来源已验证近 30 天下载 4798

Shareable Lint-Staged Config for any project.

原始使用文档
文档目录13 节
  1. Shareable Lint-Staged Config for any project.
  2. Purpose
  3. Install
  4. Usage
  5. Config
  6. Configuration
  7. Husky
  8. Related
  9. Supported Node.js Versions
  10. Contributing
  11. Credits
  12. Made with ❤️ at Anolilab
  13. License
lint-staged-config

Shareable Lint-Staged Config for any project.


typescript-image mit licence npm downloads Chat PRs Welcome


Daniel Bannert's open source work is supported by the community on GitHub Sponsors


Simplify your project setup with our comprehensive collection of preconfigured configuration files. Designed for effortless integration, these ready-to-use files can be seamlessly imported into your projects. These functions streamline the utilization of lint-staged / nano-staged alongside popular tools such as ESLint, Prettier, StyleLint and SecretLint.

Say goodbye to complex configurations and enjoy a smoother development experience with our all-inclusive package.

Purpose

  • Enhance your development workflow with hassle-free and readily shareable lint-staged / nano-staged configuration files.
  • These files empower developers to maintain a uniform coding style and detect prevalent errors even before they are added to the source control system.
  • Additionally, our inclusive helper module offers convenient utility functions that seamlessly integrate lint-staged with popular linting and formatting tools.

Install

npm install @anolilab/lint-staged-config
yarn add @anolilab/lint-staged-config
pnpm add @anolilab/lint-staged-config

Usage

If you don’t have a .lintstagedrc.js or .nano-staged.js, we can create the file for you after installing @anolilab/lint-staged-config, call pnpm lint-stage-config:install.

If you already have a .lintstagedrc.js or .nano-staged.js, then you can extend the .lintstagedrc.js or .nano-staged.js, with @anolilab/lint-staged-config.

Note: If the script detects an existing .lintstagedrc.js or .nano-staged.js file, it will not overwrite it.

The content of the .lintstagedrc.js or .nano-staged.js should look :

// or

import { defineConfig } from "@anolilab/lint-staged-config";

const { defineConfig } = require("@anolilab/lint-staged-config");

module.exports = defineConfig();

export default defineConfig();

Config

You can configure @anolilab/lint-staged-config options inside the defineConfig function.

// or

import { defineConfig } from "@anolilab/lint-staged-config";

const { defineConfig } = require("@anolilab/lint-staged-config");

module.exports = defineConfig({
    // Add your configuration here
});

export default defineConfig({
    // Add your configuration here
});

Configuration

The default configuration, automatically adds the following linting and formatting tools, if the needed dependencies are installed.

All this tools configuration are exported at @anolilab/lint-staged-config/group/... and can be used to extend your configuration, without including the auto config.

Husky

If you want to use husky to run the lint-staged script, you can use the following configuration.

Adding the following script to your root package.json file makes it easier to run the husky command:

pnpm pkg set scripts.prepare="is-ci || husky install || exit 0"

This script will install husky only if it's not running in a CI environment.

After that you can find a .husky folder in your root directory, with a pre-commit (if not please create it) file.

The file content can look :

#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

# The hook should exit with non-zero status after issuing
# an appropriate message if it wants to stop the commit.

echo --------------------------------------------
echo Starting Git hook: pre-commit

./node_modules/.bin/lint-staged --verbose --concurrent false

echo Finished Git hook: pre-commit
echo --------------------------------------------

Or with nano-staged:

#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

# The hook should exit with non-zero status after issuing
# an appropriate message if it wants to stop the commit.

echo --------------------------------------------
echo Starting Git hook: pre-commit

./node_modules/.bin/nano-staged

echo Finished Git hook: pre-commit
echo --------------------------------------------

Our package includes a lint-stage-config:install command to add the pre-commit, common.sh, prepare-commit-msg hooks to your .husky` folder.

If commitzen is installed, the prepare-commit-msg hook with predefined content will be added to your .husky folder.

Supported Node.js Versions

Libraries in this ecosystem make the best effort to track Node.js’ release schedule.

Here’s a post on why we think this is important.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guidelines.

Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

Made with ❤️ at Anolilab

This is an open source project and will always remain free to use. If you think it’s cool, please star it 🌟. Anolilab is a Development and AI Studio. Contact at [email protected] if you need any help with these technologies or want to say hi!

License

The anolilab lint-staged-config is open-sourced software licensed under the MIT

版本与发布记录

@anolilab/lint-staged-config 共发布 108 个版本,首次发布于 2023/06/29;过去 12 个月发布了 41 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
14.0.0latest2026/10/2215 天前
13.0.12026/10/1423 天前
13.0.02026/10/1323 天前
12.0.42026/10/1324 天前
12.0.32026/10/0730 天前
12.0.22026/10/0630 天前

关于 @anolilab/lint-staged-config 的常见问题

@anolilab/lint-staged-config 是什么?

Shareable Lint-Staged Config for any project.

如何安装 @anolilab/lint-staged-config?

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

@anolilab/lint-staged-config 支持 TypeScript 吗?

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

@anolilab/lint-staged-config 支持 ESM 还是 CommonJS?

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

@anolilab/lint-staged-config 需要什么版本的 Node.js?

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

@anolilab/lint-staged-config 可以商用吗?

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

@anolilab/lint-staged-config 的下载量有多少?

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

@anolilab/lint-staged-config 还在维护吗?

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