Skip to content

feat(eslint-config): add opt-in canonicalPluginNames for bun lint native rules - #61

Merged
amondnet merged 4 commits into
mainfrom
feat/56-canonical-plugin-names
Oct 17, 2026
Merged

amondnet merged 4 commits into
mainfrom
feat/56-canonical-plugin-names

Conversation

@amondnet

@amondnet amondnet commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in canonicalPluginNames option (default false) to pleaseai() in packages/eslint-config/src/index.ts. When enabled, rules are reported under the plugin names that bun lint runs natively, which raises the number of rules Bun can run without falling back to ESLint.

  • typescript-eslint: rules are reported as @typescript-eslint/* instead of ts/*. The option disables antfu's autoRenamePlugins and reapplies antfu's defaultPluginRenaming without the @typescript-eslint and import-lite entries, plus ts → @typescript-eslint. ts/* rule settings in options and in user configs are renamed too.
  • import: import/* comes from eslint-plugin-import instead of eslint-plugin-import-lite, through the composer's replacePlugin('import', …). The plugin is lazily loaded, so nothing is loaded with imports: false, and a missing package raises a clear error. import/consistent-type-specifier-style values are translated (top-level → prefer-top-level, inline → prefer-inline).
  • node: node → n is intentionally not renamed. Bun runs none of antfu's 8 enabled node/* rules natively.

Other changes:

  • eslint-plugin-import ^2.32.0 is an optional peer dependency and a dev dependency.
  • Added a test script (bun test), @types/bun, @types/node, and the tsconfig types/include for tests, matching packages/cli.
  • New "Canonical Plugin Names" section in README.md and README.ko.md.

Measurement

With Bun's PR build 1.4.4-canary.1+a1ab4b531 (oven-sh/bun#45595), this repo's own config goes from 118 to 150 rules run natively per bun lint --doctor. ESLint and bun lint both report 0 problems on the repo.

Caveats

  • Existing eslint-disable comments that name ts/* rules become errors ("Definition for rule 'ts/…' was not found") when the option is on. The option is opt-in for that reason; default users see no change.
  • eslint-plugin-import 2.32.0's peer range excludes ESLint 10. It works in the tests, but npm install fails with ERESOLVE unless the user adds overrides or uses --legacy-peer-deps. bun and pnpm only warn.

Tests

packages/eslint-config/test/index.test.ts has 6 tests, all passing:

  • the default keeps ts
  • canonical mode registers @typescript-eslint and keeps the other renames
  • ts/* settings from options and user configs are renamed
  • import-lite is replaced and the option value is translated
  • no import plugin is loaded with imports: false
  • an end-to-end ESLint 10 lint reports @typescript-eslint/consistent-type-definitions, import/consistent-type-specifier-style, and import/first

bun test, tsc --noEmit, bun run build, and bun run lint (whole repo) all pass (7 tests).

Also fixed: pleaseai({ rules })

A separate commit (fix(eslint-config): accept flat config keys in pleaseai() options) fixes a gap that predates this PR:

  • PleaseaiOptions now extends OptionsConfig and Omit<TypedFlatConfigItem, 'files' | 'ignores'>, the same as antfu's options, so pleaseai({ rules }) type-checks as the README shows.
  • rules from options are merged with the PleaseAI defaults. Before, they replaced the defaults and silently dropped antfu/top-level-function and test/prefer-lowercase-title.
  • A new test covers both. Against the previous code it fails tsc ('rules' does not exist in type 'PleaseaiOptions') and fails at runtime (test/prefer-lowercase-title was error, not off).

Not in this PR (follow-ups)

  • The docs site pages apps/docs/src/content/docs/{en,ko}/eslint-config/ are not updated.

Related issue

Refs #56. The issue also covers other proposal items and a tracking effort that stay open after this PR.

Checklist

  • PR title follows Conventional Commits
  • Packages build (bun run build)
  • Lint/format pass (bun run lint)
  • Documentation updated if behavior changed
  • No breaking change, or a BREAKING CHANGE: note is included (opt-in, no breaking change)

Summary by cubic

Adds an opt-in canonicalPluginNames option (default false) to pleaseai() so bun lint runs more rules natively instead of falling back to ESLint. With Bun's canary build (oven-sh/bun#45595), this repo's config goes from 118 to 150 native rules per bun lint --doctor; ESLint behavior and the rules' logic are unchanged.

Changes

  • typescript-eslint rules are reported as @typescript-eslint/* instead of ts/*; ts/* rule settings in options and user configs are renamed too.
  • import/* rules come from eslint-plugin-import instead of eslint-plugin-import-lite; the plugin is lazy-loaded, and import/consistent-type-specifier-style values are translated.
  • eslint-plugin-import is an optional peer dependency, and a test script, tests, and docs were added.

Caveats

  • Existing eslint-disable comments naming ts/* rules become errors ("Definition for rule 'ts/…' was not found") when the option is on; the option is opt-in for that reason.
  • eslint-plugin-import 2.32.0's peer range excludes ESLint 10, so npm install fails with ERESOLVE unless the user adds overrides or uses --legacy-peer-deps.

Written for commit 4a8d10a. Summary will update on new commits.

Turn on auto-fix

…ive rules

Registers typescript-eslint as @typescript-eslint instead of ts and
replaces eslint-plugin-import-lite with eslint-plugin-import, the names
and packages Bun's bun lint runs natively. eslint-plugin-import is an
optional peer dependency, loaded only when the option is on.

Refs #56
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Deploying code-style with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4a8d10a
Status: ✅  Deploy successful!
Preview URL: https://ce7c883e.code-style.pages.dev
Branch Preview URL: https://feat-56-canonical-plugin-nam.code-style.pages.dev

View logs

@socket-security

socket-security Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedeslint-plugin-import@​2.32.09810010083100

View full report

@codacy-production

codacy-production Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 53 complexity · 0 duplication

Metric Results
Complexity 53
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Type the options like antfu's (OptionsConfig plus the flat config keys
except files and ignores), so pleaseai({ rules }) type-checks. Merge
rules from options with the PleaseAI defaults instead of replacing them,
which silently dropped antfu/top-level-function and
test/prefer-lowercase-title.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new 'canonicalPluginNames' option to the '@pleaseai/eslint-config' package, allowing users to register ESLint plugins under their standard canonical names (such as '@typescript-eslint/' instead of 'ts/' and using 'eslint-plugin-import' instead of 'eslint-plugin-import-lite'). This enables compatibility with tools like Bun's native linter. The changes include implementation logic in 'src/index.ts', corresponding test suites in 'test/index.test.ts', updated package dependencies, and updated documentation in both English and Korean README files. There are no review comments to assess, and I have no additional feedback to provide.

@amondnet
amondnet marked this pull request as ready for review October 17, 2026 08:35

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Architecture diagram
sequenceDiagram
    participant User as User Config (eslint.config.ts)
    participant Pleaseai as pleaseai() in packages/eslint-config/src/index.ts
    participant Antfu as @antfu/eslint-config (composer)
    participant Rename as renamePlugins() / replacePlugin() / onResolved()
    participant ImportPlugin as eslint-plugin-import (optional)
    participant BunLint as bun lint (canary)
    participant ESLint as ESLint 10

    Note over User,ESLint: Runtime flow: pleaseai() config building and lint execution

    User->>Pleaseai: Call pleaseai({ canonicalPluginNames, rules, ...userConfigs })
    Pleaseai->>Pleaseai: Destructure options, default canonicalPluginNames=false
    Pleaseai->>Antfu: Call antfu() with merged options (stylistic, typescript, gitignore, rules)

    alt canonicalPluginNames = false (default)
        Antfu-->>Pleaseai: Composer with antfu plugin renames (ts, import-lite, etc.)
        Pleaseai-->>User: Return composer directly (no canonical changes)
    else canonicalPluginNames = true
        Antfu-->>Pleaseai: Composer built with autoRenamePlugins disabled
        Pleaseai->>Rename: Chain .renamePlugins()
        Rename->>Rename: Apply canonicalPluginRenaming (ts→@typescript-eslint, keep style/test/yaml, no node rename)
        Pleaseai->>Rename: Chain .replacePlugin('import', ...)
        Rename->>ImportPlugin: Lazy import('eslint-plugin-import')
        alt Import plugin missing
            ImportPlugin-->>Rename: Error "requires eslint-plugin-import"
            Rename-->>Pleaseai: Re-throw with clear message
        else Import plugin present
            Rename->>Rename: Chain .onResolved() to translate import rule options
            Rename->>ImportPlugin: Use eslint-plugin-import under 'import' name
        end
        Rename-->>Pleaseai: Final composer with canonical names
        Pleaseai-->>User: Return modified composer
    end

    User->>BunLint: Run bun lint (reads eslint.config.js)
    BunLint->>Pleaseai: Execute config module
    Pleaseai-->>BunLint: Config with plugin registrations

    alt canonicalPluginNames = true
        BunLint->>BunLint: Recognize @typescript-eslint/* and import/* rules natively
        BunLint->>BunLint: Run 150 rules natively (vs 118 with antfu names)
    else canonicalPluginNames = false
        BunLint->>ESLint: Fall back to ESLint for renamed plugins
    end

    User->>ESLint: Run eslint (node, npm script, etc.)
    ESLint->>Pleaseai: Execute config module
    Pleaseai-->>ESLint: Config (works identically with or without canonical names)
    ESLint-->>User: Lint results (0 problems in repo tests)
Loading

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/eslint-config/src/index.ts
Comment thread packages/eslint-config/tsconfig.json
Comment thread packages/eslint-config/README.ko.md Outdated
@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Adds opt-in canonicalPluginNames support for Bun’s native lint rules.

  • Bun can use canonical TypeScript and import rule names.
  • Custom pleaseai() rules keep the built-in defaults.

No new actionable issues found. The earlier package-loading test concern is addressed by isolated child-process checks. Tests were inspected, not run.

Reviews (3) · Last reviewed commit: "fix(eslint-config): look up type specifi..." · Reviewed by Greptile

Comment thread packages/eslint-config/test/index.test.ts
- Type-check tsdown.config.ts again (tsconfig include).
- Test in a child process that resolving with imports disabled never
  loads eslint-plugin-import, and that a missing package gets the
  install hint.
- README: limit the 'works as before' claim to rule logic, and state
  which Bun build the native-rule counts come from.
A plain-object lookup resolved prototype keys such as 'toString' to
inherited members instead of passing the value through, and Codacy
flagged it as an object-injection sink.
@sonarqubecloud

Copy link
Copy Markdown

@amondnet
amondnet merged commit 5454e2d into main Oct 17, 2026
13 checks passed
@amondnet
amondnet deleted the feat/56-canonical-plugin-names branch October 17, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant