✔️ The "extends": "plugin:eslint-plugin/recommended"
property in a configuration file enables this rule.
ESLint requires fixable rules to specify a valid meta.fixable
property (with value code
or whitespace
).
This rule aims to require fixable ESLint rules to have a valid meta.fixable
property.
Examples of incorrect code for this rule:
/* eslint eslint-plugin/require-meta-fixable: "error" */
module.exports = {
meta: {}, // missing `fixable` property
create (context) {
context.report({
node,
message: 'foo',
fix (fixer) {
return fixer.remove(node);
},
});
},
};
/* eslint eslint-plugin/require-meta-fixable: "error" */
module.exports = {
meta: { fixable: 'not a valid meta.fixable value' },
create (context) {
context.report({
node,
message: 'foo',
fix (fixer) {
return fixer.remove(node);
},
});
},
};
Examples of correct code for this rule:
/* eslint eslint-plugin/require-meta-fixable: "error" */
module.exports = {
meta: { fixable: 'code' },
create (context) {
context.report({
node,
message: 'foo',
fix (fixer) {
return fixer.remove(node);
},
});
},
};
/* eslint eslint-plugin/require-meta-fixable: "error" */
module.exports = {
meta: {},
create (context) {
context.report({
node,
message: 'foo',
});
},
};