src/content/docs/linter/rules/no-div-regex.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.3.12` - Diagnostic Category: [`lint/nursery/noDivRegex`](/reference/diagnostics#diagnostic-category) - This rule has a [**safe**](/linter/#safe-fixes) fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - Sources: - Same as [`no-div-regex`](https://eslint.org/docs/latest/rules/no-div-regex){
"linter": {
"rules": {
"nursery": {
"noDivRegex": "error"
}
}
}
}
Disallow equal signs explicitly at the beginning of regular expressions.
This rule forbids equal signs (=) after the slash (/) at the beginning of a regular expression literal,
because the characters /= can be confused with a division assignment operator.
function bar() {
return /=foo/;
}
function bar() {
return /[=]foo/;
}