Skip to content

feat: Add typeAware option to the generated config when relevant.#406

Merged
Sysix merged 4 commits intomainfrom
add-type-aware-config
Mar 1, 2026
Merged

feat: Add typeAware option to the generated config when relevant.#406
Sysix merged 4 commits intomainfrom
add-type-aware-config

Conversation

@connorshea
Copy link
Copy Markdown
Member

This is supported in the Oxlint config file with the next release, so let's start generating configs accordingly.

When the --type-aware flag is used in oxlint-migrate and at least 1 type-aware rule is found, enable the option.

If the --type-aware flag is used but no type-aware rules are found, the typeAware option will not be enabled, as there would be no point in doing so.

I was hoping to avoid adding an extra loop to the index.ts that has to check every rule, but it isn't going to be that slow and the alternatives I can think of would all be pretty jank, so.

AI Disclosure: Only used for the allOutputRules check to find whether the config had any type-aware rules.

We can make the change to default-enable the --typeAware flag in a separate PR after this one.

@connorshea connorshea requested review from Sysix and Copilot February 27, 2026 01:41
@connorshea connorshea changed the title Add typeAware option to the generated config when relevant. feat: Add typeAware option to the generated config when relevant. Feb 27, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the oxlint-migrate tool to automatically add the typeAware configuration option when type-aware rules are detected in the migration output. This aligns with Oxlint's upcoming support for the typeAware config option.

Changes:

  • Added OxlintOptions type with typeAware and typeCheck properties to the configuration schema
  • Implemented logic to detect type-aware rules in the output config and enable the typeAware option when the --type-aware flag is used
  • Updated documentation and help text to reflect that the config option will be automatically set

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/types.ts Added OxlintOptions type and integrated it into OxlintConfig, removed unnecessary eslint-disable comment
src/index.ts Imported typeAwareRules and added logic to set options.typeAware when type-aware rules are detected
src/index.spec.ts Added comprehensive tests for the typeAware option behavior in various scenarios
src/plugins_rules.ts Removed outdated TODO comment
bin/oxlint-migrate.ts Updated help text to mention the config option
README.md Updated documentation to explain that the typeAware config option will be set
integration_test/snapshots/*.snap Updated snapshots to reflect the new options.typeAware field in outputs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…sulting config.

For when the `--type-aware` flag is used and at least 1 type-aware rule is found. If the `--type-aware` flag is used but no type-aware rules are found, the `typeAware` option will not be enabled, as there would be no point in doing so.

I was hoping to avoid adding an extra loop to the index.ts that has to check every rule, but it isn't going to be that slow and the alternatives I can think of would all be pretty jank, so.
…n if the type-aware rules are only in overrides.
@connorshea connorshea force-pushed the add-type-aware-config branch from 0e5cfde to dc89178 Compare February 27, 2026 02:05
@Sysix Sysix merged commit c56a149 into main Mar 1, 2026
2 checks passed
@Sysix Sysix deleted the add-type-aware-config branch March 1, 2026 15:05
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.

3 participants