For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt, and this page is available as Markdown at https://rslint.rs/rules/eslint/no-div-regex.md.
close

no-div-regex

Added in v0.8.1

Configuration

rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-div-regex': 'error',
    },
  },
]);

Rule Details

Disallows equal signs explicitly at the beginning of regular expression literals, since /= at the start of a regular expression can be visually confused with a division-assignment operator.

Examples of incorrect code for this rule:

function bar() {
  return /=foo/;
}

Examples of correct code for this rule:

function bar() {
  return /[=]foo/;
}

Original Documentation