An ESLint configuration to help with localizing Sanity Studios.
This ESLint config provides rules to enforce specific code standards in internationalization practices, particularly focusing on strings literals in JSX. It aims to improve code quality and maintainability in projects with internationalization concerns.
This package utilizes @rushstack/eslint-patch to include plugins as dependencies. This making installation easier and allows us to manage those dependencies for you.
Depends on:
yarn add eslint @sanity/eslint-config-i18n --dev
or
npm install eslint @sanity/eslint-config-i18n --save-dev
Update your .eslintrc
to include "@sanity/eslint-config-i18n"
{
"extends": [
"@sanity/eslint-config-studio",
"@sanity/eslint-config-i18n"
]
}
Optionally: If you wish to configure @sanity/eslint-plugin-i18n
:
{
"extends": ["@sanity/eslint-config-studio", "@sanity/eslint-config-i18n"],
"rules": {
"@sanity/i18n/no-attribute-string-literals": [
"error",
// See https://github.com/sanity-io/eslint-plugin-i18n#rule-options
{
"ignores": {},
"only": {},
"mode": "extend"
}
],
"@sanity/i18n/no-attribute-template-literals": [
"error",
// See https://github.com/sanity-io/eslint-plugin-i18n#rule-options
{
"ignores": {},
"only": {},
"mode": "extend"
}
]
},
"overrides": [
// turn off these rules for your tests
{
"files": [
"**/*/test/**/*",
"**/*/__tests__/**/*",
"**/*.test.{js,ts,tsx}"
],
"rules": {
"i18next/no-literal-string": "off",
"@sanity/i18n/no-attribute-string-literals": "off",
"@sanity/i18n/no-attribute-template-literals": "off"
}
}
]
}
Run "CI & Release" workflow. Make sure to select the main branch and check "Release new version".
Semantic release will only release on configured branches, so it is safe to run release on any branch.