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.