# @ecomfe/eslint-config

> ESLint config for Baidu EFE.

Latest version **8.0.0** (published 2023-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ecomfe/eslint-config
pnpm add @ecomfe/eslint-config
yarn add @ecomfe/eslint-config
bun add @ecomfe/eslint-config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 8.0.0 |
| Published | 2023-09-15 |
| First published | 2018-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 70.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 119 |
| Author | otakustay |
| Maintainers | leeight, otakustay, ecomfe-admin, ecomfe-core, errorrik, gdjinbo, justineo, luyuan, ksky521, lang, jinzhan |

## Links

- npm: https://www.npmjs.com/package/@ecomfe/eslint-config
- Repository: https://github.com/ecomfe/eslint-config
- Homepage: https://github.com/ecomfe/eslint-config#readme
- Issues: https://github.com/ecomfe/eslint-config/issues
- npm.io page: https://npm.io/package/@ecomfe/eslint-config

## Dependencies (1)

- [semver](https://npm.io/package/semver.md) ^7.3.5

## Recent versions

- 8.0.0 (latest) — 2023-09-15
- 9.0.0-beta.1 (beta) — 2025-11-06
- 9.0.0-beta.0 — 2025-08-12
- 7.5.1 — 2023-07-17
- 7.5.0 — 2023-07-17
- 7.4.0 — 2022-01-01
- 7.3.0 — 2021-08-30
- 7.2.1 — 2021-08-10
- 7.2.0 — 2021-08-04
- 7.1.0 — 2021-03-29
- 7.0.0 — 2020-12-28
- 6.2.1 — 2020-12-11
- 6.2.0 — 2020-12-09
- 6.1.0 — 2020-11-13
- 6.0.1 — 2020-10-22
- … 21 more at https://npm.io/package/@ecomfe/eslint-config/versions

## README

# @ecomfe/eslint-config

EFE 团队使用的 ESLint 配置。

## 安装

```shell
npm i -D eslint @babel/eslint-parser @babel/eslint-plugin @ecomfe/eslint-config
```

## 使用

在 `.eslintrc.js` 中使用：

```js
module.exports = {
    extends: [
        '@ecomfe/eslint-config',
    ],
};
```

也可开启严格模式：

```js
module.exports = {
    extends: [
        '@ecomfe/eslint-config/strict',
    ],
};
```

## 扩展

### `import`

如果需要检测与 `import` 相关的规则，需要安装这个插件：

```shell
npm i -D eslint-plugin-import
```

并在 `.eslintrc.js` 中引用：

```js
module.exports = {
    extends: [
        '@ecomfe/eslint-config',
        '@ecomfe/eslint-config/import',
        // 或者选择严格模式
        // '@ecomfe/eslint-config/import/strict',
    ],
};
```

注意这些规则会要求使用 ES6 的 `import` 来引入依赖，如果使用的是 `require` 则会出现检查错误，可禁用 `import/no-commonjs` 和 `import/unambiguous` 来解决。

### React

如果需要检测 React 相关的代码，需要安装相关插件：

```shell
npm i -D eslint-plugin-react eslint-plugin-react-hooks
```

并在 `.eslintrc.js` 中引用：

```js
module.exports = {
    extends: [
        '@ecomfe/eslint-config',
        '@ecomfe/eslint-config/react',
        // 或者选择严格模式
        // '@ecomfe/eslint-config/react/strict',
    ],
};
```

会自动检测本地 React 的版本，默认情况下无需其它配置。

### Vue

如果需要检测 Vue 相关的代码，需要安装相关插件：

```shell
npm i -D eslint-plugin-vue
```

并在 `.eslintrc.js` 中引用：

```js
module.exports = {
    extends: [
        '@ecomfe/eslint-config',
        '@ecomfe/eslint-config/vue', // 注意顺序
        // 或者选择严格模式
        // '@ecomfe/eslint-config/vue/strict',
    ],
};
```

### San

如果需要检测 San 相关的代码，需要安装相关插件：

```shell
npm i -D eslint-plugin-san
```

并在 `.eslintrc.js` 中引用：

```js
module.exports = {
    extends: [
        '@ecomfe/eslint-config',
        '@ecomfe/eslint-config/san', // 注意顺序
        // 或者选择严格模式
        // '@ecomfe/eslint-config/san/strict',
    ],
};
```

### TypeScript

如果需要检测 TypeScript 代码，需要安装相关插件：

```shell
npm i -D @typescript-eslint/parser @typescript-eslint/eslint-plugin
```

**除此之外，需要先安装`typescript`包，并在项目根目录有`tsconfig.json`文件**。

并在`.eslintrc.js`中引用：

```js
module.exports = {
    extends: [
        '@ecomfe/eslint-config',
        '@ecomfe/eslint-config/typescript',
        // 或者选择严格模式
        // '@ecomfe/eslint-config/typescript/strict',
    ],
};
```

## 细节

默认配置 `@ecomfe/eslint-config` 与 [FECS](https://github.com/ecomfe/fecs) 相同，但临时移除了 `fecs-*` 的规则。

严格版配置 `*/strict` 开启了更严格的规则。

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