Skip to main content

restrict-identifier-characters

Require identifiers to contain only english characters, digits, underscore, or dollar sign.

Targeted pattern scopeโ€‹

This rule checks all identifier names and reports names containing characters outside this allowed set:

  • ASCII letters (A-Z, a-z)
  • digits (0-9)
  • underscore (_)
  • dollar sign ($)

What this rule reportsโ€‹

This rule reports identifiers that include characters outside $, latin letters, digits, and _.

Why this rule existsโ€‹

It enforces ASCII-only identifier naming for repositories that prioritize uniform tooling behavior and readability across locales.

โŒ Incorrectโ€‹

const ะฐะฑะฒ = 1;

โœ… Correctโ€‹

const $x1 = 2;

Behavior and migration notesโ€‹

This rule reports only and does not provide an autofix.

Migration usually involves renaming identifiers and adjusting references.

Optionsโ€‹

This rule has no options.

Additional examplesโ€‹

function ะฟั€ะธะฒะตั‚ัั‚ะฒะธะต(): void {}
// โŒ reported

function greetingMessage(): void {}
// โœ… valid

ESLint flat config exampleโ€‹

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

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/restrict-identifier-characters": "error",
},
},
];

When not to use itโ€‹

Disable this rule if your codebase allows non-latin identifier names.

Package documentationโ€‹

Rule catalog ID: R064

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.