@etchteam/eslint-config

中文文档
3.4.38发布于 2026/11/13ISCES Module构建来源已验证近 30 天下载 3655

Etch 标准 Eslint 配置

中文使用文档
文档目录24 节
  1. 安装
  2. 使用量
  3. 环境特定配置
  4. 下一个.js
  5. 节点.js / Express
  6. 角质
  7. 预录
  8. Web 组件( 鼠标)
  9. 网点JS
  10. 可编译配置
  11. 可用模块
  12. 环境配置(自定义)
  13. 所需同伴依赖
  14. 有了舞台
  15. 新项目
  16. 实施Husky和lint项目
  17. 使用 VSCode
  18. 没有 VSCode 配置的新工程
  19. 使用 VSCode 配置的探索项目
  20. 从ESLint 8 移动
  21. 1. 更新的附属关系
  22. 2. 替换配置
  23. 3. 更新脚本(如有需要)
  24. 变了什么

@techteam/slint (英语)

我们使用的埃斯林特配置 爱奇

++ 版本 1. 0.0+ 需要 ESLint 9 - 看到没 移徙指南 用于升级.

安装

npm i -D eslint@^9.0.0 prettier @etchteam/eslint-config eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-storybook

使用量

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

import etchConfig from '@etchteam/eslint-config';

export default etchConfig;

环境特定配置

对于不需要完全配置的项目,使用特定环境的进口以减少依赖性:

下一个.js

npm i -D eslint prettier @etchteam/eslint-config eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-storybook @next/eslint-plugin-next eslint-plugin-react-hooks
import nextjs from '@etchteam/eslint-config/nextjs';

export default nextjs;

节点.js / Express

npm i -D eslint prettier @etchteam/eslint-config
import nodejs from '@etchteam/eslint-config/nodejs';

export default nodejs;

角质

npm i -D eslint prettier @etchteam/eslint-config eslint-plugin-storybook angular-eslint
import angular from '@etchteam/eslint-config/angular';

export default angular;

预录

npm i -D eslint prettier @etchteam/eslint-config eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-storybook
import preact from '@etchteam/eslint-config/preact';

export default preact;

Web 组件( 鼠标)

npm i -D eslint prettier @etchteam/eslint-config eslint-plugin-storybook eslint-plugin-lit
import webComponents from '@etchteam/eslint-config/web-components';

export default webComponents;

网点JS

npm i -D eslint prettier @etchteam/eslint-config @darraghor/eslint-plugin-nestjs-typed
import nestjs from '@etchteam/eslint-config/nestjs';

export default nestjs;

可编译配置

通过组合单个模块构建自定义配置 :

import { base, json, yaml, react } from '@etchteam/eslint-config';

export default [
  ...base,
  ...json,
  ...yaml,
  ...react,
  {
    // Your custom overrides
    rules: {
      'react/prefer-read-only-props': 'warn',
    },
  },
];

可用模块

模块说明
base核心规则:JS、TypeScript、安全、进口、更美
jsonJSON 文件林入
yamlYAML 文件林入
storybook故事书最佳做法
reactReact + JSX 可访问性

环境配置(自定义)

配置包括
nextjs基础 + json + yaml + 故事本 + 反应 + Next.js 规则
nodejs基数 + json + yaml + 节点.js 全球
angular基础 + json + yaml + 故事本 + 角规则
preact基础 + json + yaml + 故事本 + 反应(预设)
web-components基础 + json + yaml + 故事本 + 立特规则
nestjs基础 + json + yaml + NestJS 规则 + 顶级全球赛

所需同伴依赖

这个 基础, (中文(简体) ), 乔森,以及 雅姆尔 模块包含其所有插件作为软件包依赖性——不需要额外安装.

其他配置需要作为对等依赖安装额外的插件 :

配置要安装的额外插件
默认( E)@etchteam/eslint-config(中文(简体) )eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-storybook
reacteslint-plugin-react eslint-plugin-jsx-a11y
storybookeslint-plugin-storybook
nextjseslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-storybook @next/eslint-plugin-next eslint-plugin-react-hooks
nodejs无
preacteslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-storybook
angulareslint-plugin-storybook angular-eslint
web-componentseslint-plugin-storybook eslint-plugin-lit
nestjs@darraghor/eslint-plugin-nestjs-typed

有了舞台

新项目

运行如下 :

npm i -D husky lint-staged

echo "module.exports = { '*.{ts,tsx,js,jsx,yml,yaml,json}': 'eslint --fix' };" > lint-staged.config.cjs

npx husky init

echo "npx --no-install -- lint-staged" > .husky/pre-commit

实施Husky和lint项目

在您的相位配置中添加以下内容:

'*.{ts,tsx,js,jsx,yml,yaml,json}': 'eslint --fix'

使用 VSCode

没有 VSCode 配置的新工程

运行如下 :

mkdir .vscode

echo "{ \"editor.formatOnSave\": false, \"editor.codeActionsOnSave\": { \"source.fixAll.eslint\": \"explicit\" } }" > .vscode/settings.json

# The VSCode prettier extension doesn't read the eslint config, so specific
# prettier overrides need to go in a prettier config for format on save
echo "export default { singleQuote: true };" > prettier.config.js

使用 VSCode 配置的探索项目

添加以下内容到 .vscode/settings.json数字 :

"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
  "source.fixAll.eslint": "explicit"
}

运行如下 :

# The VSCode prettier extension doesn't read the eslint config, so specific
# prettier overrides need to go in a prettier config for format on save
echo "export default { singleQuote: true };" > prettier.config.js

从ESLint 8 移动

如果你正在升级 从ESLint 8,遵循这些步骤:

1. 更新的附属关系

npm install eslint@^9.0.0 @etchteam/eslint-config@^1.0.0

2. 替换配置

移除旧的 .eslintrc.* 文件并创建新文件 eslint.config.js数字 :

import etchConfig from '@etchteam/eslint-config';

export default etchConfig;

3. 更新脚本(如有需要)

ESLint 9默认使用平面配置,因此您现有的npm脚本应该不作修改地工作.

变了什么

  • 平面配置格式 - 更明确、更能发挥作用
  • ESLint 9 兼容性 - 最新特点和修正
  • 更新的插件 - 更新到最新版本的所有插件
  • 模块配置 - 仅导入您需要的环境

版本与发布记录

@etchteam/eslint-config 共发布 410 个版本,首次发布于 2022/12/19;过去 12 个月发布了 172 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.4.38latest2026/11/13今天
3.4.372026/11/121 天前
3.4.362026/11/103 天前
3.4.352026/11/094 天前
3.4.342026/11/049 天前
3.4.332026/11/0211 天前

关于 @etchteam/eslint-config 的常见问题

@etchteam/eslint-config 是什么?

Etch 标准 Eslint 配置

如何安装 @etchteam/eslint-config?

在项目目录运行 npm install @etchteam/eslint-config,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:eslint(>=9.0.0)、prettier(>=3.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@etchteam/eslint-config 支持 TypeScript 吗?

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

@etchteam/eslint-config 支持 ESM 还是 CommonJS?

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

@etchteam/eslint-config 需要什么版本的 Node.js?

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

@etchteam/eslint-config 可以商用吗?

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

@etchteam/eslint-config 的下载量有多少?

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

@etchteam/eslint-config 还在维护吗?

最新版本 3.4.38 发布于 2026/11/13(今天);至今共发布 410 个版本,其中过去 12 个月发布了 172 个;首次发布于 2022/12/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。