# @cabify/eslint-config 中文文档

规范地址：https://npmcn.com/package/%40cabify/eslint-config/

版本：3\.0\.3
npm 元数据更新时间：2026-05-22T06:36:21.605Z
中文译文更新时间：2026-11-08T22:55:27.688Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40cabify/eslint-config
原文对照：https://npmcn.com/package/%40cabify/eslint-config/?lang=original
项目主页：https://github.com/cabify/eslint-config#readme
源码仓库：https://github.com/cabify/eslint-config

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：17.1 MB，12 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：未声明
- 运行依赖：12 个
- peer 依赖：eslint \>= 9\.11\.0，prettier \>= 2\.2\.1
- 首次发布：2021-10-22T07:32:58.699Z
- 最新版本发布：2026-05-22T06:36:21.203Z
- 近 30 天下载量：6220（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：55（近 12 个月 2 个）

## 中文简介

Cabify Javascript 项目的 ESLint 配置

## 安装

```sh
npm install @cabify/eslint-config
```

也可以使用：`pnpm add @cabify/eslint-config`、`yarn add @cabify/eslint-config`、`bun add @cabify/eslint-config`

## README

# @ cabify/eslint- config

![npm (scoped)](https://img.shields.io/npm/v/@cabify/eslint-config)

[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](https://npmcn.com/package/%40cabify/eslint-config/#readme-contributors-)

TS和JS的ESLint配置, Cabify方式.

## 安装

```sh
npm i -D @cabify/eslint-config eslint prettier
```

或者说

```sh
yarn add --dev @cabify/eslint-config eslint prettier
```

## 使用量

1.  创建一个 `.eslint.config.js` 在工程根处的文件 :

```js
import recommended from '@cabify/eslint-config';
/* Define an object for local configuration. 
/ You can add your custom configuration and override existing rules here before exporting it.
const localConfig = {};
export default [...recommended, localConfig];
*/
export default [...recommended];
```

2.  将线性任务添加到您的 `package.json`数字 :

```json
...
"scripts": {
  ...
  "lint:fix": "eslint ./ --fix",
  "lint": "eslint ./",
  ...
}
```

3.  添加一个 `.globalIgnores` 在你身边 `eslint.config.js` 以避免检查不想要的文件 :

```js
// https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores
const globalIgnores = {
  ignores: [
    'dist',
    'node_modules/*',
    'storybook-static/*',
    'test/*',
    'build',
    'scripts',
    'webpack',
  ],
};
export default [...recommended, globalIgnores];
```

### 格式化

重新推荐的配置不包括格式化规则,因为使用Prettier二进制会更快,带来更多的好处. 要格式化您的应用程序 a 中的文件, 并检查它们是否正确格式化, 您可以在您的应用程序中添加以下脚本 `package.json` 文件 :

```json
...
"scripts": {
  ...
  "format": "prettier --write .",
  "format:check": "prettier --check .",
  ...
}
```

### 类型脚本的设置

```js
const localConfigs = {
  languageOptions: {
    parserOptions: {
      project: './tsconfig.json',
      ecmaVersion: 2020,
    },
  },
  settings: {
    'import/resolver': {
      typescript: {
        alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
        project: '<root>/tsconfig.json',
      },
    },
  },
};

export default [...recommended, localConfigs];
```

3.  添加一个 `./tsconfig.eslint.json` 到您的项目根部. 注意:重要的是,你 `tsconfig.eslint.json` 文件包含 同样的文件,你要去涂入, 否则它会失败 并让林入如此缓慢.

```json
{
  "extends": "./tsconfig.json",
  "include": ["src/**/*", "test/**/*"] // remember to import also your test files if you want to lint them
}
```

#### 关于技术服务项目业绩的说明

还有一个已知的问题可能会影响与TS合作的项目的起伏时间. 如果你注意到你的 消磨时间是无法接受的, 有很多工作来改进它, 但它意味着禁用 一些规则。 如果你能活着没有他们, 就做这些改变你的 `.eslintrc` 配置 :

```json
{
  ...
  // remove the "project" field (if you don't have any other parserOptions you can remove the full section)
  "parserOptions": {},
  "rules": {
    // this rules depend on project field, so they must be disabled to make linting much faster
    "@typescript-eslint/await-thenable": "off",
    "@typescript-eslint/no-misused-promises": "off",
    "@typescript-eslint/no-unnecessary-type-assertion": "off",
    "@typescript-eslint/prefer-includes": "off",
    "@typescript-eslint/prefer-regexp-exec": "off",
    "@typescript-eslint/prefer-string-starts-ends-with": "off",
    "@typescript-eslint/require-await": "off",
    "@typescript-eslint/unbound-method": "off"
  }
}
```

### 发布新版本

-   更新 [变化](https://npmcn.com/package/%40cabify/eslint-config/CHANGELOG.md) 具有新特性, 断开更改等
-   检查你英寸 `main` 分支和一切是最新的.
-   运行 `yarn publish:<major|minor|patch>` 或者说 `yarn publish:canary` 为金丝雀版本.
-   运行 `git push && git push --tags`
-   请检查access-date=中的日期值 (帮助) 上次推后触发的所有测试动作均为QQ.
-   转到 [创建新发行](https://github.com/cabify/eslint-config/releases/new),选择先前所推动的标签并写入标题.
-   请检查date=中的日期值 (帮助) Npm 发布动作已成功完成 .
-   [检查 npm 包网页](https://www.npmjs.com/package/@cabify/eslint-config),该版本已在 `latest` 标签.

这将触发 Github 的工作流程, 它最终会发布到 npm .

## 贡献者

感谢这些伟大的人[emoji 密钥](https://allcontributors.org/docs/en/emoji-key):

<table><tbody><tr><td align="center"><a href="https://aarongarciah.com/" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/7225802?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>阿龙·加西亚·埃尔瓦斯</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=aarongarciah" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/alejandrofdiaz" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/9197247?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>亚历杭德罗</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=alejandrofdiaz" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/alexgallardo" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/7766614?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>亚历杭德罗·加利亚多·埃斯科瓦尔</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=alexgallardo" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/cicloon" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/818328?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>亚历杭德罗·莱昂</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=cicloon" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/AlexTemina" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/14157093?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>亚历克斯·特米纳</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=AlexTemina" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="http://www.ari.soy/" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/29388744?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>亚利安·扎尔加兰</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=ArianZargaran" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/carloscasalar" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/6154549?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>卡洛斯·卡斯蒂略</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=carloscasalar" title="Code" rel="nofollow noopener noreferrer">💻</a></td></tr><tr><td align="center"><a href="https://github.com/christiandebarrio" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/13832650?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>基督教徒</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=christiandebarrio" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/Crismmgg" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/56558107?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>克里斯姆格语Name</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=Crismmgg" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/d-asensio" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/13970905?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>戴维·阿森西奥·卡尼亚斯</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=d-asensio" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/inspiratweb" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/6814061?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>弗朗西斯科·桑切斯</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=inspiratweb" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/jalopez" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/259623?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>哈维尔·洛佩斯</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=jalopez" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/jmmerino" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/1152640?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>杰苏斯·梅里诺·帕拉</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=jmmerino" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://leireriel.github.io/leire-rico-portfolio/#/" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/48056077?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>莱尔·里科</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=leireriel" title="Code" rel="nofollow noopener noreferrer">💻</a></td></tr><tr><td align="center"><a href="https://github.com/riboher" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/11684090?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>里卡多·博卢达</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=riboher" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="http://www.siete3.com/" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/2030605?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>罗德里戈</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=area73" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/humanrender" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/161557?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>塞尔吉奥·拉米雷斯</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=humanrender" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://valya.codes/" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/7880641?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>瓦伦丁·柏林</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=valenber" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/YagoQuinoy" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/2685554?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>亚戈·基尼奥伊·洛巴里尼亚斯</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=YagoQuinoy" title="Code" rel="nofollow noopener noreferrer">💻</a></td><td align="center"><a href="https://github.com/alejandromolero" rel="nofollow noopener noreferrer"><img alt="" src="https://avatars.githubusercontent.com/u/5390467?v=4?s=100" width="100px;" loading="lazy" decoding="async" referrerpolicy="no-referrer"><br><sub><b>阿列扬德罗莫雷罗</b></sub></a><br><a href="https://github.com/cabify/eslint-config/commits?author=alejandromolero" title="Code" rel="nofollow noopener noreferrer">💻</a></td></tr></tbody></table>

本项目遵循 [全部贡献者](https://github.com/all-contributors/all-contributors) 规格。 任何捐款都欢迎!

## 常见问题

### @cabify/eslint-config 是什么？

Cabify Javascript 项目的 ESLint 配置

### 如何安装 @cabify/eslint-config？

在项目目录运行 npm install @cabify/eslint-config，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint（\>= 9\.11\.0）、prettier（\>= 2\.2\.1）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @cabify/eslint-config 支持 TypeScript 吗？

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

### @cabify/eslint-config 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @cabify/eslint-config 可以商用吗？

@cabify/eslint-config 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @cabify/eslint-config 的下载量有多少？

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

### @cabify/eslint-config 还在维护吗？

最新版本 3\.0\.3 发布于 2026/05/22（5 个月前）；至今共发布 55 个版本，其中过去 12 个月发布了 2 个；首次发布于 2021/10/22。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

