no-bitwise
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-bitwise": "error",
},
},
];let x = y | z;
const x1 = y & z;
const x2 = y ^ z;
const x3 = ~ z;
const x4 = y << z;
const x5 = y >> z;
const x6 = y >>> z;
x |= y;
x &= y;
x ^= y;
x <<= y;
x >>= y;
x >>>= y;let x = y || z;
const x1 = y && z;
const x2 = y > z;
const x3 = y < z;
x += y;Examples from the ESLint documentation.
no-bitwise
eslint
export default [
{
rules: {
"no-bitwise": "error",
},
},
];no-bitwise
eslint plugin · restriction
{
"rules": {
"no-bitwise": "error"
}
}suspicious/noBitwiseOperators
suspicious · since 2.0.0
{
"linter": {
"rules": {
"suspicious": {
"noBitwiseOperators": "error"
}
}
}
}Enforce the use of variables within the scope they are defined
Require for-in loops to include an if statement
Require var declarations be placed at the top of their containing scope
Require grouped accessor pairs in object literals and classes
Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead
Disallow returning values from Promise executor functions