Closed
Description
Describe the feature
As a possible new feature, I think that it could be useful to have a rule to keep nuxt.config.ts
clean and tidy by sorting its keys with specific criteria.
The inspiration for this is the jsonc/sort-keys
rule that is often used to keep package.json
ordered according to a specific pattern.
Especially when a project grows, nuxt.config.ts
can become quite large and contain many configuration items.
A possible example could be
export default defineNuxtConfig({
// place "modules" section first, and keep all entries alphabetically sorted.
modules: [
'@nuxt/image',
'@nuxtjs/seo',
'nuxt-icon',
// and so on
],
// other builtin config items
css: ['~/assets/css/fontface.css'],
components: {
// ...
}
// modules options, maybe alphabetically
image: {
//
}
// and so on
})
This is just an example of possible sorting criteria, but there can be even better I think.
I don't know if it is a good idea to have some preset rules for this, or if it is just something best left to the user.
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.