eslint-plugin-ramda
Version:
ESLint rules for use with Ramda
30 lines (26 loc) • 646 B
JavaScript
;
const R = require('ramda');
const isCalling = require('../ast-helper').isCalling;
const create = context => ({
CallExpression(node) {
const match = isCalling({
name: 'and',
arguments: R.propSatisfies(R.lte(2), 'length')
});
if (match(node)) {
context.report({
node,
message: 'No redundant use of `and`. Use `&&` in this case'
});
}
}
});
module.exports = {
create,
meta: {
docs: {
description: 'Forbid using `and` in full call',
recommended: 'error'
}
}
};