@codacy/tools-eslint-9

中文文档
0.28.0发布于 2026/11/09MITTypeScriptCommonJS近 30 天下载 1.2万

ESLint 9 adapter — Library-mode JavaScript/TypeScript linter

原始使用文档
文档目录6 节
  1. Table of Contents
  2. Overview
  3. Updating patterns
  4. Updating the ESLint version
  5. Development
  6. Notes for maintainers

@codacy/tools-eslint-9

Table of Contents


Overview

JavaScript/TypeScript linter using ESLint 9 with the flat config format. Uses the Library execution strategy — calls the ESLint API directly rather than spawning a subprocess.

PropertyValue
Tool IDESLint9
Codacy UUID2a30ab97-477f-4769-8b88-af596ce7a94c
StrategyLibrary
LanguagesJavaScript, TypeScript
Dependencyeslint npm package (v9.x) + 68 plugin packages
Patterns3259 (292 core + 2967 plugin)
File patterns**/*.js, **/*.jsx, **/*.ts, **/*.tsx

Updating patterns

# Re-fetch pattern metadata from the Codacy API
pnpm prefetch

# Commit the result
git add src/patterns.json

Pattern IDs use the codacy-eslint9 encoding: _ → __, / → _. Examples:

  • ESLint9_no-unused-vars (core rule)
  • ESLint9_@typescript-eslint_no-unused-vars (scoped plugin)
  • ESLint9_react_jsx-no-target-blank (non-scoped plugin)

Updating the ESLint version

  1. Update eslint and related packages in devDependencies of package.json, and preferredVersion in src/metadata.ts
  2. Run pnpm install
  3. Run pnpm generate-payloads eslint-9 from the repo root to re-pin payload/package.json and regenerate its lockfile
  4. Run pnpm prefetch to check for new/removed rules
  5. Run pnpm test to verify compatibility
  6. If the major version changes, create a new adapter package (eslint-10/)

Development

pnpm build    # Build with tsup
pnpm test     # Run tests

Notes for maintainers

  • Preset mappings (src/pattern-mappings.json): prefixes only. SonarJS's four React rules and @stylistic's JSX rules live under ESLint9_sonarjs_ / ESLint9_@stylistic_ beside those plugins' framework-agnostic rules, so the react key names them explicitly (ESLint9_@stylistic_jsx- plus the four SonarJS ids). Codacy tags them reactjs, but gating on the tag is wrong here: the same tag sits on rules that are not React rules, and because filterAutoPatterns ORs matched keys, a tag also drags in rules prefix-owned by other keys entirely (i18next/no-literal-string, perfectionist/sort-jsx-props — the latter duplicating @stylistic/jsx-sort-props). Measured on an ordinary React login form, tag gating produced 15 findings from rules the project had no reason to enable. Same reasoning for the Vue SFC custom-block rules under jsonc/yml.

    There is no webdriverio key, even though plugin-registry.ts still loads eslint-plugin-wdio and ESLint 8's mapping still gates on ESLint8_wdio_. Codacy dropped the wdio ruleset from ESLint 9's catalog, so ESLint9_wdio_ matches nothing upstream and the key was gating patterns that can no longer be selected. mapping-drift.test.ts will only catch this once pnpm prefetch refreshes patterns.json — the committed mirror still lists the three rules. Do not re-add the key without checking the tool's live pattern list first.

  • ESLint 9 uses the flat config format exclusively. The adapter generates flat config arrays when building from Codacy patterns.

  • Pattern IDs use the same encoding as the codacy-eslint9 wrapper: _ → __ then / → _ (encode), reverse for decode. This means _ in rule names is escaped as __.

  • The blacklist.ts file contains 30+ rules known to crash ESLint or produce severe false positives, sourced from the codacy-eslint9 wrapper. The isBlacklisted() function also checks regex patterns (e.g. unused-imports/*-ts).

  • The plugin-registry.ts handles lazy loading of all 68 ESLint plugin packages. Plugins are only loaded when rules from that plugin are in the active pattern selection.

  • The config-builder.ts generates flat config objects from Codacy patterns, grouping rules by plugin and setting up appropriate parsers. TypeScript files get @typescript-eslint/parser; Vue/Svelte/JSONC/YML files get appropriate file globs.

  • When no config or patterns are provided, the adapter falls back to @eslint/js recommended config.

  • checkAvailability imports the ESLint class and returns ESLint.version.

  • The tool is an npm payload, not a dependency: it is resolved at run time (a Codacy-managed install under ~/.codacy/tools/<id>/, a CODACY_TOOL_ROOT_<ID> root, or this package's own node_modules in the monorepo) and install runs npm ci against the committed payload/package-lock.json. See src/payload.ts.

  • Peer dependency warnings from plugins not yet updated for ESLint 9 are expected and match the codacy-eslint9 wrapper behavior.

版本与发布记录

@codacy/tools-eslint-9 共发布 36 个版本,首次发布于 2026/03/24;过去 12 个月发布了 36 个版本。

版本发布日期距今
0.28.0latest2026/11/09今天
0.27.12026/11/054 天前
0.27.02026/11/036 天前
0.26.02026/10/3010 天前
0.25.02026/10/1921 天前
0.24.02026/09/251 个月前

关于 @codacy/tools-eslint-9 的常见问题

@codacy/tools-eslint-9 是什么?

ESLint 9 adapter — Library-mode JavaScript/TypeScript linter

如何安装 @codacy/tools-eslint-9?

在项目目录运行 npm install @codacy/tools-eslint-9,或使用 pnpm add / yarn add / bun add。

@codacy/tools-eslint-9 支持 TypeScript 吗?

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

@codacy/tools-eslint-9 支持 ESM 还是 CommonJS?

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

@codacy/tools-eslint-9 需要什么版本的 Node.js?

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

@codacy/tools-eslint-9 可以商用吗?

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

@codacy/tools-eslint-9 的下载量有多少?

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

@codacy/tools-eslint-9 还在维护吗?

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