alleyinteractive / alleyinteractive/alley-scripts

Custom Oxlint JS plugin for WordPress i18n

Abierto
#859 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
10
Forks
3
Merge medio
4 d 22 h
PR fusionados (30 d)
2

Descripción

### Description

Currently, for proper i18n support, if you need to check text domains in js files, one needs to use [this package](https://www.npmjs.com/package/@wordpress/eslint-plugin). WPCS removed support for checking js files, so this package is the new way to do it. We should take that into account.

---

Create `@alleyinteractive/oxlint-wp-i18n` with a native support for the Oxlint JS plugin.

**Rules to implement** (from `@wordpress/eslint-plugin`):
1. `i18n-ellipsis` - enforce proper ellipsis in translatable strings
2. `i18n-hyphenated-range` - validate hyphenation in range expressions
3. `i18n-no-collapsible-whitespace` - prevent unnecessary whitespace in i18n strings
4. `i18n-no-flanking-whitespace` - no leading/trailing whitespace in translations
5. `i18n-no-placeholders-only` - disallow strings with only placeholders
6. `i18n-no-variables` - prevent variable interpolation in translation calls
7. `i18n-text-domain` - enforce correct text domain
8. `i18n-translator-comments` - require translator comments

**Approach:**
- Use Oxlint's JS plugin API (`jsPlugins` in oxlintrc.json)
- Port the rule logic from `@wordpress/eslint-plugin` source (GPL-2.0 compatible)
- Target WordPress translation functions: `__()`, `_x()`, `_n()`, `_nx()`, `sprintf()`
- Ship as separate npm package: `@alleyinteractive/oxlint-plugin-wordpress-i18n`
- Add documentation to use it this new package
- Add documentation to use https://www.npmjs.com/package/@wordpress/eslint-plugin as a bridge

### Use Case

As titled.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.