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.