src/content/docs/linter/rules/no-misrefactored-shorthand-assign.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> ## Summary - Rule available since: `v1.3.0` - Diagnostic Category: [`lint/suspicious/noMisrefactoredShorthandAssign`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule has an [**unsafe**](/linter/#unsafe-fixes) fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`misrefactored_assign_op`](https://rust-lang.github.io/rust-clippy/master/#misrefactored_assign_op){
"linter": {
"rules": {
"suspicious": {
"noMisrefactoredShorthandAssign": "error"
}
}
}
}
Disallow shorthand assign when variable appears on both sides.
This rule helps to avoid potential bugs related to incorrect assignments or unintended side effects that may occur during refactoring.
a += a + b
a -= a - b
a *= a * b
a += b
a = a + b
a = a - b