Skip to main content

no-language-mixing

Disallow mixed-language tokens combining latin and non-latin letters.

Targeted pattern scope​

This rule checks string literals and template literal raw segments.

It reports tokens that mix latin letters with non-latin letters in the same word-like segment.

What this rule reports​

This rule reports string and template content where latin and non-latin characters are mixed in one token.

Why this rule exists​

Mixed-script tokens can hide confusable text and reduce readability in internationalized codebases.

❌ Incorrect​

const x1 = "яz";
const x2 = "xyz123Π°Π±Π²";

βœ… Correct​

const x = "xyz";
const y = "123";
const z = "Π°Π±Π²";

Behavior and migration notes​

This rule reports only and does not provide an autofix.

Migrate by separating scripts per token or using one script consistently.

Options​

This rule has no options.

Additional examples​

const message = `ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒ id42`;
// βœ… each token is single-script or numeric

const mixed = `ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒId42`;
// ❌ reported (mixed script token)

ESLint flat config example​

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/no-language-mixing": "error",
},
},
];

When not to use it​

Disable this rule if mixed-language tokens are expected and accepted in your project.

Package documentation​

Rule catalog ID: R030

Further reading​

Adoption resources​

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.