@orderofchaos/eslint-plugin-ling
v0.2.0
Published
ESLint plugin for @orderofchaos/ling-react
Maintainers
Readme
@orderofchaos/eslint-plugin-ling
ESLint plugin for enforcing best practices with @orderofchaos/ling.
Ecosystem
- Marketing site: https://order-of-chaos.github.io/ling/
- Documentation: https://order-of-chaos.github.io/ling/#documentation
- GitHub: https://github.com/order-of-chaos/ling
| Package | Purpose | | --- | --- | | @orderofchaos/ling | Complete package that installs the full Ling toolkit and re-exports the React/core API. | | @orderofchaos/ling-core | Core types, storage adapters, translators, and pluralization utilities. | | @orderofchaos/ling-react | React provider, hooks, and module helpers for Ling apps. | | @orderofchaos/ling-cli | CLI tools for extracting and validating translation files. | | @orderofchaos/eslint-plugin-ling | ESLint rules that keep translation keys statically analyzable. |
Installation
pnpm add -D @orderofchaos/eslint-plugin-lingUsage
Flat Config (ESLint 9+)
// eslint.config.mjs
import ling from '@orderofchaos/eslint-plugin-ling';
export default [
{
plugins: { ling },
rules: {
'ling/require-literal-keys': 'error',
},
},
];Legacy Config (ESLint 8)
{
"plugins": ["@orderofchaos/ling"],
"rules": {
"@orderofchaos/ling/require-literal-keys": "error"
}
}Rules
require-literal-keys
Enforces that translation keys are string literals, not variables or expressions.
This enables static analysis tools like ling-scan to extract all translation keys.
✅ Correct
t('Hello World');
t('Welcome, {{name}}!', { name: 'User' });❌ Incorrect
const key = 'Hello';
t(key); // Error: Translation key must be a string literal
t(`Dynamic ${value}`); // Error: Template literals not allowed
t(getKey()); // Error: Function calls not allowedLicense
MIT
