prettier-plugin-solidity
Version:
A Prettier Plugin for automatically formatting your Solidity code.
17 lines • 680 B
JavaScript
import { doc } from 'prettier';
const { group, indent, line } = doc.builders;
export const exponentiation = {
match: (op) => op === '**',
print: (node, path, print) => {
const right = [' ', node.operator, line, path.call(print, 'right')];
// If it's a single binary operation, avoid having a small right
// operand like - 1 on its own line
const shouldGroup = node.left.type !== 'BinaryOperation' &&
path.getParentNode().type !== 'BinaryOperation';
return group([
path.call(print, 'left'),
indent(shouldGroup ? group(right) : right)
]);
}
};
//# sourceMappingURL=exponentiation.js.map