Skip to content

feat(create-eslint-config): extend existing config#52

Open
hanna-skryl wants to merge 4 commits into
mainfrom
extend-existing-eslint-config
Open

feat(create-eslint-config): extend existing config#52
hanna-skryl wants to merge 4 commits into
mainfrom
extend-existing-eslint-config

Conversation

@hanna-skryl
Copy link
Copy Markdown
Collaborator

@hanna-skryl hanna-skryl commented May 5, 2026

Closes #47

The wizard now extends an existing eslint.config.js instead of printing a manual-merge snippet.

  • ESM-first detection. When both eslint.config.mjs and eslint.config.cjs exist in a project, the wizard picks the ESM file.

  • All-or-nothing file writes. tree.flush() writes files sequentially. If any write fails, originals are restored and freshly-created files are deleted before the error rethrows, so the project is never left in a half-written state.

  • Recast-based codegen. The wizard parses the user's source with recast, mutates the AST, and reprints. Untouched nodes keep their original formatting and comments.

  • Codegen module:

    • index.ts orchestrates
    • builders.ts constructs new AST nodes from selected presets and options
    • merge-target.ts reads and updates the user's AST
    • print.ts runs recast.print and an optional Prettier to polish the formatting

@hanna-skryl hanna-skryl self-assigned this May 5, 2026
@hanna-skryl hanna-skryl marked this pull request as ready for review May 11, 2026 14:01
@hanna-skryl hanna-skryl requested a review from matejchalk May 11, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement setup wizard for ESLint config

1 participant