💼 This rule is enabled in the ✅ recommended
config.
🔧 This rule is automatically fixable by the --fix
CLI option.
Prior to ESLint v9, ESLint supported both function-style and object-style rules. However, function-style rules have been deprecated since 2016, and do not support newer features like autofixing and suggestions.
As of ESLint v9, ESLint supports only object-style rules.
The rule reports an error if it encounters a rule that's defined using the deprecated function-style format.
Examples of incorrect code for this rule:
/* eslint eslint-plugin/prefer-object-rule: error */
module.exports = function create(context) {
return {
Program() {
context.report();
},
};
};
Examples of correct code for this rule:
/* eslint eslint-plugin/prefer-object-rule: error */
module.exports = {
meta: {
/* ... */
},
create(context) {
return {
Program() {
context.report();
},
};
},
};