computed-property-spacing
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"computed-property-spacing": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
Enforce consistent spacing inside computed property brackets
obj[foo ]
obj[ 'foo']
var x = {[ b ]: a}
obj[foo[ bar ]]
const { [ a ]: someProp } = obj;
({ [ b ]: anotherProp } = anotherObj);obj[foo]
var x = {[b]: a}
obj[ foo]
obj['foo' ]
obj[foo[ bar ]]
var x = {[ b]: a}
const { [a]: someProp } = obj;
({ [b ]: anotherProp } = anotherObj);class Foo {
[a ]() {}
get [b ]() {}
set [b ](value) {}
}
const Bar = class {
[ a](){}
static [ b]() {}
static get [ c ]() {}
static set [ c ](value) {}
}obj[foo]
obj['foo']
var x = {[b]: a}
obj[foo[bar]]
const { [a]: someProp } = obj;
({ [b]: anotherProp } = anotherObj);obj[ foo ]
obj[ 'foo' ]
var x = {[ b ]: a}
obj[ foo[ bar ] ]
const { [ a ]: someProp } = obj;
({ [ b ]: anotherProp } = anotherObj);class Foo {
[a]() {}
get [b]() {}
set [b](value) {}
}
const Bar = class {
[a](){}
static [b]() {}
static get [c]() {}
static set [c](value) {}
}Examples from the ESLint documentation.
computed-property-spacing
eslint
export default [
{
rules: {
"computed-property-spacing": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow the use of alert, confirm, and prompt
Disallow certain properties on certain objects
Enforce the use of variables within the scope they are defined