@aarongoldenthal/eslint-config-standard

中文文档
50.0.2发布于 2026/10/27MITES Module构建来源已验证近 30 天下载 4247

Standard ESLint configuration settings

原始使用文档
文档目录3 节
  1. Summary
  2. Usage
  3. Using individual configurations

@aarongoldenthal/eslint-config-standard

Summary

Custom ESLint configuration for all projects. Includes flat-config formatted configurations compatible with ESLint v9+ for the following:

Plugin NameConfig nameRule Prefix
eslintbase-confignone, core
@eslint-community/eslint-plugin-eslint-commentseslint-comments-configcomments
eslint-plugin-jestjest-configjest
eslint-plugin-jsdocjsdoc-configjsdoc
eslint-plugin-nnode-confignode
eslint-plugin-playwrightplaywright-configplaywright
eslint-plugin-unicornunicorn-config, esm-configunicorn
eslint-plugin-vitestvitest-configvitest
typescript-eslinttypescript-eslint-config@typescript-eslint

As flat configs, the package defines all required plugins/configurations as dependencies. Since flat config allows flexibility in the rule prefixes (that is, they don't have to match the plugin name), the rules prefixes are adapted in some cases to be more intuitive or readable. Configs may be single configs or arrays of configs, as appropriate, so they should be added using the ESLint utility function defineConfig(), which accommodates both types.

The core prefix has only one rule, core/complexity, that has a higher threshold. This provides a secondary check for cases where the lower threshold in the complexity rule is turned off, which otherwise allows unbounded complexity. Since re-use of core rules is an experimental capability, this must be enabled with environment variable ENABLE_ESLINT_CORE_RULE_DUPLICATES=true.

Most rule configurations are applicable to all JavaScript and TypeScript files (matching '**/*.{js,mjs,cjs,ts,mts,cts}'). The following configurations are exceptions and are applicable to files as noted:

  • base-config sets sourceType to commonjs for *.{js,cjs,ts,cts} files and module for *.{mjs,mts} files.
  • base-config includes a config that disables some rules for test files matching any of the following test patterns (for example max-lines, max-lines-per-function).
  • jest-config applies rules to files matching '**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts}' or '**/?(*.)+(spec|test).{js,mjs,cjs,ts,mts,cts}'.
  • vitest-config applies rules to ESM files matching '**/__tests__/**/*.{js,mjs,ts,mts}' or '**/?(*.)+(spec|test).{js,mjs,ts,mts}'.
  • playwright-config: applies rules to files matching '**/*.pwtest.{js,mjs,cjs,ts,mts,cts}', which differentiates them from Jest/Vitest test files.
  • unicorn-config includes a config that disables some rules for test files (matching any of the following test patterns), and applies some ESM-specific rules only applicable to *.{mjs,mts} files.
  • typescript-eslint-config applies typescript-eslint rules to JavaScript and all TypeScript files. Some of these rules extend core ESLint rules, so those core ESLint rules are turned off in this config to avoid conflicts. It also applies TypeScript-specific rules to TypeScript files only, and configures the @typescript-eslint/parser set to use the closest tsconfig.json file. For rules that are ESM/CJS specific, it assumes *.{js,ts} files are ESM, which differs from base-config. To ensure proper rule overrides, this config should be applied after base-config and esm-config.

With ESLint v9 the majority of formatting rules are deprecated and removed from base-config, but the eslint-config-prettier package is included and can be added to the config if prettier is also being used to ensure it takes priority for formatting, although it should be included last.

There is also an esm-config included for projects using ES modules instead of CommonJS modules. This config sets sourceType to module for *.{js,ts} files and includes unicorn-config ESM-specific rules.

Usage

This module is now pure ESM, so must be called from an ESM file, either eslint.config.js (if the project is ESM) or eslint.config.mjs (if the project is CJS).

There are three versions of recommended configurations covering CommonJS, ESM, and TypeScript, and the individual configurations can be manually configured as well.

The recommended configuration is for CommonJS with all plugin configurations enabled except vitest-config (it does include jest-config) and typescript-eslint-config. It does apply ESM-specific rules to *.{mjs,mts} files. The rules are applicable to all JavaScript and TypeScript files, but don't require TypeScript (no rules with types). To configure eslint.config.mjs with this configuration:

import { defineConfig, globalIgnores } from 'eslint/config';
import recommendedConfig from '@aarongoldenthal/eslint-config-standard/recommended';

export default defineConfig([
  recommendedConfig,
  globalIgnores(['node_modules/**', 'coverage/**'])
]);

Note the optional globalIgnores config that can be added last to ignore certain directories.

The recommended-esm configuration is the same as the recommended config, but for ESM. It includes the vitest-config instead of the jest-config, and also the esm-config (applicable to *.{js,ts} files), but doesn't include typescript-eslint-config. The rules are also applicable to all JavaScript and TypeScript files, but don't require TypeScript (no rules with types). It can be configured with:

import { defineConfig, globalIgnores } from 'eslint/config';
import recommendedConfig from '@aarongoldenthal/eslint-config-standard/recommended-esm';

export default defineConfig([
  recommendedConfig,
  globalIgnores(['node_modules/**', 'coverage/**'])
]);

The recommended-ts configuration is the same as the recommended-esm config, but also includes typescript-eslint-config, and therefore requires TypeScript (an optional peer dependency) and a tsconfig.json file. It can be configured with:

import { defineConfig, globalIgnores } from 'eslint/config';
import recommendedConfig from '@aarongoldenthal/eslint-config-standard/recommended-ts';

export default defineConfig([
  recommendedConfig,
  globalIgnores(['node_modules/**', 'coverage/**'])
]);

Using individual configurations

To configure eslint.config.js with individual plugins, see the recommended* configurations as examples.

Notes:

  • If used, the base-config should be included after other configurations, except esm-config, typescript-eslint-config, and prettier so those settings take precedence.
  • The jest-config and vitest-config have the same file applicability, so only one should be used.
  • If used, the esm-config should be configured after all functional JavaScript rules to ensure the overridden settings take precedence.
  • If used, the typescript-eslint-config should be configured after all other rules to ensure the overridden settings take precedence.
  • If used, the prettier config should be included last to take priority in disabling the applicable rules from all other configurations.

版本与发布记录

@aarongoldenthal/eslint-config-standard 共发布 100 个版本,首次发布于 2019/10/27;过去 12 个月发布了 20 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
50.0.2latest2026/10/2711 天前
50.0.12026/10/011 个月前
50.0.02026/09/111 个月前
49.0.02026/08/242 个月前
48.0.12026/08/033 个月前
48.0.02026/07/203 个月前

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

@aarongoldenthal/eslint-config-standard 是什么?

Standard ESLint configuration settings

如何安装 @aarongoldenthal/eslint-config-standard?

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

@aarongoldenthal/eslint-config-standard 支持 TypeScript 吗?

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

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

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

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

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

@aarongoldenthal/eslint-config-standard 可以商用吗?

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

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

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

@aarongoldenthal/eslint-config-standard 还在维护吗?

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