# @davincihealthcare/eslint-plugin-davinci 中文文档

规范地址：https://npmcn.com/package/%40davincihealthcare/eslint-plugin-davinci/

版本：1\.2\.2
npm 元数据更新时间：2026-10-29T19:50:46.934Z
中文译文更新时间：2026-11-11T16:14:34.146Z
软件包许可：未声明

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

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

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

- 包体积（解压后）：85.3 kB，35 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：^18\.18\.0 \|\| \>=20\.0\.0
- 运行依赖：4 个
- peer 依赖：eslint ^8\.56\.0，prettier ^3\.2\.5，eslint-plugin-vue ^9\.26\.0，vue-eslint-parser ^9\.4\.2，eslint-config-prettier ^9\.1\.0，eslint-plugin-prettier ^5\.1\.3，eslint-plugin-prefer-arrow ^1\.2\.3，eslint-plugin-unused-imports ^3\.2\.0，eslint-plugin-sort-imports-es6-autofix ^0\.6\.0
- 首次发布：2024-05-24T16:11:36.500Z
- 最新版本发布：2026-10-27T18:13:52.247Z
- 近 30 天下载量：7178（2026-10-12 至 2026-11-10，npm 官方下载统计）
- 已发布版本数：11（近 12 个月 1 个）

## 中文简介

仅适用于davinci 代码库的规则的自定义执行

## 安装

```sh
npm install @davincihealthcare/eslint-plugin-davinci
```

也可以使用：`pnpm add @davincihealthcare/eslint-plugin-davinci`、`yarn add @davincihealthcare/eslint-plugin-davinci`、`bun add @davincihealthcare/eslint-plugin-davinci`

## README

1.  安装 `@davincihealthcare/eslint-plugin-davinci` 作为 dev 依赖的软件包
    
    如果你在用的话 `eslint >= 9.0.0`,您还需要安装以下软件包作为依赖性:
    
    -   `@eslint/js`
    -   `@eslint/eslintrc`
2.  扩展 Eslint 配置文件中的插件
    
    **`.eslintrc.js`**
    
    ```
      module.exports = {
        extends: [
          'plugin:@davincihealthcare/davinci/recommended',
        ],
      }
    ```
    

**`eslint.config.js`**

```
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
    baseDirectory: __dirname,
    recommendedConfig: js.configs.recommended,
    allConfig: js.configs.all
});

export default [{
    ignores: ["dist", "**/tsconfig.json"],
}, ...compat.extends("plugin:@davincihealthcare/davinci/recommended")];
```

3.  如果你在用的话 `Turbo` 单曲 :
    
    -   安装 `eslint-config-turbo` 作为 dev 依赖
        
    -   扩展 `eslint-config-turbo` 配置中的插件 :
        
        **`.eslintrc.js`**
        
        ```
        (
          module.exports = {
            extends: [
              'plugin:@davincihealthcare/davinci/recommended',
              'eslint-config-turbo'
            ],
          }
        );
        ```
        
        **`eslint.config.js`**
        
        ```
        import path from "node:path";
        import { fileURLToPath } from "node:url";
        import js from "@eslint/js";
        import { FlatCompat } from "@eslint/eslintrc";
        
        const __filename = fileURLToPath(import.meta.url);
        const __dirname = path.dirname(__filename);
        const compat = new FlatCompat({
            baseDirectory: __dirname,
            recommendedConfig: js.configs.recommended,
            allConfig: js.configs.all
        });
        
        export default [{
            ignores: ["dist", "**/tsconfig.json"],
        }, ...compat.extends("plugin:@davincihealthcare/davinci/recommended", "eslint-config-turbo")];
        ```
        
4.  在你身边 `package.json` 文件中,您应该添加脚本来进行林入检查和/或尽可能自动修正林入错误
    
    -   丝林 < 9.0.0
    
    `package.json`
    
    ```
    {
        ...
        "scripts": {
            ...
            "eslint-check": "eslint -c .eslintrc.js --ext \".js,.ts\" ."
            "eslint-fix": "eslint --fix -c .eslintrc.js --ext \".js,.ts\" ."
            ...
        }
        ...
    }
    ```
    

````
- eslint >= 9.0.0

`package.json`
```
{
    ...
    "scripts": {
        ...
        "eslint-check": "eslint ."
        "eslint-fix": "eslint --fix ."
        ...
    }
    ...
}
```
````

## 规则

级别 `base`, (中文(简体) ), `recommended` 财务报告和审定财务报表 `vue` 相会相会.

| 规则 | 说明 | `base` 编号 : `recommended` | `vue` |
| --- | --- | --- | --- |
| [`no-native-date`](https://npmcn.com/package/%40davincihealthcare/eslint-plugin-davinci/docs/no-native-date.md) | 不使用本地语言 `Date` 对象,使用豪华 `DateTime` | 关 | 错误 |
| [`no-router-push`](https://npmcn.com/package/%40davincihealthcare/eslint-plugin-davinci/docs/no-router-push.md) | 不使用 `router.push`编号 :`resolve`,使用时 `useRouterUtils` | 错误 | 错误 |
| `no-unsafe-url-params` | 不使用不安全的 URL 参数, 使用 `useRouterUtils` | 错误 | 错误 |
| [`prefer-lookup-map`](https://npmcn.com/package/%40davincihealthcare/eslint-plugin-davinci/docs/prefer-lookup-map.md) | 偏好在 A 之上检查对象 `switch` 只将常数映射到结果 | 警告( e) | 警告( e) |
| [`simple-array-type`](https://npmcn.com/package/%40davincihealthcare/eslint-plugin-davinci/docs/simple-array-type.md) | 使用 `Type[]` 用于单一类型的简单数组 | 关 | 关 |
| [`tuple-array-type`](https://npmcn.com/package/%40davincihealthcare/eslint-plugin-davinci/docs/tuple-array-type.md) | 使用 `[Type]` 以定义拖曳 | 关 | 关 |

## 常见问题

### @davincihealthcare/eslint-plugin-davinci 是什么？

仅适用于davinci 代码库的规则的自定义执行

### 如何安装 @davincihealthcare/eslint-plugin-davinci？

在项目目录运行 npm install @davincihealthcare/eslint-plugin-davinci，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint（^8\.56\.0）、prettier（^3\.2\.5）、eslint-plugin-vue（^9\.26\.0）、vue-eslint-parser（^9\.4\.2）、eslint-config-prettier（^9\.1\.0）、eslint-plugin-prettier（^5\.1\.3）、eslint-plugin-prefer-arrow（^1\.2\.3）、eslint-plugin-unused-imports（^3\.2\.0）、eslint-plugin-sort-imports-es6-autofix（^0\.6\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @davincihealthcare/eslint-plugin-davinci 支持 TypeScript 吗？

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

### @davincihealthcare/eslint-plugin-davinci 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @davincihealthcare/eslint-plugin-davinci 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js ^18\.18\.0 \|\| \>=20\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @davincihealthcare/eslint-plugin-davinci 可以商用吗？

@davincihealthcare/eslint-plugin-davinci 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

### @davincihealthcare/eslint-plugin-davinci 的下载量有多少？

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

### @davincihealthcare/eslint-plugin-davinci 还在维护吗？

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

