Skip to content

feat: allow config key sorting on files not named nuxt.config#630

Merged
antfu merged 2 commits intonuxt:mainfrom
benedictleejh:feature/relax-nuxt-config-keys-order
Nov 27, 2025
Merged

feat: allow config key sorting on files not named nuxt.config#630
antfu merged 2 commits intonuxt:mainfrom
benedictleejh:feature/relax-nuxt-config-keys-order

Conversation

@benedictleejh
Copy link
Contributor

🔗 Linked issue

resolves #606

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Currently, the nuxt-sort-config-keys rule only applies to a file named nuxt.config.{ts,js,mts,mjs,tsx,jsx}. This prevents people from using the rule to sort config files they may extract from the main Nuxt config due to e.g. file size. The rule is updated to remove the early return when the filename does not match nuxt.config.{ts,js,mts,mjs,tsx,jsx}.

As Nuxt supports the config-dir proposal, the default setup for nuxt/sort-config has been expanded to support .config/nuxt.{ts,js,mts,mjs,tsx,jsx} as well, following conventions from the proposal. Any other filename may be easily added using a user's own ESLint config.

This allows users to use this rule in their ESLint configs with other files as this rule would skip processing any file not matching the name, effectively ignoring ESLint configs applying it to other files
…onfig` Nuxt supports the [config-dir proposal](https://github.com/pi0/config-dir) in the code, though it seems to be left out of the docs at the moment. This commit only directly supports the convention for configs as defined in the proposal (i.e. `.config/<toolname>.<ext>`). For other filenames, users can use the rule in their own ESLint configs
@antfu antfu merged commit be2e993 into nuxt:main Nov 27, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants