# eslint-config-ali

> ESLint Shareable Config for Alibaba F2E Guidelines

Latest version **16.6.0** (published 2025-12-31) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install eslint-config-ali
pnpm add eslint-config-ali
yarn add eslint-config-ali
bun add eslint-config-ali
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 16.6.0 |
| Published | 2025-12-31 |
| First published | 2016-12-06 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.8.0 |
| Dependencies | 13 |
| Unpacked size | 95.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1132 |
| Author | Sabo |
| Maintainers | jeason, bowei.jbw, cstyles, lakerswgq, guoyunhe |
| Keywords | eslint, eslintconfig, f2elint, Alibaba F2E Guidelines |

## Links

- npm: https://www.npmjs.com/package/eslint-config-ali
- Repository: https://github.com/alibaba/f2e-spec
- Issues: https://github.com/alibaba/f2e-spec/issues
- Funding: https://github.com/sponsors/alibaba
- npm.io page: https://npm.io/package/eslint-config-ali

## Dependencies (13)

- [globals](https://npm.io/package/globals.md) ^15.15.0
- [@eslint/js](https://npm.io/package/@eslint/js.md) ^9.34.0
- [typescript](https://npm.io/package/typescript.md) ^5.9.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.28.3
- [@eslint/compat](https://npm.io/package/@eslint/compat.md) ^1.3.2
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.28.3
- [typescript-eslint](https://npm.io/package/typescript-eslint.md) ^8.41.0
- [@babel/preset-react](https://npm.io/package/@babel/preset-react.md) ^7.27.1
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) ^7.37.5
- [@babel/eslint-parser](https://npm.io/package/@babel/eslint-parser.md) ^7.28.0
- [@stylistic/eslint-plugin](https://npm.io/package/@stylistic/eslint-plugin.md) ^4.4.1
- [eslint-plugin-react-hooks](https://npm.io/package/eslint-plugin-react-hooks.md) ^5.2.0
- [@babel/plugin-proposal-decorators](https://npm.io/package/@babel/plugin-proposal-decorators.md) ^7.28.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 16.6.0 (latest) — 2025-12-31
- 16.0.0-beta.2 (beta) — 2025-02-05
- 10.3.3 (old-version) — 2020-10-13
- 16.5.1 — 2025-11-11
- 16.5.0 — 2025-08-14
- 16.4.0 — 2025-08-11
- 16.3.0 — 2025-05-12
- 16.2.0 — 2025-04-26
- 16.1.1 — 2025-03-04
- 16.1.0 — 2025-03-03
- 16.0.3 — 2025-02-26
- 16.0.2 — 2025-02-26
- 16.0.1 — 2025-02-26
- 16.0.0 — 2025-02-22
- 16.0.0-beta.1 — 2025-02-05
- … 67 more at https://npm.io/package/eslint-config-ali/versions

## README

# eslint-config-ali

![Version](https://img.shields.io/npm/v/eslint-config-ali)
![Downloads](https://img.shields.io/npm/dw/eslint-config-ali)

本包是[《阿里巴巴前端规约》](https://github.com/alibaba/f2e-spec)配套的 [ESLint 可共享配置](http://eslint.org/docs/developer-guide/shareable-configs.html)，提供了多套配置文件以支持 JavaScript、TypeScript、React、Vue、Node.js 等多种项目类型。

## f2elint 接入（推荐）

```bash
npx f2elint
```

## 手动接入

```bash
npm install --save-dev eslint@^9 eslint-config-ali
```

### 基础 JavaScript/TypeScript 项目

```js
// eslint.config.mjs
import { base } from 'eslint-config-ali';

export default [...base];
```

### React JavaScript/TypeScript 项目

针对 JS React 项目，继承了默认配置，并启用了 [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) 和 [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) 的规则。

ESLint 配置：

```js
// eslint.config.mjs
import { react } from 'eslint-config-ali';

export default [...react];
```

## 了解更多

- 如果你对 ESLint 还不熟悉，可以阅读官网的 [Getting Started](https://eslint.org/docs/user-guide/getting-started) 快速入门。
- 了解如何为 IDE 配置 ESLint，可以参考官网的 [Integrations](http://eslint.org/docs/user-guide/integrations)。
- 了解如何在继承本包的基础上对项目 ESLint 进行个性化配置，可参考官网的 [Configuring ESLint](https://eslint.org/docs/user-guide/configuring)。下面简介下 ESLint 配置中的几个常用字段：
  - `extends`: 继承一组规则集。`"extends": "eslint-config-ali",` 表示继承本包定义的规则配置。
  - `rules`: 配置规则，这里定义的规则会覆盖 `extends` 的规则。如果觉得本包开启的某条规则过于严格，你可以暂时在这里将其关闭。
  - `parser`: 设置 ESLint 的解析器。ESLint 使用 espree 作为默认的解析器，可以通过这个参数指定其他的解析器。比如指定为 [@babel/eslint-parser](https://npmjs.com/package/@babel/eslint-parser)，以解析 Babel 支持但 ESLint 默认解析器不支持的语法（本包不同配置文件使用的解析器可在简介表格中的「依赖 parser」一列查看）。
  - `globals`: 指定代码中可能用到的全局变量，以免全局变量被 [no-undef](http://eslint.org/docs/rules/no-undef) 规则报错。
  - `env`: 指定代码的运行环境，每个环境预定义了一组对应的全局变量，本包已开启的环境有 browser、node、jquery、es6 及几个测试框架的环境。
- 了解常用的 ESLint 命令，如 `--fix`、`--ext`，可参考官网的 [Command Line Interface](http://eslint.org/docs/user-guide/command-line-interface)。

---
_Source: https://npm.io/package/eslint-config-ali · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
