no-new-object
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-new-object": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
var myObject = new Object();
new Object();
var foo = new Object("foo");var myObject = new CustomObject();
var myObject = {};
var Object = function Object() {};
new Object();
var foo = Object("foo");Examples from the ESLint documentation.
no-new-object
eslint
export default [
{
rules: {
"no-new-object": "error",
},
},
];Oxlint does not have this rule.
nursery/noObjectConstructor
nursery · since 2.6.0
{
"linter": {
"rules": {
"nursery": {
"noObjectConstructor": "error"
}
}
}
}Disallow new operators outside of assignments or comparisons
Require or disallow Unicode byte order mark (BOM)
Disallow unnecessary computed property keys in objects and classes
Disallow throwing literals as exceptions