prefer-i18n-default-locale-first
Prefer placing i18n.defaultLocale first in i18n.locales.
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects the i18n object when locale arrays are statically resolvable.
What this rule reportsโ
This rule reports when i18n.locales includes defaultLocale but does not place it at index 0.
Why this rule existsโ
Putting defaultLocale first makes locale-priority intent immediately visible and keeps locale arrays easier to audit during reviews.
โ Incorrectโ
export default {
i18n: {
defaultLocale: "en",
locales: ["fr", "en"],
},
};
โ Correctโ
export default {
i18n: {
defaultLocale: "en",
locales: ["en", "fr"],
},
};
Behavior and migration notesโ
This rule autofixes inline locale arrays by moving the first defaultLocale occurrence to the front.
For identifier-backed locale arrays, it reports and provides a suggestion that replaces the property value with an explicit reordered array literal.
When not to use itโ
Do not use this rule if your team intentionally uses a different locale ordering convention.
Rule catalog ID: R055