Repository navigation
feat(eslint-config): add opt-in canonicalPluginNames for bun lint native rules - #61
Conversation
…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
Deploying code-style with
|
| 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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 53 |
| Duplication | 0 |
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryAdds opt-in
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 |
- 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.
|



Summary
Adds an opt-in
canonicalPluginNamesoption (defaultfalse) topleaseai()inpackages/eslint-config/src/index.ts. When enabled, rules are reported under the plugin names thatbun lintruns natively, which raises the number of rules Bun can run without falling back to ESLint.@typescript-eslint/*instead ofts/*. The option disables antfu'sautoRenamePluginsand reapplies antfu'sdefaultPluginRenamingwithout the@typescript-eslintandimport-liteentries, plusts → @typescript-eslint.ts/*rule settings in options and in user configs are renamed too.import/*comes fromeslint-plugin-importinstead ofeslint-plugin-import-lite, through the composer'sreplacePlugin('import', …). The plugin is lazily loaded, so nothing is loaded withimports: false, and a missing package raises a clear error.import/consistent-type-specifier-stylevalues are translated (top-level→prefer-top-level,inline→prefer-inline).node → nis intentionally not renamed. Bun runs none of antfu's 8 enablednode/*rules natively.Other changes:
eslint-plugin-import^2.32.0is an optional peer dependency and a dev dependency.testscript (bun test),@types/bun,@types/node, and the tsconfigtypes/includefor tests, matchingpackages/cli.README.mdandREADME.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 perbun lint --doctor. ESLint andbun lintboth report 0 problems on the repo.Caveats
eslint-disablecomments that namets/*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-import2.32.0's peer range excludes ESLint 10. It works in the tests, butnpm installfails with ERESOLVE unless the user addsoverridesor uses--legacy-peer-deps. bun and pnpm only warn.Tests
packages/eslint-config/test/index.test.tshas 6 tests, all passing:ts@typescript-eslintand keeps the other renamests/*settings from options and user configs are renamedimports: false@typescript-eslint/consistent-type-definitions,import/consistent-type-specifier-style, andimport/firstbun test,tsc --noEmit,bun run build, andbun 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:PleaseaiOptionsnow extendsOptionsConfigandOmit<TypedFlatConfigItem, 'files' | 'ignores'>, the same as antfu's options, sopleaseai({ rules })type-checks as the README shows.rulesfrom options are merged with the PleaseAI defaults. Before, they replaced the defaults and silently droppedantfu/top-level-functionandtest/prefer-lowercase-title.tsc('rules' does not exist in type 'PleaseaiOptions') and fails at runtime (test/prefer-lowercase-titlewaserror, notoff).Not in this PR (follow-ups)
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
bun run build)bun run lint)BREAKING CHANGE:note is included (opt-in, no breaking change)Summary by cubic
Adds an opt-in
canonicalPluginNamesoption (defaultfalse) topleaseai()sobun lintruns 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 perbun lint --doctor; ESLint behavior and the rules' logic are unchanged.Changes
@typescript-eslint/*instead ofts/*;ts/*rule settings in options and user configs are renamed too.import/*rules come fromeslint-plugin-importinstead ofeslint-plugin-import-lite; the plugin is lazy-loaded, andimport/consistent-type-specifier-stylevalues are translated.eslint-plugin-importis an optional peer dependency, and atestscript, tests, and docs were added.Caveats
eslint-disablecomments namingts/*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-import2.32.0's peer range excludes ESLint 10, so npm install fails with ERESOLVE unless the user addsoverridesor uses--legacy-peer-deps.Written for commit 4a8d10a. Summary will update on new commits.