Skip to content

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

Draft
hanna-skryl wants to merge 4 commits intomainfrom
extend-existing-eslint-config
Draft

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

Conversation

@hanna-skryl
Copy link
Copy Markdown
Collaborator

Closes #47

The wizard now extends an existing eslint.config.js instead of printing a manual-merge snippet. Adds AST-based codegen, atomic flush rollback, and ESM/CJS detection precedence.

  • 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 bytes, so user comments and formatting outside the inserted regions remain intact.

  • Codegen module:

    • index.ts orchestrates
    • builders.ts constructs new AST nodes from selected presets and option blocks
    • merge-target.ts reads, recognizes, and mutates the user's AST
    • print.ts runs recast.print and an optional Prettier finalize.

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