securityos/node_modules/eslint-plugin-unicorn/rules/fix/remove-method-call.js

21 lines
660 B
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
'use strict';
const {getParenthesizedRange} = require('../utils/parentheses.js');
const removeMemberExpressionProperty = require('./remove-member-expression-property.js');
function * removeMethodCall(fixer, callExpression, sourceCode) {
const memberExpression = callExpression.callee;
// `(( (( foo )).bar ))()`
// ^^^^
yield removeMemberExpressionProperty(fixer, memberExpression, sourceCode);
// `(( (( foo )).bar ))()`
// ^^
const [, start] = getParenthesizedRange(memberExpression, sourceCode);
const [, end] = callExpression.range;
yield fixer.removeRange([start, end]);
}
module.exports = removeMethodCall;