@etchteam/eslint-config

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

Etch's standard eslint config

原始使用文档
文档目录24 节
  1. Install
  2. Usage
  3. Environment-Specific Configs
  4. Next.js
  5. Node.js / Express
  6. Angular
  7. Preact
  8. Web Components (Lit)
  9. NestJS
  10. Composable Configs
  11. Available Modules
  12. Environment Configs (Self-Contained)
  13. Required Peer Dependencies
  14. With lint-staged
  15. New project
  16. Existing project with husky and lint staged
  17. Usage with VSCode
  18. New project with no VSCode config
  19. Exisiting project with VSCode config
  20. Migrating from ESLint 8
  21. 1. Update Dependencies
  22. 2. Replace Configuration
  23. 3. Update Scripts (if needed)
  24. What's Changed

@etchteam/eslint

The eslint config that we use at Etch

⚠️ Version 1.0.0+ requires ESLint 9 - See migration guide below for upgrading.

Install

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

Usage

Create an eslint.config.js file in your project root:

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

export default etchConfig;

Environment-Specific Configs

For projects that don't need the full config, use environment-specific imports to reduce dependencies:

Next.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;

Node.js / Express

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

export default nodejs;

Angular

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

export default angular;

Preact

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 Components (Lit)

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;

NestJS

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

export default nestjs;

Composable Configs

Build custom configs by combining individual modules:

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',
    },
  },
];

Available Modules

ModuleDescription
baseCore rules: JS, TypeScript, security, imports, prettier
jsonJSON file linting
yamlYAML file linting
storybookStorybook best practices
reactReact + JSX accessibility

Environment Configs (Self-Contained)

ConfigIncludes
nextjsbase + json + yaml + storybook + react + Next.js rules
nodejsbase + json + yaml + Node.js globals
angularbase + json + yaml + storybook + Angular rules
preactbase + json + yaml + storybook + react (Preact settings)
web-componentsbase + json + yaml + storybook + Lit rules
nestjsbase + json + yaml + NestJS rules + Jest globals

Required Peer Dependencies

The base, json, and yaml modules have all their plugins included as package dependencies — no extra installs needed.

Other configs require additional plugins to be installed as peer dependencies:

ConfigAdditional plugins to install
Default (@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
nodejsNone
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

With lint-staged

New project

Run the following:

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

Existing project with husky and lint staged

Add the following to your lint-staged config:

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

Usage with VSCode

New project with no VSCode config

Run the following:

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

Exisiting project with VSCode config

Add the following to .vscode/settings.json:

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

Run the following:

# 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

Migrating from ESLint 8

If you're upgrading from ESLint 8, follow these steps:

1. Update Dependencies

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

2. Replace Configuration

Remove your old .eslintrc.* files and create a new eslint.config.js:

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

export default etchConfig;

3. Update Scripts (if needed)

ESLint 9 uses flat config by default, so your existing npm scripts should work without changes.

What's Changed

  • Flat config format - More explicit and performant
  • ESLint 9 compatibility - Latest features and fixes
  • Updated plugins - All plugins updated to latest versions
  • Modular configs - Import only what you need for your environment

版本与发布记录

@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's standard eslint config

如何安装 @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 和提交记录判断。