@azat-io/eslint-config

中文文档
2.103.0发布于 2026/11/04MITTypeScriptES Module构建来源已验证近 30 天下载 4663

ESLint shareable config

原始使用文档
文档目录16 节
  1. Usage
  2. Configuration
  3. perfectionist
  4. typescript
  5. svelte
  6. vitest
  7. astro
  8. react
  9. qwik
  10. node
  11. vue
  12. Runtime targets
  13. extends
  14. Plugins
  15. See also
  16. License

ESLint Config

ESLint Config Logo

Version GitHub License

A comprehensive and flexible ESLint configuration that supports a wide range of frameworks and environments. Easily integrate clean, consistent code standards across projects by enabling settings for specific tools and libraries.

This config covers multiple setups in a single, straightforward import, helping maintain consistency across different project types and frameworks.

Usage

Running ESLint requires Node.js ^22.22.3 || ^24.16.0 || >=26.3.0, matching the requirements of the included plugins. The code you lint can target older runtimes.

  1. Install package:
pnpm add --save-dev eslint @azat-io/eslint-config
  1. Create ESLint configuration file eslint.config.js:
import eslintConfig from '@azat-io/eslint-config'

export default eslintConfig({
  root: import.meta.dirname,
  perfectionist: true,
  typescript: true,
  react: true,
  node: true,
})
  1. Add script for package.json:
{
  "scripts": {
    "test:js": "eslint \"**/*.{js,ts,jsx,tsx,json}\""
  }
}

Configuration

To configure the ESLint rules based on your project’s needs, import the config and pass an object with options for each framework or tool. Framework and tool flags are disabled by default. Runtime compatibility checks are enabled automatically.

import eslintConfig from '@azat-io/eslint-config'

export default eslintConfig({
  perfectionist: true,
  typescript: true,
  svelte: true,
  vitest: true,
  astro: true,
  react: true,
  qwik: true,
  node: true,
  vue: true,
})

perfectionist

Enables rules for sorting and organizing code structures for better readability and consistency.

typescript

Adds TypeScript-specific linting rules to ensure type safety and maintain TypeScript best practices.

svelte

Enables support for Svelte, including linting rules for Svelte components and files.

vitest

Adds support for Vitest, adjusting linting for testing files and practices within Vitest projects.

astro

Configures ESLint for Astro projects, with adjustments for Astro’s file structure and conventions.

react

Includes React-specific linting rules for JSX syntax, React hooks, and best practices within React environments.

qwik

Adds support for Qwik, adjusting linting for Qwik-specific syntax and conventions.

node

Adjusts linting for Node.js environments, addressing Node-specific globals, imports, and common practices.

vue

Adds Vue-specific linting rules, supporting Vue's syntax and best practices for Vue components.

Runtime targets

The config reads the nearest package.json and Browserslist configuration to disable rules that would introduce unsupported APIs. Runtime overrides apply to source files supported by the enabled configs, leaving JSON files unaffected.

import eslintConfig from '@azat-io/eslint-config'

export default eslintConfig({
  root: import.meta.dirname,
  targets: {
    browsers: 'baseline widely available',
    node: '>=22',
  },
  toolingNode: '>=24',
  typescript: true,
})

root is the directory or file URL used for runtime target discovery. It defaults to process.cwd(); set it explicitly in monorepos or when running ESLint from another directory.

targets defaults to 'auto'. Its node and browsers keys override automatic discovery independently; omitted keys are still detected, and false excludes that runtime. Node.js targets come from engines.node, then Browserslist Node.js queries, then the Node.js 22 fallback. A bare explicit version such as '22.12' means that version or newer. The node: true flag enables Node.js lint rules and is separate from targets.node.

toolingNode sets a different Node.js target for config files and files in scripts/, bin/ and tools/. Only extensions already enabled in the config are included. Otherwise tooling uses the detected project Node.js target, including in browser-only projects.

Additional runtime options:

OptionDefaultPurpose
browserslistEnv'production'Select the Browserslist environment.
pinnedDateSupport data datePin relative Baseline queries, including shared configs.
fallback{ node: '22.0.0' }Choose a fallback Node.js target, or disable with false.
missingBrowsers'ignore'Ignore missing browser targets, use 'off', or queries.
unknownBrowsers'off'Disable dependent rules or 'ignore' unknown browsers.
ignoreBrowsers['op_mini']Replace the list of ignored Browserslist agents.
quietfalseKeep warnings in config settings without printing them.

Resolved target sources, warnings and disabled rules are available under settings['azat-io/runtime'] in ESLint's --print-config output. Custom extends configs run after the runtime overrides, so explicit rule choices take priority.

extends

You can add your own configs. Example:

import eslintConfig from '@azat-io/eslint-config'

export default eslintConfig({
  extends: [
    {
      rules: {
        'no-undef': 'off',
      },
    },
  ],
})

Plugins

This config uses the following plugins:

See also

License

MIT © Azat S.

版本与发布记录

@azat-io/eslint-config 共发布 146 个版本,首次发布于 2024/11/17;过去 12 个月发布了 50 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.103.0latest2026/11/043 天前
2.102.02026/10/2810 天前
2.101.02026/10/2216 天前
2.100.02026/10/1424 天前
2.99.02026/10/1127 天前
2.98.02026/09/301 个月前

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

@azat-io/eslint-config 是什么?

ESLint shareable config

如何安装 @azat-io/eslint-config?

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

@azat-io/eslint-config 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

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

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

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

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

@azat-io/eslint-config 可以商用吗?

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

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

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

@azat-io/eslint-config 还在维护吗?

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