@codacy/tools-eslint-9
v0.21.0
Published
ESLint 9 adapter — Library-mode JavaScript/TypeScript linter
Readme
@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.
| Property | Value |
| ------------- | ------------------------------------------------ |
| Tool ID | ESLint9 |
| Codacy UUID | 2a30ab97-477f-4769-8b88-af596ce7a94c |
| Strategy | Library |
| Languages | JavaScript, TypeScript |
| Dependency | eslint npm package (v9.x) + 68 plugin packages |
| Patterns | 2900 (292 core + 2608 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.jsonPattern 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
- Update
eslintand related packages inpackage.json - Run
pnpm install - Run
pnpm prefetchto check for new/removed rules - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
eslint-10/)
Development
pnpm build # Build with tsup
pnpm test # Run testsNotes for maintainers
Preset mappings (
src/pattern-mappings.json): prefixes only. SonarJS's four React rules and@stylistic's JSX rules live underESLint9_sonarjs_/ESLint9_@stylistic_beside those plugins' framework-agnostic rules, so thereactkey names them explicitly (ESLint9_@stylistic_jsx-plus the four SonarJS ids). Codacy tags themreactjs, but gating on the tag is wrong here: the same tag sits on rules that are not React rules, and becausefilterAutoPatternsORs 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 underjsonc/yml.There is no
webdriveriokey, even thoughplugin-registry.tsstill loadseslint-plugin-wdioand ESLint 8's mapping still gates onESLint8_wdio_. Codacy dropped the wdio ruleset from ESLint 9's catalog, soESLint9_wdio_matches nothing upstream and the key was gating patterns that can no longer be selected.mapping-drift.test.tswill only catch this oncepnpm prefetchrefreshespatterns.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.tsfile contains 30+ rules known to crash ESLint or produce severe false positives, sourced from the codacy-eslint9 wrapper. TheisBlacklisted()function also checks regex patterns (e.g.unused-imports/*-ts).The
plugin-registry.tshandles 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.tsgenerates 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/jsrecommended config.checkAvailabilityimports the ESLint class and returnsESLint.version.installis a no-op — the npm dependency handles installation.Peer dependency warnings from plugins not yet updated for ESLint 9 are expected and match the codacy-eslint9 wrapper behavior.
