Translation files: read the language files in node too and enforce the lint rules
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,8 +34,7 @@ export default tseslint.config(
|
||||
},
|
||||
{
|
||||
// Texts of the site live in the language files (src/i18n), not in the
|
||||
// JSX. Warning for now while the pages are moved over, an error when
|
||||
// that is done. Left out: the hero (becomes a CMS module), tests and
|
||||
// JSX (an error, so a new hardcoded text is stopped). Left out: the hero (becomes a CMS module), tests and
|
||||
// the build-only helpers.
|
||||
files: ['src/components/**/*.tsx', 'src/routes/**/*.tsx'],
|
||||
ignores: [
|
||||
@@ -49,16 +48,16 @@ export default tseslint.config(
|
||||
rules: {
|
||||
// Text in attributes that people read or hear (labels, alt text)
|
||||
'no-restricted-syntax': [
|
||||
'warn',
|
||||
'error',
|
||||
{
|
||||
selector:
|
||||
"JSXAttribute[name.name=/^(aria-label|aria-description|alt|title|placeholder|label)$/][value.type='Literal']",
|
||||
"JSXAttribute[name.name=/^(aria-label|aria-description|alt|title|placeholder|label)$/][value.type='Literal'][value.value!='']",
|
||||
message:
|
||||
'Put the text in a language file (src/i18n) and use t().',
|
||||
},
|
||||
],
|
||||
'react/jsx-no-literals': [
|
||||
'warn',
|
||||
'error',
|
||||
{
|
||||
noStrings: false,
|
||||
ignoreProps: true,
|
||||
|
||||
Reference in New Issue
Block a user