(fixable) The --fix
option on the command line automatically fixes problems reported by this rule.
ESLint has two APIs that rules can use to report problems. The deprecated API accepts multiple arguments: context.report(node, [loc], message)
. The "new API" accepts a single argument: an object containing information about the reported problem. It is recommended that all rules use the new API.
This rule aims to disallow use of the deprecated context.report(node, [loc], message)
API.
The following patterns are considered warnings:
module.exports = {
create (context) {
context.report(node, 'This node is bad.');
},
};
The following patterns are not warnings:
module.exports = {
create (context) {
context.report({ node, message: 'This node is bad.' });
context.report({ node, loc, message: 'This node is bad.' });
},
};